ATLAS Offline Software
Loading...
Searching...
No Matches
JetContainerHistoFiller.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8 , m_histoTools(this)
9{
10 declareInterface<JetContainerHistoFiller>(this);
11 declareProperty("HistoTools", m_histoTools);
12
13}
14
16
17 CHECK( m_histoTools.retrieve() );
18
19 if(m_jetContainerName.empty()) {
20 ATH_MSG_ERROR("Jet Container name not set. Please set the JetContainer property");
21 return StatusCode::FAILURE;
22 }
23 CHECK( m_jetContainerName.initialize() );
24 CHECK( m_EventInfoKey.initialize() );
25
26 if(m_histoDir.empty()) m_histoDir = m_jetContainerName.key()+"/";
27
28 return StatusCode::SUCCESS;
29}
30
31
32
34
35 ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName.key());
36
38 if (!evtInfo.isValid()) {
39 ATH_MSG_DEBUG("Unable to retrieve xAOD::EventInfo");
40 return 1;
41 }
42
43 //LAr event veto: skip events rejected by LAr
44 if(evtInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error){
45 ATH_MSG_DEBUG("SKIP for LAR error");
46 return 1;
47 }
48
50 if( !jCont.isValid() ) {
51 ATH_MSG_DEBUG (" No container " << m_jetContainerName.key()<< " in Evt store. Returning.");
52 return 0;
53 }
54
55 float weight = evtInfo->beamSpotWeight();
56
58 int count = 0;
59 for( auto jtool : m_histoTools){
60 ATH_MSG_DEBUG ("Filling hists " << jtool->name() << "..." << jCont);
61
62 count += jtool->fillHistosFromContainer(*jCont, weight);
63 }
64
65 return count;
66}
67
69 // propagate interval to sub-tools
70 for( auto jtool : m_histoTools){
71 jtool->setInterval(ityp,force);
72 }
73}
74
75
77 int count=0;
78
79 ATH_MSG_DEBUG ("Building hists " );
80
81 // ask subtools to build their histos
82 for( auto jtool : m_histoTools){
83 count+=jtool->buildHistos();
84 ATH_MSG_DEBUG (" *** Built hist : "<<jtool->name() );
85
86 // keep a pointer to histos :
87 const auto & hdata = jtool->bookedHistograms();
88 for( const auto & hd : hdata ){
89 m_vBookedHistograms.push_back(hd);
90 }
91 }
92 return count;
93}
94
95
97 int count = 0;
98 for( auto jtool : m_histoTools){
99 count+=jtool->finalizeHistos();
100 }
101 return count;
102}
103
104void JetContainerHistoFiller::prefixHistoDir(const std::string & preDir){
105 for( auto jtool : m_histoTools){
106 jtool->prefixHistoDir(preDir+m_histoDir);
107 }
108}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_histoDir
The path where histos in this group leave.
std::vector< HistData > m_vBookedHistograms
The list of histos in this group.
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
HistoGroupBase(const std::string &t)
ToolHandleArray< JetHistoBase > m_histoTools
The list of histogramming tools.
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
JetContainerHistoFiller(const std::string &t)
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerName
the jet container to build histos from
virtual void prefixHistoDir(const std::string &preDir)
redefine from base class to forward prefix path to sub histos
virtual void setInterval(Interval_t ityp, bool force=false)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146