Belle II Software  release-06-00-14
DQMHistAnalysis.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 //+
9 // File : DQMHistAnalysis.h
10 // Description : Histogram analysis module for DQM
11 //-
12 
13 #pragma once
14 
15 #include <framework/core/Module.h>
16 #include <dqm/dataobjects/MonitoringObject.h>
17 #include <TH1.h>
18 
19 #include <string>
20 #include <map>
21 
22 namespace Belle2 {
31  class DQMHistAnalysisModule : public Module {
32 
33  public:
37  enum EParamType {
50  };
54  typedef std::map<std::string, EParamType> ParamTypeList;
58  typedef std::map<std::string, int> IntValueList;
62  typedef std::map<std::string, float> FloatValueList;
66  typedef std::map<std::string, std::string> TextList;
70  typedef std::map<std::string, TH1*> HistList;
74  typedef std::map<std::string, MonitoringObject*> MonObjList;
75 
76 
77 
78  private:
94  static TextList g_text;
98  static HistList g_hist;
103 
104 
105  public:
110  static const HistList& getHistList();
115  static const MonObjList& getMonObjList();
116 
122  TCanvas* find_canvas(TString cname);
123 
129  static TH1* findHist(const std::string& histname);
136  static TH1* findHist(const std::string& dirname,
137  const std::string& histname);
144  static TH1* findHist(const TDirectory* histdir, const TString& histname);
150  static MonitoringObject* findMonitoringObject(const std::string& objName);
156  static void setIntValue(const std::string& parname, int vint);
157 
163  static void setFloatValue(const std::string& parname, float vfloat);
169  static void setText(const std::string& parname, const std::string& text);
170 
171  public:
178  static void addHist(const std::string& dirname,
179  const std::string& histname, TH1* h);
180 
185  static MonitoringObject* getMonitoringObject(const std::string& histname);
186 
190  static void resetHist() { g_hist = std::map<std::string, TH1*>(); }
195  static HistList& getHists() { return g_hist; }
200  static ParamTypeList& getParNames() { return g_parname; }
205  static IntValueList& getIntValues() { return g_vint; }
210  static FloatValueList& getFloatValues() { return g_vfloat; }
215  static TextList& getTexts() { return g_text; }
216 
217  // Public functions
218  public:
219 
222  virtual ~DQMHistAnalysisModule();
223 
224  // Data members
225  private:
226 
227  };
229 } // end namespace Belle2
230 
The base class for the histogram analysis module.
static void setText(const std::string &parname, const std::string &text)
Set the string value of the parameter.
static const HistList & getHistList()
Get the list of the histograms.
TCanvas * find_canvas(TString cname)
Find canvas by name.
static IntValueList & getIntValues()
Get the list of integer parameters.
static void setIntValue(const std::string &parname, int vint)
Set the integer value of the parameter.
std::map< std::string, int > IntValueList
The type of list of integer module parameter.
static MonitoringObject * findMonitoringObject(const std::string &objName)
Find MonitoringObject.
static HistList & getHists()
Get the list of histograms.
static void addHist(const std::string &dirname, const std::string &histname, TH1 *h)
Add histogram.
static void resetHist()
Clear and reset the list of histograms.
std::map< std::string, float > FloatValueList
The type of list of float module parameter.
static ParamTypeList g_parname
The list of module parameter types.
static HistList g_hist
The list of histograms.
static TH1 * findHist(const std::string &histname)
Find histogram.
std::map< std::string, EParamType > ParamTypeList
The type of list of module parameter types.
std::map< std::string, MonitoringObject * > MonObjList
The type of list of MonitoringObjects.
DQMHistAnalysisModule()
Constructor / Destructor.
static FloatValueList & getFloatValues()
Get the list of float parameters.
static ParamTypeList & getParNames()
Get the list of the names and types of the parameters.
static const MonObjList & getMonObjList()
Get the list of MonitoringObjects.
static TextList g_text
The list of string module parameter.
static IntValueList g_vint
The list of integer module parameter.
static TextList & getTexts()
Get the list of string parameters.
static MonObjList g_monObj
The list of MonitoringObjects.
static void setFloatValue(const std::string &parname, float vfloat)
Set the float value of the parameter.
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
static FloatValueList g_vfloat
The list of float module parameter.
std::map< std::string, std::string > TextList
The type of list of string module parameter.
std::map< std::string, TH1 * > HistList
The type of list of histograms.
EParamType
The enumeration types for the module parameters.
@ c_ParamTEXT
The string type for module parameter.
@ c_ParamINT
The integer type for module parameter.
@ c_ParamFLOAT
The float type for module parameter.
Base class for Modules.
Definition: Module.h:72
MonitoringObject is a basic object to hold data for the run-dependency monitoring Run summary TCanvas...
Abstract base class for different kinds of events.