ATLAS Offline Software
Loading...
Searching...
No Matches
JetMonitoringTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "JetMonitoringTool.h"
7
9 const std::string& name,
10 const IInterface* parent ):
11 ManagedMonitorToolBase( type, name, parent )
12 , m_htools(this)
13 // , m_interval(HistoGroupBase::all)
15{
16
17 declareProperty( "HistoTools", m_htools );
18 declareProperty( "HistoDir", m_histoDir="Jets/" );
19 declareProperty( "IntervalType", m_interval);
20}
21
22// Destructor
25= default;
26
27// Athena algtool's Hooks
30{
31 // ATH_MSG_INFO ("Initializing " << name() << "...");
33 CHECK( m_htools.retrieve() );
34
35 // All subtools in JetMonitoringTool must act on the same container.
36 // Force it so the histo naming done by the subtool is correct.
37 std::string prefix = m_histoDir;
38 for( auto jtool : m_htools){
39 jtool->prefixHistoDir( prefix );
40 }
41 return StatusCode::SUCCESS;
42}
43
45{
46 /* ATH_MSG_INFO ("Booking hists " << name() << "...");
47 ATH_MSG_INFO (" Tools size = " << m_htools.size() << "...");*/
48
49 // loop over tools : for each tool, register its histos
50 for( auto jtool : m_htools){
51 ATH_MSG_DEBUG(" Building histos for tool "<< jtool->name() );
52 jtool->setInterval((HistoGroupBase::Interval_t) m_interval );
53 if( jtool->buildHistos() != 0 ) continue;
54
55 // retrieve histos and their paths
56 const auto & hdata = jtool->bookedHistograms();
57 // loop over histos
58 for( const auto& hd : hdata){
59 ATH_MSG_DEBUG ("Initializing " << hd.hist << " name= "<< hd.hist->GetName() << " path=" << hd.path << "..." << hd.interval << " dir="<<hd.hist->GetDirectory());
60 ATH_CHECK(regHist(hd.hist,hd.path, (Interval_t) hd.interval));
61 ATH_MSG_DEBUG (" -->> "<< hd.hist->GetName() << " dir="<<hd.hist->GetDirectory() << " "<< hd.hist->kCanDelete );
62 } // loop over histos
63 } // loop over tools
64
65 return StatusCode::SUCCESS;
66}
67
69{
70 ATH_MSG_DEBUG ("Filling hists " << name() << "...");
71
73 int count = 0;
74 for( auto jtool : m_htools){
75 count += jtool->fillHistos();
76 }
77
78 return count==0 ? StatusCode::SUCCESS : StatusCode::FAILURE ;
79}
80
82{
83 // ATH_MSG_INFO ("Finalising hists " << name() << "...");
84 // m_oMuonValidationPlots.finalize();
85 return StatusCode::SUCCESS;
86}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
A base class for dual-use tools managing and filling a list of histograms.
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
virtual StatusCode initialize()
int m_interval
Default monitoring interval for all children tools.
virtual ~JetMonitoringTool()
Destructor:
std::string m_histoDir
Directory under which all histos filled by this tool will live.
JetMonitoringTool()
Default constructor:
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
ToolHandleArray< JetContainerHistoFiller > m_htools
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Interval_t
An enumeration describing how detailed a particular monitoring object is.
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146