ATLAS Offline Software
Loading...
Searching...
No Matches
CalibrationNtupleMakerTool Class Reference

#include <CalibrationNtupleMakerTool.h>

Inheritance diagram for CalibrationNtupleMakerTool:
Collaboration diagram for CalibrationNtupleMakerTool:

Public Member Functions

 CalibrationNtupleMakerTool (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
virtual ~CalibrationNtupleMakerTool ()
 Default Destructor.
StatusCode initialize ()
 standard Athena-Algorithm method
StatusCode execute ()
 standard Athena-Algorithm method
StatusCode finalize ()
 standard Athena-Algorithm method
virtual StatusCode bookTree ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<class T>
const T * getContainer (const std::string &containerName)
int Matched (const xAOD::Jet *truth, const xAOD::JetContainer *jets, std::vector< const xAOD::Jet * > &matched, int &index) const
float DetectorEta (const xAOD::Jet *jet)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static double DRmin (const xAOD::Jet *myjet, const xAOD::JetContainer *jets, double PtMin)

Private Attributes

std::vector< std::string > m_collectionNames
std::map< std::string, TTree * > m_trees
std::string m_treeFolder
std::string m_treeDescription
std::string m_truthJetContainerName
std::string m_vertexContainerName
double m_recoIsoDR
double m_recoIsoPtCut
double m_trueIsoDR
double m_trueIsoPtCut
double m_matchingCut
TH1 * m_h_events
float m_eventWeight = 0.0F
float m_mu = 0.0F
float m_npv = 0.0F
std::vector< int > * m_index
std::vector< double > * m_etaCalo
std::vector< double > * m_etaDetCalo
std::vector< double > * m_phiCalo
std::vector< double > * m_eCalo
std::vector< double > * m_mCalo
std::vector< double > * m_etaCorr
std::vector< double > * m_etaDetCorr
std::vector< double > * m_phiCorr
std::vector< double > * m_eCorr
std::vector< double > * m_mCorr
std::vector< double > * m_etaTrue
std::vector< double > * m_phiTrue
std::vector< double > * m_eTrue
std::vector< double > * m_mTrue
SG::ReadHandleKey< xAOD::EventInfom_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 18 of file CalibrationNtupleMakerTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CalibrationNtupleMakerTool()

CalibrationNtupleMakerTool::CalibrationNtupleMakerTool ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 33 of file CalibrationNtupleMakerTool.cxx.

33 :
34 AthAlgorithm(name, pSvcLocator),
35 m_treeFolder("/calibration/"),
36 m_treeDescription("Calibration Ntuple"),
37 m_truthJetContainerName("MyAntiKt10TruthJets"),
38 m_vertexContainerName("PrimaryVertices"),
39 m_recoIsoDR(1.5),
40 m_recoIsoPtCut(100.*GeV),
41 m_trueIsoDR(2.5),
42 m_trueIsoPtCut(100.*GeV),
43 m_matchingCut(0.6),
44 m_h_events(nullptr),
45 m_index(nullptr),
46 m_etaCalo(nullptr),
47 m_etaDetCalo(nullptr),
48 m_phiCalo(nullptr),
49 m_eCalo(nullptr),
50 m_mCalo(nullptr),
51 m_etaCorr(nullptr),
52 m_etaDetCorr(nullptr),
53 m_phiCorr(nullptr),
54 m_eCorr(nullptr),
55 m_mCorr(nullptr),
56 m_etaTrue(nullptr),
57 m_phiTrue(nullptr),
58 m_eTrue(nullptr),
59 m_mTrue(nullptr)
60 {
61 declareProperty("FolderName" , m_treeFolder);
62 declareProperty("Description", m_treeDescription);
63
64 // the jets collections to calibrate
65 declareProperty("JetCollections" , m_collectionNames);
66 declareProperty("TruthJetContainerName", m_truthJetContainerName);
67 declareProperty("VertexContainerName" , m_vertexContainerName);
68
69 declareProperty("RecoIsolationDR" , m_recoIsoDR);
70 declareProperty("RecoIsolationPtCut" , m_recoIsoPtCut);
71 declareProperty("TruthIsolationDR" , m_trueIsoDR);
72 declareProperty("TruthIsolationPtCut", m_trueIsoPtCut);
73 declareProperty("MatchingCut" , m_matchingCut);
74 }
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< std::string > m_collectionNames

◆ ~CalibrationNtupleMakerTool()

CalibrationNtupleMakerTool::~CalibrationNtupleMakerTool ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ bookTree()

StatusCode CalibrationNtupleMakerTool::bookTree ( )
virtual

Definition at line 93 of file CalibrationNtupleMakerTool.cxx.

94{
95 ATH_MSG_INFO( "bookTree()" );
96
97
98 for (auto& name : m_collectionNames) {
99
100 // creating the tree for thw jet collection
101 TTree * tree = new TTree (name.c_str(), m_treeDescription.c_str());
102
103 // add the branches
104 tree->Branch("EventWeight" , &m_eventWeight );
105
106 tree->Branch("eta_calo" , &m_etaCalo );
107 tree->Branch("eta_det_calo" , &m_etaDetCalo );
108 tree->Branch("phi_calo" , &m_phiCalo );
109 tree->Branch("E_calo" , &m_eCalo );
110 tree->Branch("m_calo" , &m_mCalo );
111
112 tree->Branch("eta_corr1" , &m_etaCorr );
113 tree->Branch("eta_det_corr1" , &m_etaDetCorr );
114 tree->Branch("phi_corr1" , &m_phiCorr );
115 tree->Branch("E_corr1" , &m_eCorr );
116 tree->Branch("m_corr1" , &m_mCorr );
117
118 tree->Branch("eta_true" , &m_etaTrue );
119 tree->Branch("phi_true" , &m_phiTrue );
120 tree->Branch("E_true" , &m_eTrue );
121 tree->Branch("m_true" , &m_mTrue );
122
123 tree->Branch("index" , &m_index );
124 tree->Branch("mu" , &m_mu );
125 tree->Branch("NPV" , &m_npv );
126
127
128 m_trees.insert(std::pair<std::string, TTree*>(name, tree));
129
130 }
131
132 // now register the Tree
133 SmartIF<ITHistSvc> tHistSvc{service("THistSvc")};
134 ATH_CHECK( tHistSvc.isValid() );
135
136 if (tHistSvc) {
137 for (const auto& name : m_collectionNames) {
138 if((tHistSvc->regTree(m_treeFolder+name, m_trees.at(name))).isFailure()) {
139 ATH_MSG_ERROR( "initialize() Could not register the validation Tree!" );
140 return StatusCode::FAILURE;
141 }
142 }
143 }
144
145 // now register the Event histogram
146 m_h_events = new TH1F("h_events","total events", 10, 0, 10);
147
148 if (tHistSvc and (tHistSvc->regHist(m_treeFolder+m_h_events->GetName(), m_h_events)).isFailure()) {
149 ATH_MSG_ERROR( "Can not register histogram" << m_h_events->GetName() );
150 return StatusCode::FAILURE;
151 }
152
153 ATH_MSG_INFO("Calibration Tree booked and registered successfully!");
154
155 return StatusCode::SUCCESS;
156
157}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
std::map< std::string, TTree * > m_trees
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
TChain * tree

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ DetectorEta()

float CalibrationNtupleMakerTool::DetectorEta ( const xAOD::Jet * jet)
private

Definition at line 299 of file CalibrationNtupleMakerTool.cxx.

299 {
300
301 xAOD::IParticle::FourMom_t corrP4(0,0,0,0);
302
303 const auto& partLinks = jet->constituentLinks();
304 for (const xAOD::IParticleLink& link : partLinks) {
305
306 if (not link.isValid()) {
307 ATH_MSG_WARNING("Got an invalid element link. Returning jet eta...");
308 return jet->eta();
309 }
310
311 const xAOD::TrackCaloCluster* tcc = dynamic_cast<const xAOD::TrackCaloCluster*>(*link);
312
313 static const SG::AuxElement::Accessor< float > acc_detEta( "DetectorEta" );
314 float det_eta = tcc->eta();
315
316 if (acc_detEta.isAvailable(*tcc)) {
317 det_eta = acc_detEta(*tcc);
318 } else
319 ATH_MSG_WARNING("DetectorEta decoration not found for TCCs! Using eta...");
320
321 double pt = tcc->p4().P()/cosh(det_eta);
322
324 p4CorrCl.SetPtEtaPhiE(pt, det_eta, tcc->p4().Phi(), tcc->p4().E());
325 if(tcc->p4().E() < 0.) p4CorrCl*=-1.;
326 corrP4 += p4CorrCl;
327 }
328
329 return corrP4.Eta();
330}
#define ATH_MSG_WARNING(x)
TLorentzVector FourMom_t
Definition of the 4-momentum type.
const std::vector< ElementLink< IParticleContainer > > & constituentLinks() const
Direct access to constituents. WARNING expert use only.
Definition Jet_v1.cxx:162
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
IParticleLink_v1 IParticleLink
Define the latest version of the IParticleLink class.
TrackCaloCluster_v1 TrackCaloCluster
Reference the current persistent version:

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ DRmin()

double CalibrationNtupleMakerTool::DRmin ( const xAOD::Jet * myjet,
const xAOD::JetContainer * jets,
double PtMin )
staticprivate

Definition at line 287 of file CalibrationNtupleMakerTool.cxx.

287 {
288
289 double DRmin=9999;
290 for (const auto jet : *jets) {
291 if (PtMin>0. and jet->pt()<PtMin) continue;
292 double Dr = myjet->p4().DeltaR(jet->p4());
293 if (Dr>0.0001 and Dr<DRmin)
294 DRmin=Dr;
295 }
296 return DRmin;
297}
static double DRmin(const xAOD::Jet *myjet, const xAOD::JetContainer *jets, double PtMin)
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition Jet_v1.cxx:71

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode CalibrationNtupleMakerTool::execute ( )

standard Athena-Algorithm method

Definition at line 159 of file CalibrationNtupleMakerTool.cxx.

160{
161 m_h_events->Fill(0);
162
163 SG::ReadHandle<xAOD::EventInfo> evt(m_evt);
164 if(!evt.isValid()) {
165 ATH_MSG_FATAL( "Unable to retrieve Event Info" );
166 }
167 float ev_weight = evt->mcEventWeight();
168
170 if (not truths) return StatusCode::FAILURE;
171
173 if (not vertices) return StatusCode::FAILURE;
174
175 // get mu
176 float mu= evt->averageInteractionsPerCrossing();
177
178 //get NPV
179 float npv = 0.;
180
181 for (const auto vertex : *vertices) {
182 if (vertex->nTrackParticles()>=2)
183 npv++;
184 }
185
186 for (auto& name : m_collectionNames) {
187 const auto *const jets = getContainer<xAOD::JetContainer>(name);
188
189 m_etaCalo ->clear();
190 m_etaDetCalo ->clear();
191 m_phiCalo ->clear();
192 m_eCalo ->clear();
193 m_mCalo ->clear();
194 m_etaCorr ->clear();
195 m_etaDetCorr ->clear();
196 m_phiCorr ->clear();
197 m_eCorr ->clear();
198 m_mCorr ->clear();
199 m_etaTrue ->clear();
200 m_phiTrue ->clear();
201 m_eTrue ->clear();
202 m_mTrue ->clear();
203 m_index ->clear();
204
205 for (const auto truth: *truths) {
206
207 // here we match to the reco
208 int index = 0;
209 std::vector<const xAOD::Jet*> matched = {};
210
211 int Nmatches = Matched(truth, jets, matched, index);
212
213 // skip truth jets that don't match any reco jets
214 if (Nmatches==0) continue;
215
216 // skip the jets that are not isolated
217 if ( m_recoIsoDR > 0 ) {
218 double DRminReco = DRmin(matched.at(0),jets,m_recoIsoPtCut);
219 if ( DRminReco < m_recoIsoDR ) continue;
220 }
221
222 if ( m_trueIsoDR > 0 ) {
223 double DRminTruth = DRmin(truth,truths,m_trueIsoPtCut);
224 if ( DRminTruth < m_trueIsoDR ) continue;
225 }
226
227 //Storing variables
228 m_etaTrue->push_back(truth->eta());
229 m_phiTrue->push_back(truth->phi());
230 m_mTrue->push_back(truth->m()/GeV);
231 m_eTrue->push_back(truth->e()/GeV);
232
233 m_etaCalo->push_back(jets->at(index)->eta());
234 m_phiCalo->push_back(jets->at(index)->phi());
235 m_mCalo->push_back(jets->at(index)->m()/GeV);
236 m_eCalo->push_back(jets->at(index)->e()/GeV);
237
238 float detectorEta = DetectorEta(jets->at(index));
239 m_etaDetCalo->push_back(detectorEta);
240
241 m_etaCorr->push_back(jets->at(index)->eta());
242 m_phiCorr->push_back(jets->at(index)->phi());
243 m_mCorr->push_back(jets->at(index)->m()/GeV);
244 m_eCorr->push_back(jets->at(index)->e()/GeV);
245 m_etaDetCorr->push_back(detectorEta);
246
247 m_index->push_back(index);
248
249 }
250
251 m_eventWeight = ev_weight;
252 m_mu = mu;
253 m_npv = npv;
254
255 m_trees.at(name)->Fill();
256
257 }
258
259 return StatusCode::SUCCESS;
260
261}
#define ATH_MSG_FATAL(x)
const T * getContainer(const std::string &containerName)
float DetectorEta(const xAOD::Jet *jet)
int Matched(const xAOD::Jet *truth, const xAOD::JetContainer *jets, std::vector< const xAOD::Jet * > &matched, int &index) const
SG::ReadHandleKey< xAOD::EventInfo > m_evt
str index
Definition DeMoScan.py:362

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode CalibrationNtupleMakerTool::finalize ( )

standard Athena-Algorithm method

Definition at line 332 of file CalibrationNtupleMakerTool.cxx.

333{
334 ATH_MSG_INFO( "finalize()" );
335
336 delete m_index;
337
338 delete m_etaCalo;
339 delete m_etaDetCalo;
340 delete m_phiCalo;
341 delete m_eCalo;
342 delete m_mCalo;
343
344 delete m_etaCorr;
345 delete m_etaDetCorr;
346 delete m_phiCorr;
347 delete m_eCorr;
348 delete m_mCorr;
349
350 delete m_etaTrue;
351 delete m_phiTrue;
352 delete m_eTrue;
353 delete m_mTrue;
354
355 return StatusCode::SUCCESS;
356
357}

◆ getContainer()

template<class T>
const T * CalibrationNtupleMakerTool::getContainer ( const std::string & containerName)
inlineprivate

Definition at line 98 of file CalibrationNtupleMakerTool.h.

98 {
99 const T * ptr = evtStore()->retrieve< const T >( containerName );
100 if (!ptr) {
101 ATH_MSG_WARNING("Container '"<<containerName<<"' could not be retrieved");
102 }
103 return ptr;
104}
unsigned long long T
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ initialize()

StatusCode CalibrationNtupleMakerTool::initialize ( )

standard Athena-Algorithm method

Definition at line 79 of file CalibrationNtupleMakerTool.cxx.

80{
81 ATH_MSG_INFO( "initialize()" );
82
83 if (bookTree().isFailure()){
84 ATH_MSG_FATAL( "Could not book the TTree object" );
85 return StatusCode::FAILURE;
86 }
87
88 ATH_CHECK( m_evt.initialize() );
89
90 return StatusCode::SUCCESS;
91}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ Matched()

int CalibrationNtupleMakerTool::Matched ( const xAOD::Jet * truth,
const xAOD::JetContainer * jets,
std::vector< const xAOD::Jet * > & matched,
int & index ) const
private

Definition at line 263 of file CalibrationNtupleMakerTool.cxx.

263 {
264
265 int Nmatches = 0;
266 double drmin = 999.;
267 int Min_index=-1;
268
269 for (unsigned int ind = 0; ind < jets->size(); ind++) {
270 double dr = truth->p4().DeltaR(jets->at(ind)->p4());
271 if (dr < m_matchingCut) ++Nmatches;
272 //find minimum:
273 if (dr < drmin) {
274 drmin = dr;
275 Min_index = ind;
276 }
277 }
278
279 if (drmin<m_matchingCut) {
280 matched.push_back(jets->at(Min_index));
281 index = Min_index;
282 }
283
284 return Nmatches;
285}

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_collectionNames

std::vector< std::string > CalibrationNtupleMakerTool::m_collectionNames
private

Definition at line 52 of file CalibrationNtupleMakerTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eCalo

std::vector< double >* CalibrationNtupleMakerTool::m_eCalo
private

Definition at line 78 of file CalibrationNtupleMakerTool.h.

◆ m_eCorr

std::vector< double >* CalibrationNtupleMakerTool::m_eCorr
private

Definition at line 84 of file CalibrationNtupleMakerTool.h.

◆ m_etaCalo

std::vector< double >* CalibrationNtupleMakerTool::m_etaCalo
private

Definition at line 75 of file CalibrationNtupleMakerTool.h.

◆ m_etaCorr

std::vector< double >* CalibrationNtupleMakerTool::m_etaCorr
private

Definition at line 81 of file CalibrationNtupleMakerTool.h.

◆ m_etaDetCalo

std::vector< double >* CalibrationNtupleMakerTool::m_etaDetCalo
private

Definition at line 76 of file CalibrationNtupleMakerTool.h.

◆ m_etaDetCorr

std::vector< double >* CalibrationNtupleMakerTool::m_etaDetCorr
private

Definition at line 82 of file CalibrationNtupleMakerTool.h.

◆ m_etaTrue

std::vector< double >* CalibrationNtupleMakerTool::m_etaTrue
private

Definition at line 87 of file CalibrationNtupleMakerTool.h.

◆ m_eTrue

std::vector< double >* CalibrationNtupleMakerTool::m_eTrue
private

Definition at line 89 of file CalibrationNtupleMakerTool.h.

◆ m_eventWeight

float CalibrationNtupleMakerTool::m_eventWeight = 0.0F
private

Definition at line 69 of file CalibrationNtupleMakerTool.h.

◆ m_evt

SG::ReadHandleKey<xAOD::EventInfo> CalibrationNtupleMakerTool::m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
private

Definition at line 93 of file CalibrationNtupleMakerTool.h.

93{this, "EvtInfo", "EventInfo", "EventInfo name"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_h_events

TH1* CalibrationNtupleMakerTool::m_h_events
private

Definition at line 67 of file CalibrationNtupleMakerTool.h.

◆ m_index

std::vector< int >* CalibrationNtupleMakerTool::m_index
private

Definition at line 73 of file CalibrationNtupleMakerTool.h.

◆ m_matchingCut

double CalibrationNtupleMakerTool::m_matchingCut
private

Definition at line 65 of file CalibrationNtupleMakerTool.h.

◆ m_mCalo

std::vector< double >* CalibrationNtupleMakerTool::m_mCalo
private

Definition at line 79 of file CalibrationNtupleMakerTool.h.

◆ m_mCorr

std::vector< double >* CalibrationNtupleMakerTool::m_mCorr
private

Definition at line 85 of file CalibrationNtupleMakerTool.h.

◆ m_mTrue

std::vector< double >* CalibrationNtupleMakerTool::m_mTrue
private

Definition at line 90 of file CalibrationNtupleMakerTool.h.

◆ m_mu

float CalibrationNtupleMakerTool::m_mu = 0.0F
private

Definition at line 70 of file CalibrationNtupleMakerTool.h.

◆ m_npv

float CalibrationNtupleMakerTool::m_npv = 0.0F
private

Definition at line 71 of file CalibrationNtupleMakerTool.h.

◆ m_phiCalo

std::vector< double >* CalibrationNtupleMakerTool::m_phiCalo
private

Definition at line 77 of file CalibrationNtupleMakerTool.h.

◆ m_phiCorr

std::vector< double >* CalibrationNtupleMakerTool::m_phiCorr
private

Definition at line 83 of file CalibrationNtupleMakerTool.h.

◆ m_phiTrue

std::vector< double >* CalibrationNtupleMakerTool::m_phiTrue
private

Definition at line 88 of file CalibrationNtupleMakerTool.h.

◆ m_recoIsoDR

double CalibrationNtupleMakerTool::m_recoIsoDR
private

Definition at line 60 of file CalibrationNtupleMakerTool.h.

◆ m_recoIsoPtCut

double CalibrationNtupleMakerTool::m_recoIsoPtCut
private

Definition at line 61 of file CalibrationNtupleMakerTool.h.

◆ m_treeDescription

std::string CalibrationNtupleMakerTool::m_treeDescription
private

Definition at line 55 of file CalibrationNtupleMakerTool.h.

◆ m_treeFolder

std::string CalibrationNtupleMakerTool::m_treeFolder
private

Definition at line 54 of file CalibrationNtupleMakerTool.h.

◆ m_trees

std::map< std::string, TTree* > CalibrationNtupleMakerTool::m_trees
private

Definition at line 53 of file CalibrationNtupleMakerTool.h.

◆ m_trueIsoDR

double CalibrationNtupleMakerTool::m_trueIsoDR
private

Definition at line 62 of file CalibrationNtupleMakerTool.h.

◆ m_trueIsoPtCut

double CalibrationNtupleMakerTool::m_trueIsoPtCut
private

Definition at line 63 of file CalibrationNtupleMakerTool.h.

◆ m_truthJetContainerName

std::string CalibrationNtupleMakerTool::m_truthJetContainerName
private

Definition at line 57 of file CalibrationNtupleMakerTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexContainerName

std::string CalibrationNtupleMakerTool::m_vertexContainerName
private

Definition at line 58 of file CalibrationNtupleMakerTool.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: