From 97a49aa672f663b3f84f2ff3874e697108d67d30 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 10 Jan 2014 08:20:26 +0100 Subject: [PATCH] Improve output in print() methods. --- inst/cta/src/GCTAEventCube.cpp | 18 +++++++++++------- inst/cta/src/GCTAEventList.cpp | 28 ++++++++++++++++------------ inst/cta/src/GCTAObservation.cpp | 10 +++++++--- inst/cta/src/GCTAPointing.cpp | 2 +- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/inst/cta/src/GCTAEventCube.cpp b/inst/cta/src/GCTAEventCube.cpp index 23b4cab..8913b4e 100644 --- a/inst/cta/src/GCTAEventCube.cpp +++ b/inst/cta/src/GCTAEventCube.cpp @@ -490,16 +490,20 @@ std::string GCTAEventCube::print(const GChatter& chatter) const } // Append energy intervals - if (ebounds().size() > 0) { - result.append("\n"+ebounds().print(gammalib::reduce(chatter))); - } - else { - result.append("\n"+gammalib::parformat("Energy intervals") + - "not defined"); + if (gammalib::reduce(chatter) > SILENT) { + if (ebounds().size() > 0) { + result.append("\n"+ebounds().print(gammalib::reduce(chatter))); + } + else { + result.append("\n"+gammalib::parformat("Energy intervals") + + "not defined"); + } } // Append skymap definition - result.append("\n"+m_map.print(gammalib::reduce(chatter))); + if (gammalib::reduce(chatter) > SILENT) { + result.append("\n"+m_map.print(gammalib::reduce(chatter))); + } } // endif: chatter was not silent diff --git a/inst/cta/src/GCTAEventList.cpp b/inst/cta/src/GCTAEventList.cpp index 414a085..15fd6e2 100644 --- a/inst/cta/src/GCTAEventList.cpp +++ b/inst/cta/src/GCTAEventList.cpp @@ -449,21 +449,25 @@ std::string GCTAEventList::print(const GChatter& chatter) const } // Append energy intervals - if (ebounds().size() > 0) { - result.append("\n"+ebounds().print(gammalib::reduce(chatter))); - } - else { - result.append("\n"+gammalib::parformat("Energy intervals") + - "not defined"); + if (gammalib::reduce(chatter) > SILENT) { + if (ebounds().size() > 0) { + result.append("\n"+ebounds().print(gammalib::reduce(chatter))); + } + else { + result.append("\n"+gammalib::parformat("Energy intervals") + + "not defined"); + } } // Append ROI - if (roi().radius() > 0) { - result.append("\n"+roi().print(gammalib::reduce(chatter))); - } - else { - result.append("\n"+gammalib::parformat("Region of interest") + - "not defined"); + if (gammalib::reduce(chatter) > SILENT) { + if (roi().radius() > 0) { + result.append("\n"+roi().print(gammalib::reduce(chatter))); + } + else { + result.append("\n"+gammalib::parformat("Region of interest") + + "not defined"); + } } // EXPLICIT: Append IRF cache diff --git a/inst/cta/src/GCTAObservation.cpp b/inst/cta/src/GCTAObservation.cpp index 5ba2a31..6beeaec 100644 --- a/inst/cta/src/GCTAObservation.cpp +++ b/inst/cta/src/GCTAObservation.cpp @@ -654,13 +654,17 @@ std::string GCTAObservation::print(const GChatter& chatter) const result.append(gammalib::str(m_deadc)); // Append pointing - result.append("\n"+pointing().print(gammalib::reduce(chatter))); + if (gammalib::reduce(chatter) > SILENT) { + result.append("\n"+pointing().print(gammalib::reduce(chatter))); + } // Append response - result.append("\n"+response().print(gammalib::reduce(chatter))); + if (gammalib::reduce(chatter) > SILENT) { + result.append("\n"+response().print(gammalib::reduce(chatter))); + } // Append events - if (m_events != NULL) { + if (m_events != NULL && gammalib::reduce(chatter) > SILENT) { result.append("\n"+m_events->print(gammalib::reduce(chatter))); } diff --git a/inst/cta/src/GCTAPointing.cpp b/inst/cta/src/GCTAPointing.cpp index 9eae902..14bc20a 100644 --- a/inst/cta/src/GCTAPointing.cpp +++ b/inst/cta/src/GCTAPointing.cpp @@ -231,7 +231,7 @@ std::string GCTAPointing::print(const GChatter& chatter) const // Append information result.append("\n"+gammalib::parformat("Pointing direction")); - result.append(this->dir().print(gammalib::reduce(chatter))); + result.append(this->dir().print()); } // endif: chatter was not silent -- libgit2 0.21.4