diff --git a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h index 7798384ae01d33b145330cace10763b3753b550b..369e15c3a757e6c20d9255bc7aae75c1d0948a9d 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h @@ -67,10 +67,10 @@ public: virtual ~GenericMonitoringTool(); virtual StatusCode initialize(); - virtual std::vector<HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables); + virtual std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables); private: ServiceHandle<ITHistSvc> m_histSvc; - std::vector<HistogramFiller*> m_fillers; //!< list of fillers + std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers std::string m_histogramsGroupName; //!< property (name of group to which histograms would be generated) std::vector<std::string> m_histograms; //!< property (list of histogram definitions) }; diff --git a/Control/AthenaMonitoring/AthenaMonitoring/HistogramDef.h b/Control/AthenaMonitoring/AthenaMonitoring/HistogramDef.h index c6e8458ba9e0b828ad75010631d5e789a7ae8f53..d333023d0d3d545bf511f974aa8abd27d34c1aee 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/HistogramDef.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/HistogramDef.h @@ -4,37 +4,47 @@ #ifndef HistogramDef_h #define HistogramDef_h + +#include <stdexcept> +#include <vector> +#include <string> -/** - * @brief the internal class used to keep parsed Filler properties - * - */ -struct HistogramDef { - std::vector<std::string> name; //!< names of variables - std::string alias; //!< histogram name alias - std::string type; //!< histogram type - std::string path; //!< booking path - std::string title; //!< title of the histogram - std::string opt; //!< options - - int xbins{0}; //!< number of bins in X - float xmin{0}; //!< left - float xmax{0}; //!< right - - int ybins{0}; //!< number of bins in Y - float ymin{0}; //!< bottom - float ymax{0}; //!< top - - float zmin{0}; //!< in - float zmax{0}; //!< out - - bool ok{false}; //!< good declaration - bool ycut{false}; //!< TProfile with cut on y - bool zcut{false}; //!< TProfile2D with cut on z - - std::vector<std::string> labels; //!< bins labels - - static const HistogramDef parse(const std::string& jobOpts); //!< utility method to parse JO -}; +namespace Monitored { + struct HistogramDefParseException: public std::runtime_error { + HistogramDefParseException(std::string const& message) + : std::runtime_error(message) {} + }; + /** + * @brief the internal class used to keep parsed Filler properties + * + */ + struct HistogramDef { + std::vector<std::string> name; //!< names of variables + std::string alias; //!< histogram name alias + std::string type; //!< histogram type + std::string path; //!< booking path + std::string title; //!< title of the histogram + std::string opt; //!< options + + int xbins{0}; //!< number of bins in X + float xmin{0}; //!< left + float xmax{0}; //!< right + + int ybins{0}; //!< number of bins in Y + float ymin{0}; //!< bottom + float ymax{0}; //!< top + + float zmin{0}; //!< in + float zmax{0}; //!< out + + bool ok{false}; //!< good declaration + bool ycut{false}; //!< TProfile with cut on y + bool zcut{false}; //!< TProfile2D with cut on z + + std::vector<std::string> labels; //!< bins labels + + static const HistogramDef parse(const std::string& jobOpts); //!< utility method to parse JO + }; +} #endif /* HistogramDef_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h b/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h index 2395ebed05b0987b7a2cdf66e811763c93186fad..c4400c7c8a0cdca7721727d7f3c9f43ab9a6f712 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h @@ -20,172 +20,174 @@ #include "AthenaMonitoring/IMonitoredVariable.h" #include "AthenaMonitoring/HistogramDef.h" - -/** - * @brief base class for fillers - */ -class HistogramFiller { -public: - HistogramFiller(TH1* hist, HistogramDef histDef) - : m_hist(hist), m_mutex(std::make_shared<std::mutex>()), m_histDef(new HistogramDef(histDef)) {} - HistogramFiller(const HistogramFiller& hf) - : m_hist(hf.m_hist), m_mutex(hf.m_mutex), m_histDef(hf.m_histDef) {} - HistogramFiller(HistogramFiller&&) = default; - - virtual ~HistogramFiller() {} - virtual unsigned fill() = 0; - virtual HistogramFiller* clone() = 0; - - void setMonitoredVariables(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) { - m_monVariables = monitoredVariables; - } - std::vector<std::string> histogramVariablesNames() { - return m_histDef->name; - } +namespace Monitored { + /** + * @brief base class for fillers + */ + class HistogramFiller { + public: + HistogramFiller(TH1* hist, HistogramDef histDef) + : m_hist(hist), m_mutex(std::make_shared<std::mutex>()), m_histDef(new HistogramDef(histDef)) {} + HistogramFiller(const HistogramFiller& hf) + : m_hist(hf.m_hist), m_mutex(hf.m_mutex), m_histDef(hf.m_histDef) {} + HistogramFiller(HistogramFiller&&) = default; -protected: - virtual TH1* histogram() = 0; - - TH1* m_hist; - std::shared_ptr<std::mutex> m_mutex; - std::shared_ptr<HistogramDef> m_histDef; - std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> m_monVariables; + virtual ~HistogramFiller() {} + virtual unsigned fill() = 0; + virtual HistogramFiller* clone() = 0; -private: - HistogramFiller& operator=(HistogramFiller const&) = delete; -}; - -class HistogramFillerFactory { -private: - class MonitoringGroup { - public: - enum Level { debug, expert, shift, express, runsum, runstat = runsum }; + void setMonitoredVariables(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) { + m_monVariables = monitoredVariables; + } + + std::vector<std::string> histogramVariablesNames() { + return m_histDef->name; + } + + protected: + virtual TH1* histogram() = 0; + + TH1* m_hist; + std::shared_ptr<std::mutex> m_mutex; + std::shared_ptr<HistogramDef> m_histDef; + std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> m_monVariables; + private: - std::string level2string(Level l) const; - public: - MonitoringGroup(ServiceHandle<ITHistSvc> histSvc, std::string groupName, Level l); + HistogramFiller& operator=(HistogramFiller const&) = delete; + }; - StatusCode regHist(TH1* h); - StatusCode deregHist(TH1* h); + class HistogramFillerFactory { + private: + class MonitoringGroup { + public: + enum Level { debug, expert, shift, express, runsum, runstat = runsum }; + private: + std::string level2string(Level l) const; + public: + MonitoringGroup(ServiceHandle<ITHistSvc> histSvc, std::string groupName, Level l); - template <class T> - T* getHist(const std::string& hname) const { - T* h(0); - const std::string name = level2string(m_level) + m_groupName + "/" + hname; - if (m_histSvc->exists(name)) { - m_histSvc->getHist(name, h).ignore(); + StatusCode regHist(TH1* h); + StatusCode deregHist(TH1* h); + + template <class T> + T* getHist(const std::string& hname) const { + T* h(0); + const std::string name = level2string(m_level) + m_groupName + "/" + hname; + if (m_histSvc->exists(name)) { + m_histSvc->getHist(name, h).ignore(); + } + return h; } - return h; - } + private: + ServiceHandle<ITHistSvc> m_histSvc; + std::string m_groupName; + Level m_level; + }; + + public: + HistogramFillerFactory(ServiceHandle<ITHistSvc> histSvc, std::string groupName); + virtual ~HistogramFillerFactory(); + HistogramFiller* create(const HistogramDef& def); //!< creates filler*/ + private: + template<class H, class HBASE, typename... Types> + HBASE* create(const HistogramDef& def, Types&&... hargs); + template<class H> + TH1* create1D(const HistogramDef& def); + template<class H> + TH1* create1DProfile(const HistogramDef& def); + template<class H> + TH1* create2D(const HistogramDef& def); + template<class H> + TH1* create2DProfile(const HistogramDef& def); + + static void setOpts(TH1* hist, const std::string& opt); + static void setLabels(TH1* hist, const std::vector<std::string>& labels); + ServiceHandle<ITHistSvc> m_histSvc; std::string m_groupName; - Level m_level; + std::map<std::string, MonitoringGroup*> m_histogramCategory; //!< predefined categories (drive booking paths) }; -public: - HistogramFillerFactory(ServiceHandle<ITHistSvc> histSvc, std::string groupName); - virtual ~HistogramFillerFactory(); - HistogramFiller* create(const HistogramDef& def); //!< creates filler*/ + /** + * @brief filler for plain 1D hisograms + */ + class HistogramFiller1D : public HistogramFiller { + public: + HistogramFiller1D(TH1* hist, HistogramDef histDef) + : HistogramFiller(hist, histDef) {} + virtual unsigned fill(); + HistogramFiller1D* clone() override { return new HistogramFiller1D(*this); }; + protected: + virtual TH1* histogram() { return m_hist; } + }; -private: - template<class H, class HBASE, typename... Types> - HBASE* create(const HistogramDef& def, Types&&... hargs); - template<class H> - TH1* create1D(const HistogramDef& def); - template<class H> - TH1* create1DProfile(const HistogramDef& def); - template<class H> - TH1* create2D(const HistogramDef& def); - template<class H> - TH1* create2DProfile(const HistogramDef& def); + /** + * @brief filler for 1D hisograms filled in cummulative mode + */ + class CumulativeHistogramFiller1D : public HistogramFiller1D { + public: + CumulativeHistogramFiller1D(TH1* hist, HistogramDef histDef) + : HistogramFiller1D(hist, histDef) {} + virtual unsigned fill(); + virtual CumulativeHistogramFiller1D* clone() override { return new CumulativeHistogramFiller1D(*this); }; + }; - static void setOpts(TH1* hist, const std::string& opt); - static void setLabels(TH1* hist, const std::vector<std::string>& labels); + class VecHistogramFiller1D : public HistogramFiller1D { + public: + VecHistogramFiller1D(TH1* hist, HistogramDef histDef) + : HistogramFiller1D(hist, histDef) {} + virtual unsigned fill(); + virtual VecHistogramFiller1D* clone() override { return new VecHistogramFiller1D(*this); }; + }; - ServiceHandle<ITHistSvc> m_histSvc; - std::string m_groupName; - std::map<std::string, MonitoringGroup*> m_histogramCategory; //!< predefined categories (drive booking paths) -}; - -/** - * @brief filler for plain 1D hisograms - */ -class HistogramFiller1D : public HistogramFiller { -public: - HistogramFiller1D(TH1* hist, HistogramDef histDef) - : HistogramFiller(hist, histDef) {} - virtual unsigned fill(); - HistogramFiller1D* clone() override { return new HistogramFiller1D(*this); }; -protected: - virtual TH1* histogram() { return m_hist; } -}; - -/** - * @brief filler for 1D hisograms filled in cummulative mode - */ -class CumulativeHistogramFiller1D : public HistogramFiller1D { -public: - CumulativeHistogramFiller1D(TH1* hist, HistogramDef histDef) - : HistogramFiller1D(hist, histDef) {} - virtual unsigned fill(); - virtual CumulativeHistogramFiller1D* clone() override { return new CumulativeHistogramFiller1D(*this); }; -}; - -class VecHistogramFiller1D : public HistogramFiller1D { -public: - VecHistogramFiller1D(TH1* hist, HistogramDef histDef) - : HistogramFiller1D(hist, histDef) {} - virtual unsigned fill(); - virtual VecHistogramFiller1D* clone() override { return new VecHistogramFiller1D(*this); }; -}; - -class VecHistogramFiller1DWithOverflows : public HistogramFiller1D { -public: - VecHistogramFiller1DWithOverflows(TH1* hist, HistogramDef histDef) - : HistogramFiller1D(hist, histDef) {} - virtual unsigned fill(); - virtual VecHistogramFiller1DWithOverflows* clone() override { return new VecHistogramFiller1DWithOverflows(*this); }; -}; - -/** - * @brief filler for profile 1d histogram - */ -class HistogramFillerProfile : public HistogramFiller { -public: - HistogramFillerProfile(TProfile* hist, HistogramDef histDef) - : HistogramFiller(hist, histDef) {}; - virtual unsigned fill(); - virtual HistogramFillerProfile* clone() override { return new HistogramFillerProfile(*this); }; -protected: - virtual TProfile* histogram() { return static_cast<TProfile*>(m_hist); } -}; - -/** - * @brief filler for plain 2D hisograms - */ -class HistogramFiller2D : public HistogramFiller { -public: - HistogramFiller2D(TH2* hist, HistogramDef histDef) - : HistogramFiller(hist, histDef) {}; - virtual unsigned fill(); - virtual HistogramFiller2D* clone() override { return new HistogramFiller2D(*this); }; -protected: - virtual TH2* histogram() { return static_cast<TH2*>(m_hist); } -}; - -/** - * @brief filler for profile 2D histogram - */ -class HistogramFiller2DProfile : public HistogramFiller { -public: - HistogramFiller2DProfile(TProfile2D* hist, HistogramDef histDef) - : HistogramFiller(hist, histDef) {}; - virtual unsigned fill(); - virtual HistogramFiller2DProfile* clone() override { return new HistogramFiller2DProfile(*this); }; -protected: - virtual TProfile2D* histogram() { return static_cast<TProfile2D*>(m_hist); } -}; + class VecHistogramFiller1DWithOverflows : public HistogramFiller1D { + public: + VecHistogramFiller1DWithOverflows(TH1* hist, HistogramDef histDef) + : HistogramFiller1D(hist, histDef) {} + virtual unsigned fill(); + virtual VecHistogramFiller1DWithOverflows* clone() override { return new VecHistogramFiller1DWithOverflows(*this); }; + }; + + /** + * @brief filler for profile 1d histogram + */ + class HistogramFillerProfile : public HistogramFiller { + public: + HistogramFillerProfile(TProfile* hist, HistogramDef histDef) + : HistogramFiller(hist, histDef) {}; + virtual unsigned fill(); + virtual HistogramFillerProfile* clone() override { return new HistogramFillerProfile(*this); }; + protected: + virtual TProfile* histogram() { return static_cast<TProfile*>(m_hist); } + }; + /** + * @brief filler for plain 2D hisograms + */ + class HistogramFiller2D : public HistogramFiller { + public: + HistogramFiller2D(TH2* hist, HistogramDef histDef) + : HistogramFiller(hist, histDef) {}; + virtual unsigned fill(); + virtual HistogramFiller2D* clone() override { return new HistogramFiller2D(*this); }; + protected: + virtual TH2* histogram() { return static_cast<TH2*>(m_hist); } + }; + + /** + * @brief filler for profile 2D histogram + */ + class HistogramFiller2DProfile : public HistogramFiller { + public: + HistogramFiller2DProfile(TProfile2D* hist, HistogramDef histDef) + : HistogramFiller(hist, histDef) {}; + virtual unsigned fill(); + virtual HistogramFiller2DProfile* clone() override { return new HistogramFiller2DProfile(*this); }; + protected: + virtual TProfile2D* histogram() { return static_cast<TProfile2D*>(m_hist); } + }; +} + #endif /* HistogramFiller */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/AthenaMonitoring/MonitoredScope.h b/Control/AthenaMonitoring/AthenaMonitoring/MonitoredScope.h index 98d7d53176bccbf961084fc58e26703e048e26b6..204c3ef1526130597045ca1afdee90374b597706 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/MonitoredScope.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/MonitoredScope.h @@ -51,7 +51,7 @@ namespace Monitored { : mTool(tool), mAutoSave(true), mScopeMonitored(scopeMonitored), - mHistogramsFillers(mTool.retrieve().isSuccess() ? mTool->getHistogramsFillers(mScopeMonitored) : std::vector<HistogramFiller*>()) { } + mHistogramsFillers(!mTool.empty() ? mTool->getHistogramsFillers(mScopeMonitored) : std::vector<HistogramFiller*>()) { } }; } diff --git a/Control/AthenaMonitoring/share/GenericMonitoringToolTest_jobOptions.py b/Control/AthenaMonitoring/share/GenericMonitoringToolTest_jobOptions.py index 5ea1dafc33517b42bd833096afb41218342061c8..1eb9e3c39383012896c3bb3a3d768fa7f35224d6 100755 --- a/Control/AthenaMonitoring/share/GenericMonitoringToolTest_jobOptions.py +++ b/Control/AthenaMonitoring/share/GenericMonitoringToolTest_jobOptions.py @@ -24,6 +24,7 @@ from TrigMonitorBase.TrigGenericMonitoringToolConfig import defineHistogram from AthenaMonitoring.AthenaMonitoringConf import GenericMonitoringTool genericMonTool = GenericMonitoringTool('monitoringTool') +genericMonTool.HistogramsGroupName = "TestGroup" genericMonTool.Histograms += [defineHistogram('phi', type='TH1D', title="PHI", diff --git a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx index dfe167089f92de50c3388939b6730029628edc03..1157480f4554116fffe782bf8db69f2e75456c49 100644 --- a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx @@ -13,6 +13,7 @@ #include "AthenaMonitoring/HistogramDef.h" using namespace std; +using namespace Monitored; const InterfaceID& GenericMonitoringTool::interfaceID() { static InterfaceID GenericMonitoringTool_ID("GenericMonitoringTool", 1, 0); diff --git a/Control/AthenaMonitoring/src/GenericMonitoringToolTest.cxx b/Control/AthenaMonitoring/src/GenericMonitoringToolTest.cxx index 591765d2bd916751ee6f030945a7597f53cda048..2323b8fac4a90eebf58dc9af537d72426fcf5e9d 100644 --- a/Control/AthenaMonitoring/src/GenericMonitoringToolTest.cxx +++ b/Control/AthenaMonitoring/src/GenericMonitoringToolTest.cxx @@ -15,7 +15,7 @@ using namespace std; using namespace Monitored; GenericMonitoringToolTest::GenericMonitoringToolTest(const string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator) { + : AthAlgorithm(name, pSvcLocator), m_monitoringTool("") { declareProperty("GenericMonitoringTool", m_monitoringTool, "Generic monitored variables tool"); } diff --git a/Control/AthenaMonitoring/src/HistogramDef.cxx b/Control/AthenaMonitoring/src/HistogramDef.cxx index 16b5eeaf6905d35a7fbdd4b013f26dd74cb0db91..73d1add958ba8b47f94d5fdd5fb5880c431c9663 100644 --- a/Control/AthenaMonitoring/src/HistogramDef.cxx +++ b/Control/AthenaMonitoring/src/HistogramDef.cxx @@ -6,11 +6,10 @@ #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> -//#include "AthenaBaseComps/AthMsgStreamMacros.h" - #include "AthenaMonitoring/HistogramDef.h" using namespace std; +using namespace Monitored; const HistogramDef HistogramDef::parse(const std::string& jobOpts) { /* Parse histogram defintion @@ -18,13 +17,12 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { 1D: "EXPERT, TH1I, Name, Title;Alias, nBins, xmin, xmax, BinLabel1:BinLabel2:BinLabel3, kCumulative" */ -// ATH_MSG_DEBUG("parseJobOptHistogram(\"" << jobOpts << "\")"); - // convert histogram definition string to an array of strings list<string> histProperty; typedef boost::tokenizer<boost::char_separator<char> > tokenizer_t; boost::char_separator<char> sep(","); tokenizer_t tokens(jobOpts, sep); + for (tokenizer_t::iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { string word = *itr; boost::trim(word); @@ -44,7 +42,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { else histPar.path = "EXPERT"; -// const char* warning = " NOT booked: "; + const char* warning = " NOT booked: "; histPar.ok = false; histPar.ycut = false; histPar.zcut = false; @@ -88,8 +86,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.alias << warning << "NOT enough parameters for defining 1-D histogram"); - return histPar; + throw HistogramDefParseException(histPar.alias + warning + "NOT enough parameters for defining 1-D histogram"); } try { @@ -97,13 +94,13 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.alias << warning << "int expected for xbins while got" << histProperty); - return histPar; + stringstream ss; + copy(histProperty.begin(), histProperty.end(), ostream_iterator<string>(ss, ",")); + throw HistogramDefParseException(histPar.alias + warning + "int expected for xbins while got" + ss.str()); } if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "xmin and xmax expected"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "xmin and xmax expected"); } try { @@ -111,8 +108,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for xmin"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for xmin"); } try { @@ -120,14 +116,12 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for xmax"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for xmax"); } if (histPar.type.find("TH2") == 0) { if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "y-axis definition expected for TH2"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "y-axis definition expected for TH2"); } try { @@ -135,13 +129,11 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "int expected for ybins"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "int expected for ybins"); } if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "ymin and ymax expected"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "ymin and ymax expected"); } try { @@ -149,8 +141,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymin"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymin"); } try { @@ -158,8 +149,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymax"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymax"); } } //-end of TH2 //TProfile @@ -170,8 +160,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymin of TProfile"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymin of TProfile"); } try { @@ -179,8 +168,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymax of TProfile"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymax of TProfile"); } histPar.ybins = 0; // not used histPar.ycut = true; @@ -189,8 +177,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { else if (histPar.type == "TProfile2D"){ if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "y-axis definition expected for TProfile2D"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "y-axis definition expected for TProfile2D"); } try { @@ -198,13 +185,11 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "int expected for ybins"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "int expected for ybins"); } if (histProperty.size() < 2) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "ymin and ymax expected"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "ymin and ymax expected"); } try { @@ -212,8 +197,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymin"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymin"); } try { @@ -221,8 +205,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for ymax"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for ymax"); } //For limited z range if(histProperty.size() >= 2){ @@ -231,8 +214,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for zmin of TProfile2D"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for zmin of TProfile2D"); } try { @@ -240,8 +222,7 @@ const HistogramDef HistogramDef::parse(const std::string& jobOpts) { itr = histProperty.erase(itr); } catch (boost::bad_lexical_cast&) { -// ATH_MSG_WARNING(histPar.name[0] << warning << "double expected for zmax of TProfile2D"); - return histPar; + throw HistogramDefParseException(histPar.name[0] + warning + "double expected for zmax of TProfile2D"); } histPar.zcut = true; diff --git a/Control/AthenaMonitoring/src/HistogramFiller.cxx b/Control/AthenaMonitoring/src/HistogramFiller.cxx index 43b10793d61590adb792673ea39a33a8515b3352..d5066a6d2e4fe23be3c854f07c05e49b9e3345a6 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller.cxx +++ b/Control/AthenaMonitoring/src/HistogramFiller.cxx @@ -5,6 +5,7 @@ #include "AthenaMonitoring/HistogramFiller.h" using namespace std; +using namespace Monitored; HistogramFillerFactory::HistogramFillerFactory(ServiceHandle<ITHistSvc> histSvc, std::string groupName) : m_histSvc(histSvc), m_groupName(std::move(groupName)), m_histogramCategory({ @@ -119,7 +120,6 @@ HBASE* HistogramFillerFactory::create(const HistogramDef& def, Types&&... hargs) HBASE* histo = m_histogramCategory[def.path]->template getHist<HBASE>(def.alias); if (histo) { -// ATH_MSG_DEBUG("Histogram " << def.alias << " already exists. Re-using it."); return histo; } @@ -177,13 +177,11 @@ void HistogramFillerFactory::setLabels(TH1* hist, const vector<string>& labels) for ( int i = 0; i < std::min( (int)labels.size(), (int)hist->GetNbinsX() ); ++i ) { int bin = i+1; hist->GetXaxis()->SetBinLabel(bin, labels[i].c_str()); -// ATH_MSG_DEBUG("setting label X" << labels[i] << " for bin " << bin); } for ( int i = (int)hist->GetNbinsX(); i < std::min( (int)labels.size(), (int)hist->GetNbinsX()+(int)hist->GetNbinsY() ); ++i ) { int bin = i+1-(int)hist->GetNbinsX(); hist->GetYaxis()->SetBinLabel(bin, labels[i].c_str()); -// ATH_MSG_DEBUG("setting label Y" << labels[i] << " for bin " << bin); } }