ATLAS Offline Software
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() );
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 
104 void JetContainerHistoFiller::prefixHistoDir(const std::string & preDir){
105  for( auto jtool : m_histoTools){
106  jtool->prefixHistoDir(preDir+m_histoDir);
107  }
108 }
JetContainerHistoFiller::fillHistos
virtual int fillHistos()
Definition: JetContainerHistoFiller.cxx:33
calibdata.force
bool force
Definition: calibdata.py:19
HistoGroupBase
Definition: HistoGroupBase.h:27
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetContainerHistoFiller::JetContainerHistoFiller
JetContainerHistoFiller(const std::string &t)
Definition: JetContainerHistoFiller.cxx:7
xAOD::EventInfo_v1::LAr
@ LAr
The LAr calorimeter.
Definition: EventInfo_v1.h:335
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
JetContainerHistoFiller::buildHistos
virtual int buildHistos()
Definition: JetContainerHistoFiller.cxx:76
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
JetContainerHistoFiller.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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
JetContainerHistoFiller::prefixHistoDir
virtual void prefixHistoDir(const std::string &preDir)
redefine from base class to forward prefix path to sub histos
Definition: JetContainerHistoFiller.cxx:104
JetContainerHistoFiller::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetContainerHistoFiller.cxx:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
JetContainerHistoFiller::m_histoTools
ToolHandleArray< JetHistoBase > m_histoTools
The list of histogramming tools.
Definition: JetContainerHistoFiller.h:59
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
HistoGroupBase::m_histoDir
std::string m_histoDir
The path where histos in this group leave.
Definition: HistoGroupBase.h:93
JetContainerHistoFiller::m_EventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Definition: JetContainerHistoFiller.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JetContainerHistoFiller::finalizeHistos
virtual int finalizeHistos()
Definition: JetContainerHistoFiller.cxx:96
HistoGroupBase::Interval_t
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
Definition: HistoGroupBase.h:37
JetContainerHistoFiller::setInterval
virtual void setInterval(Interval_t ityp, bool force=false)
Definition: JetContainerHistoFiller.cxx:68
JetContainerHistoFiller::m_jetContainerName
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerName
the jet container to build histos from
Definition: JetContainerHistoFiller.h:61
HistoGroupBase::m_vBookedHistograms
std::vector< HistData > m_vBookedHistograms
The list of histos in this group.
Definition: HistoGroupBase.h:90