ATLAS Offline Software
HistoGroupBase.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef JETMONITORING_HISTOGROUPBASE_H
8 #define JETMONITORING_HISTOGROUPBASE_H
9 
18 #include <vector>
19 #include <string>
20 #include "AsgTools/AsgTool.h"
21 
22 class TH1;
23 
24 // temporary, we should define a proper interface
25 static const InterfaceID IID_HistoGroupBase("HistoGroupBase", 1, 0);
26 
27 class HistoGroupBase : public asg::AsgTool {
28 
30 
31  public:
32 
33  //--------------------------------------------
35  // (TO DO : typedef to ManagedMonitorToolBase::Interval_t
36  // when compiled in Athena, redefine when compiling standalone ? )
40 
41  useToolInterval // used to use the value from the tool's m_interval property
42  };
43 
44 
46  struct HistData {
48  std::string path;
50  };
51 
52  HistoGroupBase(const std::string & t);
54 
55  virtual StatusCode initialize() ;
56 
57  virtual int buildHistos();
58 
59  virtual int fillHistos();
60 
61  virtual int finalizeHistos();
62 
63 
65  virtual void prefixHistoDir(const std::string & preDir);
66 
68  template<class T>
69  T* bookHisto(T* h, Interval_t ityp= useToolInterval) { renameAndRegister(h,"",ityp); return h;}
70 
72  template<class T>
73  T* bookHistoInSubDir(const std::string& subD, T* h, Interval_t ityp= useToolInterval) { renameAndRegister(h, subD,ityp); return h;}
74 
76  const std::vector<HistData> & bookedHistograms();
77 
78 
79  virtual void setInterval(Interval_t ityp, bool force = false){ if(force || (m_interval==-1) ) m_interval = ityp;}
80 
81  static const InterfaceID& interfaceID( ){return IID_HistoGroupBase;}
82 
83 protected:
84 
86  virtual void renameAndRegister(TH1* h, const std::string & subD="", Interval_t ityp= useToolInterval);
87 
88 
90  std::vector<HistData> m_vBookedHistograms;
91 
93  std::string m_histoDir;
94 
97 
100 
102 
103 };
104 #endif
HistoGroupBase::finalizeHistos
virtual int finalizeHistos()
Definition: HistoGroupBase.cxx:37
HistoGroupBase::buildHistos
virtual int buildHistos()
Definition: HistoGroupBase.cxx:29
HistoGroupBase::m_prefixedHistoName
bool m_prefixedHistoName
true if the histo name should contain the full hierarchy path
Definition: HistoGroupBase.h:99
HistoGroupBase::setInterval
virtual void setInterval(Interval_t ityp, bool force=false)
Definition: HistoGroupBase.h:79
HistoGroupBase::all
@ all
Definition: HistoGroupBase.h:39
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
calibdata.force
bool force
Definition: calibdata.py:19
HistoGroupBase
Definition: HistoGroupBase.h:27
HistoGroupBase::file
@ file
Definition: HistoGroupBase.h:37
HistoGroupBase::fill
@ fill
Definition: HistoGroupBase.h:39
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
HistoGroupBase::HistData::hist
TH1 * hist
Definition: HistoGroupBase.h:47
HistoGroupBase::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: HistoGroupBase.cxx:24
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HistoGroupBase::m_interval
int m_interval
Definition: HistoGroupBase.h:101
HistoGroupBase::medStat
@ medStat
Definition: HistoGroupBase.h:38
HistoGroupBase::HistData::interval
Interval_t interval
Definition: HistoGroupBase.h:49
HistoGroupBase::useToolInterval
@ useToolInterval
Definition: HistoGroupBase.h:41
HistoGroupBase::~HistoGroupBase
~HistoGroupBase()
Definition: HistoGroupBase.h:53
HistoGroupBase::run
@ run
Definition: HistoGroupBase.h:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HistoGroupBase::m_monIntervalType
int m_monIntervalType
when used in Athena monitoring context, the histos of this group will have this type of interval
Definition: HistoGroupBase.h:96
extractSporadic.h
list h
Definition: extractSporadic.py:97
HistoGroupBase::HistData
Simply a histo and its path in the hiearchy.
Definition: HistoGroupBase.h:46
HistoGroupBase::prefixHistoDir
virtual void prefixHistoDir(const std::string &preDir)
allows a higher level tool to put the histos in this group as a sub-dir of 'preDir'
Definition: HistoGroupBase.cxx:41
HistoGroupBase::lumiBlock
@ lumiBlock
Definition: HistoGroupBase.h:37
HistoGroupBase::HistData::path
std::string path
Definition: HistoGroupBase.h:48
HistoGroupBase::m_histoDir
std::string m_histoDir
The path where histos in this group leave.
Definition: HistoGroupBase.h:93
HistoGroupBase::interfaceID
static const InterfaceID & interfaceID()
Definition: HistoGroupBase.h:81
HistoGroupBase::lowStat
@ lowStat
Definition: HistoGroupBase.h:38
HistoGroupBase::Interval_t
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
Definition: HistoGroupBase.h:37
h
HistoGroupBase::eventsBlock
@ eventsBlock
Definition: HistoGroupBase.h:37
TH1
Definition: rootspy.cxx:268
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
HistoGroupBase::bookedHistograms
const std::vector< HistData > & bookedHistograms()
return all the histos in this group
Definition: HistoGroupBase.cxx:45
HistoGroupBase::bookHistoInSubDir
T * bookHistoInSubDir(const std::string &subD, T *h, Interval_t ityp=useToolInterval)
Same as bookHistom but put the histo under subdirectory subD.
Definition: HistoGroupBase.h:73
HistoGroupBase::bookHisto
T * bookHisto(T *h, Interval_t ityp=useToolInterval)
register the histo h in this group (if h!=NULL). The histo name is changed if m_prefixedHistoName==tr...
Definition: HistoGroupBase.h:69
HistoGroupBase::HistoGroupBase
HistoGroupBase(const std::string &t)
Definition: HistoGroupBase.cxx:10
HistoGroupBase::renameAndRegister
virtual void renameAndRegister(TH1 *h, const std::string &subD="", Interval_t ityp=useToolInterval)
Rename an histo according to the tool's path.
Definition: HistoGroupBase.cxx:50
AsgTool.h
HistoGroupBase::fillHistos
virtual int fillHistos()
Definition: HistoGroupBase.cxx:33
HistoGroupBase::m_vBookedHistograms
std::vector< HistData > m_vBookedHistograms
The list of histos in this group.
Definition: HistoGroupBase.h:90
HistoGroupBase::higStat
@ higStat
Definition: HistoGroupBase.h:38
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35