ATLAS Offline Software
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"
6 #include "xAODJet/JetContainer.h"
7 
9  const std::string& name,
10  const IInterface* parent ):
12  , m_htools(this)
13  // , m_interval(HistoGroupBase::all)
14  , m_interval(HistoGroupBase::lumiBlock)
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_INFO ("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 }
ManagedMonitorToolBase::Interval_t
Interval_t
An enumeration describing how detailed a particular monitoring object is.
Definition: ManagedMonitorToolBase.h:113
JetMonitoringTool::m_interval
int m_interval
Default monitoring interval for all children tools.
Definition: JetMonitoringTool.h:60
JetMonitoringTool::~JetMonitoringTool
virtual ~JetMonitoringTool()
Destructor:
JetMonitoringTool.h
HistoGroupBase
Definition: HistoGroupBase.h:27
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:73
JetMonitoringTool::fillHistograms
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: JetMonitoringTool.cxx:68
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetMonitoringTool::m_htools
ToolHandleArray< JetContainerHistoFiller > m_htools
Definition: JetMonitoringTool.h:54
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:617
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
JetMonitoringTool::m_histoDir
std::string m_histoDir
Directory under which all histos filled by this tool will live.
Definition: JetMonitoringTool.h:57
JetMonitoringTool::JetMonitoringTool
JetMonitoringTool()
Default constructor:
HistoGroupBase::Interval_t
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
Definition: HistoGroupBase.h:37
JetContainer.h
JetMonitoringTool::initialize
virtual StatusCode initialize()
Definition: JetMonitoringTool.cxx:29
JetMonitoringTool::procHistograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: JetMonitoringTool.cxx:81
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
JetMonitoringTool::bookHistograms
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
Definition: JetMonitoringTool.cxx:44
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
ManagedMonitorToolBase::regHist
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 ...
Definition: ManagedMonitorToolBase.cxx:1346