ATLAS Offline Software
Loading...
Searching...
No Matches
ORUtils::FEAssociationTool Class Reference

#include <FEAssociationTool.h>

Inheritance diagram for ORUtils::FEAssociationTool:

Classes

struct  ObjView
struct  PairKey
struct  PairKeyHash
struct  SharedAcc

Public Member Functions

 FEAssociationTool (const std::string &name)
virtual ~FEAssociationTool () override=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode buildAssociations (const EventContext &ctx) const override
virtual void print () const
 Print the state of the tool.
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 sysInitialize () override
 Perform system initialization for an algorithm.
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
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

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

virtual StatusCode collectObjects (const EventContext &ctx, std::vector< ObjView > &objects) const
void collectFEsFromIndex (const EventContext &ctx, const ObjView::Type type, const xAOD::IParticleContainer *cont, std::size_t idx, ObjView &view) const
virtual StatusCode buildMapFromPairs (const EventContext &ctx, const std::vector< ObjView > &objects) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::ElectronContainerm_elKey
SG::ReadHandleKey< xAOD::MuonContainerm_muKey
SG::ReadHandleKey< xAOD::PhotonContainerm_phKey
SG::ReadHandleKey< xAOD::TauJetContainerm_tauKey
SG::ReadHandleKey< xAOD::JetContainerm_srjKey
SG::ReadHandleKey< xAOD::JetContainerm_lrjKey
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_elChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::ElectronContainerm_elNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::MuonContainerm_muChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::MuonContainerm_muNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_phChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::PhotonContainerm_phNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::TauJetContainerm_tauChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::TauJetContainerm_tauNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_srjChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_srjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_lrjChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainerm_lrjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::FlowElementContainerm_originalObjectLinkKey
SG::WriteHandleKey< xAOD::MissingETAssociationMapm_outputMapKey
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 38 of file FEAssociationTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FEAssociationTool()

ORUtils::FEAssociationTool::FEAssociationTool ( const std::string & name)

Definition at line 90 of file FEAssociationTool.cxx.

91 : asg::AsgTool(name)
92{}

◆ ~FEAssociationTool()

virtual ORUtils::FEAssociationTool::~FEAssociationTool ( )
overridevirtualdefault

Member Function Documentation

◆ buildAssociations()

StatusCode ORUtils::FEAssociationTool::buildAssociations ( const EventContext & ctx) const
overridevirtual

Implements ORUtils::IFEAssociationTool.

Definition at line 136 of file FEAssociationTool.cxx.

140{
141 ANA_CHECK_SET_TYPE(StatusCode);
142
143 std::vector<ObjView> objects;
144#ifndef XAOD_STANDALONE
145 ANA_CHECK(collectObjects(ctx, objects));
146#else
147 ANA_CHECK(collectObjects(objects));
148#endif
149
150 ANA_MSG_DEBUG("Collected " << objects.size() << " objects");
151
152#ifndef XAOD_STANDALONE
153 ANA_CHECK(buildMapFromPairs(ctx, objects));
154#else
156#endif
157
158 return StatusCode::SUCCESS;
159}
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
virtual StatusCode collectObjects(const EventContext &ctx, std::vector< ObjView > &objects) const
virtual StatusCode buildMapFromPairs(const EventContext &ctx, const std::vector< ObjView > &objects) const

◆ buildMapFromPairs()

StatusCode ORUtils::FEAssociationTool::buildMapFromPairs ( const EventContext & ctx,
const std::vector< ObjView > & objects ) const
privatevirtual

Definition at line 468 of file FEAssociationTool.cxx.

473{
474 std::unordered_map<PairKey, SharedAcc, PairKeyHash> shared;
475 shared.reserve(objects.size() * 2);
476
477 for (std::size_t i = 0; i < objects.size(); ++i)
478 {
479 const auto& A = objects[i];
480
481 for (std::size_t j = i + 1; j < objects.size(); ++j)
482 {
483 const auto& B = objects[j];
484
485 float Ec = 0.f;
486 float En = 0.f;
487
488 if (!A.cSet.empty() && !B.cSet.empty())
489 {
490 const auto& small = (A.cSet.size() < B.cSet.size()) ? A.cSet : B.cSet;
491 const auto& large = (A.cSet.size() < B.cSet.size()) ? B.cSet : A.cSet;
492 for (const auto* fe : small) {
493 if (large.count(fe)) Ec += fe->e() * INV_GEV;
494 }
495 }
496
497 if (!A.nSet.empty() && !B.nSet.empty())
498 {
499 const auto& small = (A.nSet.size() < B.nSet.size()) ? A.nSet : B.nSet;
500 const auto& large = (A.nSet.size() < B.nSet.size()) ? B.nSet : A.nSet;
501 for (const auto* fe : small) {
502 if (large.count(fe)) En += fe->e() * INV_GEV;
503 }
504 }
505
506 if (Ec <= 0.f && En <= 0.f) continue;
507
508 auto key = PairKey::make(A.cont, A.idx, B.cont, B.idx);
509 auto& s = shared[key];
510
511 s.Ec += Ec;
512 s.En += En;
513
514 s.AcTot = A.EcTot;
515 s.AnTot = A.EnTot;
516 s.BcTot = B.EcTot;
517 s.BnTot = B.EnTot;
518
519 s.typeA = static_cast<int>(A.type);
520 s.typeB = static_cast<int>(B.type);
521 }
522 }
523
524 auto assocMap = std::make_unique<xAOD::MissingETAssociationMap>();
525 auto assocAux = std::make_unique<xAOD::AuxContainerBase>();
526 assocMap->setStore(assocAux.get());
527
528 for (const auto& [key, sh] : shared)
529 {
530 auto* assoc = new xAOD::MissingETAssociation();
531 assocMap->push_back(assoc);
532
533 ElementLink<xAOD::IParticleContainer> linkA(*key.c1, key.i1);
534 ElementLink<xAOD::IParticleContainer> linkB(*key.c2, key.i2);
535
536 if (!linkA.isValid() || !linkB.isValid())
537 {
538 assocMap->pop_back();
539 delete assoc;
540 continue;
541 }
542
543 ACC_partA(*assoc) = linkA;
544 ACC_partB(*assoc) = linkB;
545 ACC_typeA(*assoc) = sh.typeA;
546 ACC_typeB(*assoc) = sh.typeB;
547
548 ACC_sharedEc(*assoc) = sh.Ec;
549 ACC_sharedEn(*assoc) = sh.En;
550
551 ACC_fracAc(*assoc) = (sh.AcTot > 0.f ? sh.Ec / sh.AcTot : 0.f);
552 ACC_fracAn(*assoc) = (sh.AnTot > 0.f ? sh.En / sh.AnTot : 0.f);
553 ACC_fracBc(*assoc) = (sh.BcTot > 0.f ? sh.Ec / sh.BcTot : 0.f);
554 ACC_fracBn(*assoc) = (sh.BnTot > 0.f ? sh.En / sh.BnTot : 0.f);
555 }
556
557#ifndef XAOD_STANDALONE
558 SG::WriteHandle<xAOD::MissingETAssociationMap> mapH(m_outputMapKey, ctx);
559 ATH_CHECK(mapH.record(std::move(assocMap), std::move(assocAux)));
560#else
561 ATH_CHECK(evtStore()->record(assocMap.release(), m_outputMapKey.key()));
562 ATH_CHECK(evtStore()->record(assocAux.release(), m_outputMapKey.key() + "Aux."));
563#endif
564
565 return StatusCode::SUCCESS;
566}
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
SG::WriteHandleKey< xAOD::MissingETAssociationMap > m_outputMapKey
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
MissingETAssociation_v1 MissingETAssociation
Version control by type definition.
static PairKey make(const xAOD::IParticleContainer *a, std::size_t ia, const xAOD::IParticleContainer *b, std::size_t ib)

◆ collectFEsFromIndex()

void ORUtils::FEAssociationTool::collectFEsFromIndex ( const EventContext & ctx,
const ObjView::Type type,
const xAOD::IParticleContainer * cont,
std::size_t idx,
ObjView & view ) const
private

Definition at line 275 of file FEAssociationTool.cxx.

286{
287 view.cSet.clear();
288 view.nSet.clear();
289 view.EcTot = 0.f;
290 view.EnTot = 0.f;
291
292 static std::atomic<unsigned> s_warn{0};
293
294 if (!cont)
295 {
296 warnLimited(s_warn, [&]{ ANA_MSG_WARNING("collectFEsFromIndex called with null container"); });
297 return;
298 }
299 if (idx >= cont->size())
300 {
301 warnLimited(s_warn, [&]{
302 ANA_MSG_WARNING("collectFEsFromIndex index out of range: idx=" << idx
303 << " size=" << cont->size());
304 });
305 return;
306 }
307
308 const xAOD::IParticle* p = (*cont)[idx];
309 if (!p)
310 {
311 warnLimited(s_warn, [&]{ ANA_MSG_WARNING("Null IParticle at idx=" << idx); });
312 return;
313 }
314
315 auto loop_links =
316 [&](const std::vector<ElementLink<xAOD::FlowElementContainer>>& links, bool charged)
317 {
318 for (const auto& el : links)
319 {
320 if (!el.isValid()) continue;
321
322 const xAOD::FlowElement* fe = *el;
323 if (!fe) continue;
324
325 if (charged) {
326 view.cSet.insert(fe);
327 view.EcTot += fe->e() * INV_GEV;
328 } else {
329 view.nSet.insert(fe);
330 view.EnTot += fe->e() * INV_GEV;
331 }
332 }
333 };
334
335 bool usedGlobal = false;
336
337#ifndef XAOD_STANDALONE
338 switch (type)
339 {
340 case ObjView::Type::Electron:
341 {
342 SG::ReadDecorHandle<xAOD::ElectronContainer, FELinks_t> chargedFEs(m_elChargedFELinksKey, ctx);
343 SG::ReadDecorHandle<xAOD::ElectronContainer, FELinks_t> neutralFEs(m_elNeutralFELinksKey, ctx);
344 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
345 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
346 break;
347 }
348 case ObjView::Type::Muon:
349 {
350 SG::ReadDecorHandle<xAOD::MuonContainer, FELinks_t> chargedFEs(m_muChargedFELinksKey, ctx);
351 SG::ReadDecorHandle<xAOD::MuonContainer, FELinks_t> neutralFEs(m_muNeutralFELinksKey, ctx);
352 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
353 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
354 break;
355 }
356 case ObjView::Type::Photon:
357 {
358 SG::ReadDecorHandle<xAOD::PhotonContainer, FELinks_t> chargedFEs(m_phChargedFELinksKey, ctx);
359 SG::ReadDecorHandle<xAOD::PhotonContainer, FELinks_t> neutralFEs(m_phNeutralFELinksKey, ctx);
360 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
361 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
362 break;
363 }
364 case ObjView::Type::Tau:
365 {
366 SG::ReadDecorHandle<xAOD::TauJetContainer, FELinks_t> chargedFEs(m_tauChargedFELinksKey, ctx);
367 SG::ReadDecorHandle<xAOD::TauJetContainer, FELinks_t> neutralFEs(m_tauNeutralFELinksKey, ctx);
368 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
369 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
370 break;
371 }
372 case ObjView::Type::SmallRJet:
373 {
374 // we can only create the handle if the key is non-empty
375 if (!m_srjChargedFELinksKey.empty()) {
376 SG::ReadDecorHandle<xAOD::JetContainer, FELinks_t> chargedFEs(m_srjChargedFELinksKey, ctx);
377 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
378 }
379 if (!m_srjNeutralFELinksKey.empty()) {
380 SG::ReadDecorHandle<xAOD::JetContainer, FELinks_t> neutralFEs(m_srjNeutralFELinksKey, ctx);
381 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
382 }
383 break;
384 }
385 case ObjView::Type::LargeRJet:
386 {
387 // we can only create the handle if the key is non-empty
388 if (!m_lrjChargedFELinksKey.empty()) {
389 SG::ReadDecorHandle<xAOD::JetContainer, FELinks_t> chargedFEs(m_lrjChargedFELinksKey, ctx);
390 if (chargedFEs.isAvailable()) { usedGlobal = true; loop_links(chargedFEs(*p), true); }
391 }
392 if (!m_lrjNeutralFELinksKey.empty()) {
393 SG::ReadDecorHandle<xAOD::JetContainer, FELinks_t> neutralFEs(m_lrjNeutralFELinksKey, ctx);
394 if (neutralFEs.isAvailable()) { usedGlobal = true; loop_links(neutralFEs(*p), false); }
395 }
396 break;
397 }
398 }
399#else
400 if (ACC_cFEs.isAvailable(*p)) {
401 usedGlobal = true;
402 loop_links(ACC_cFEs(*p), true);
403 }
404 if (ACC_nFEs.isAvailable(*p)) {
405 usedGlobal = true;
406 loop_links(ACC_nFEs(*p), false);
407 }
408#endif
409
410 if (!usedGlobal && p->type() == xAOD::Type::Jet)
411 {
412 const auto* jet = static_cast<const xAOD::Jet*>(p);
413
414 for (const auto& cl : jet->constituentLinks())
415 {
416 if (!cl.isValid()) continue;
417
418 const xAOD::IParticle* cpart = *cl;
419 if (!cpart) continue;
420 if (cpart->type() != xAOD::Type::FlowElement) continue;
421
422 const auto* constit = static_cast<const xAOD::FlowElement*>(cpart);
423
424#ifndef XAOD_STANDALONE
425 SG::ReadDecorHandle<xAOD::FlowElementContainer, OrigObjLink_t> origObj(m_originalObjectLinkKey, ctx);
426
427 if (origObj.isAvailable())
428 {
429 const auto& feLink = origObj(*constit);
430#else
431 if (ACC_origObj.isAvailable(*constit))
432 {
433 const auto& feLink = ACC_origObj(*constit);
434#endif
435 if (!feLink.isValid()) continue;
436
437 const xAOD::IParticle* opart = *feLink;
438 if (!opart) continue;
439 if (opart->type() != xAOD::Type::FlowElement) continue;
440
441 const auto* fe = static_cast<const xAOD::FlowElement*>(opart);
442
443 if (fe->isCharged()) {
444 view.cSet.insert(fe);
445 view.EcTot += fe->e() * INV_GEV;
446 } else {
447 view.nSet.insert(fe);
448 view.EnTot += fe->e() * INV_GEV;
449 }
450 }
451 else
452 {
453 const auto* fe = constit;
454
455 if (fe->isCharged()) {
456 view.cSet.insert(fe);
457 view.EcTot += fe->e() * INV_GEV;
458 } else {
459 view.nSet.insert(fe);
460 view.EnTot += fe->e() * INV_GEV;
461 }
462 }
463 }
464 }
465}
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadDecorHandleKey< xAOD::FlowElementContainer > m_originalObjectLinkKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_srjChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_phNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_phChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_srjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lrjChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lrjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muChargedFELinksKey
virtual double e() const override
The total energy of the particle.
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
@ Jet
The object is a jet.
Definition ObjectType.h:40
@ FlowElement
The object is a track-calo-cluster.
Definition ObjectType.h:52
Jet_v1 Jet
Definition of the current "jet version".
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16

◆ collectObjects()

StatusCode ORUtils::FEAssociationTool::collectObjects ( const EventContext & ctx,
std::vector< ObjView > & objects ) const
privatevirtual

Definition at line 162 of file FEAssociationTool.cxx.

167{
168 auto collect_one = [&](ObjView::Type type, const xAOD::IParticleContainer* base)
169 {
170 if (!base) return;
171 for (std::size_t idx = 0; idx < base->size(); ++idx)
172 {
173 ObjView view(type, base, idx);
174#ifndef XAOD_STANDALONE
175 collectFEsFromIndex(ctx, type, base, idx, view);
176#else
177 collectFEsFromIndex(type, base, idx, view);
178#endif
179 objects.emplace_back(std::move(view));
180 }
181 };
182
183#ifndef XAOD_STANDALONE
184 {
185 SG::ReadHandle<xAOD::ElectronContainer> h(m_elKey, ctx);
186 if (h.isValid()) {
187 collect_one(ObjView::Type::Electron,
188 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
189 }
190 }
191 {
192 SG::ReadHandle<xAOD::MuonContainer> h(m_muKey, ctx);
193 if (h.isValid()) {
194 collect_one(ObjView::Type::Muon,
195 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
196 }
197 }
198 {
199 SG::ReadHandle<xAOD::PhotonContainer> h(m_phKey, ctx);
200 if (h.isValid()) {
201 collect_one(ObjView::Type::Photon,
202 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
203 }
204 }
205 {
206 SG::ReadHandle<xAOD::TauJetContainer> h(m_tauKey, ctx);
207 if (h.isValid()) {
208 collect_one(ObjView::Type::Tau,
209 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
210 }
211 }
212 {
213 SG::ReadHandle<xAOD::JetContainer> h(m_srjKey, ctx);
214 if (h.isValid()) {
215 collect_one(ObjView::Type::SmallRJet,
216 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
217 }
218 }
219 {
220 SG::ReadHandle<xAOD::JetContainer> h(m_lrjKey, ctx);
221 if (h.isValid()) {
222 collect_one(ObjView::Type::LargeRJet,
223 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
224 }
225 }
226#else
227 {
228 SG::ReadHandle<xAOD::ElectronContainer> h(m_elKey);
229 if (h.isValid()) {
230 collect_one(ObjView::Type::Electron,
231 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
232 }
233 }
234 {
235 SG::ReadHandle<xAOD::MuonContainer> h(m_muKey);
236 if (h.isValid()) {
237 collect_one(ObjView::Type::Muon,
238 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
239 }
240 }
241 {
242 SG::ReadHandle<xAOD::PhotonContainer> h(m_phKey);
243 if (h.isValid()) {
244 collect_one(ObjView::Type::Photon,
245 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
246 }
247 }
248 {
249 SG::ReadHandle<xAOD::TauJetContainer> h(m_tauKey);
250 if (h.isValid()) {
251 collect_one(ObjView::Type::Tau,
252 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
253 }
254 }
255 {
256 SG::ReadHandle<xAOD::JetContainer> h(m_srjKey);
257 if (h.isValid()) {
258 collect_one(ObjView::Type::SmallRJet,
259 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
260 }
261 }
262 {
263 SG::ReadHandle<xAOD::JetContainer> h(m_lrjKey);
264 if (h.isValid()) {
265 collect_one(ObjView::Type::LargeRJet,
266 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
267 }
268 }
269#endif
270
271 return StatusCode::SUCCESS;
272}
void collectFEsFromIndex(const EventContext &ctx, const ObjView::Type type, const xAOD::IParticleContainer *cont, std::size_t idx, ObjView &view) const
SG::ReadHandleKey< xAOD::JetContainer > m_srjKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_elKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_phKey
SG::ReadHandleKey< xAOD::JetContainer > m_lrjKey
std::string base
Definition hcg.cxx:83
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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>

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode ORUtils::FEAssociationTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 94 of file FEAssociationTool.cxx.

95{
96#ifndef XAOD_STANDALONE
97 ATH_CHECK(m_elKey.initialize(SG::AllowEmpty));
98 ATH_CHECK(m_muKey.initialize(SG::AllowEmpty));
99 ATH_CHECK(m_phKey.initialize(SG::AllowEmpty));
100 ATH_CHECK(m_tauKey.initialize(SG::AllowEmpty));
101 ATH_CHECK(m_srjKey.initialize(SG::AllowEmpty));
102 ATH_CHECK(m_lrjKey.initialize(SG::AllowEmpty));
103
112 // You'd think we could use SG::AllowEmpty here, but
113 // `ReadDecorHandleKey` has a custom `initialize(bool)` override that
114 // hides the `initialize(AllowEmptyEnum)` method.
120#else
121 ATH_CHECK(m_elKey.initialize());
122 ATH_CHECK(m_muKey.initialize());
123 ATH_CHECK(m_phKey.initialize());
124 ATH_CHECK(m_tauKey.initialize());
125 ATH_CHECK(m_srjKey.initialize());
126 ATH_CHECK(m_lrjKey.initialize());
127#endif
128
129 ATH_CHECK(m_outputMapKey.initialize());
130
131 ANA_MSG_INFO("Initializing FEAssociationTool; OutputMap=" << m_outputMapKey.key());
132 return StatusCode::SUCCESS;
133}
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_elChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> ORUtils::FEAssociationTool::m_elChargedFELinksKey
private
Initial value:
{
this, "ElectronChargedFELinksDecorKey",
"Electrons.chargedGlobalFELinks",
"Electron charged global FE links decoration"
}

Definition at line 160 of file FEAssociationTool.h.

160 {
161 this, "ElectronChargedFELinksDecorKey",
162 "Electrons.chargedGlobalFELinks",
163 "Electron charged global FE links decoration"
164 };

◆ m_elKey

SG::ReadHandleKey<xAOD::ElectronContainer> ORUtils::FEAssociationTool::m_elKey
private
Initial value:
{
this, "ElectronContainer", "Electrons", "Input electron container"
}

Definition at line 140 of file FEAssociationTool.h.

140 {
141 this, "ElectronContainer", "Electrons", "Input electron container"
142 };

◆ m_elNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::ElectronContainer> ORUtils::FEAssociationTool::m_elNeutralFELinksKey
private
Initial value:
{
this, "ElectronNeutralFELinksDecorKey",
"Electrons.neutralGlobalFELinks",
"Electron neutral global FE links decoration"
}

Definition at line 165 of file FEAssociationTool.h.

165 {
166 this, "ElectronNeutralFELinksDecorKey",
167 "Electrons.neutralGlobalFELinks",
168 "Electron neutral global FE links decoration"
169 };

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_lrjChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_lrjChargedFELinksKey
private
Initial value:
{
this, "LargeRJetChargedFELinksDecorKey",
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.chargedGlobalFELinks",
"Large-R jet charged global FE links decoration"
}

Definition at line 215 of file FEAssociationTool.h.

215 {
216 this, "LargeRJetChargedFELinksDecorKey",
217 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.chargedGlobalFELinks",
218 "Large-R jet charged global FE links decoration"
219 };

◆ m_lrjKey

SG::ReadHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_lrjKey
private
Initial value:
{
this, "LargeRJetContainer", "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets", "Input large-R jet container"
}

Definition at line 155 of file FEAssociationTool.h.

155 {
156 this, "LargeRJetContainer", "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets", "Input large-R jet container"
157 };

◆ m_lrjNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_lrjNeutralFELinksKey
private
Initial value:
{
this, "LargeRJetNeutralFELinksDecorKey",
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.neutralGlobalFELinks",
"Large-R jet neutral global FE links decoration"
}

Definition at line 220 of file FEAssociationTool.h.

220 {
221 this, "LargeRJetNeutralFELinksDecorKey",
222 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.neutralGlobalFELinks",
223 "Large-R jet neutral global FE links decoration"
224 };

◆ m_muChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::MuonContainer> ORUtils::FEAssociationTool::m_muChargedFELinksKey
private
Initial value:
{
this, "MuonChargedFELinksDecorKey",
"Muons.chargedGlobalFELinks",
"Muon charged global FE links decoration"
}

Definition at line 171 of file FEAssociationTool.h.

171 {
172 this, "MuonChargedFELinksDecorKey",
173 "Muons.chargedGlobalFELinks",
174 "Muon charged global FE links decoration"
175 };

◆ m_muKey

SG::ReadHandleKey<xAOD::MuonContainer> ORUtils::FEAssociationTool::m_muKey
private
Initial value:
{
this, "MuonContainer", "Muons", "Input muon container"
}

Definition at line 143 of file FEAssociationTool.h.

143 {
144 this, "MuonContainer", "Muons", "Input muon container"
145 };

◆ m_muNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::MuonContainer> ORUtils::FEAssociationTool::m_muNeutralFELinksKey
private
Initial value:
{
this, "MuonNeutralFELinksDecorKey",
"Muons.neutralGlobalFELinks",
"Muon neutral global FE links decoration"
}

Definition at line 176 of file FEAssociationTool.h.

176 {
177 this, "MuonNeutralFELinksDecorKey",
178 "Muons.neutralGlobalFELinks",
179 "Muon neutral global FE links decoration"
180 };

◆ m_originalObjectLinkKey

SG::ReadDecorHandleKey<xAOD::FlowElementContainer> ORUtils::FEAssociationTool::m_originalObjectLinkKey
private
Initial value:
{
this, "OriginalObjectLinkDecorKey",
"JetETMissChargedParticleFlowObjects.originalObjectLink",
"FlowElement originalObjectLink decoration"
}

Definition at line 226 of file FEAssociationTool.h.

226 {
227 this, "OriginalObjectLinkDecorKey",
228 "JetETMissChargedParticleFlowObjects.originalObjectLink",
229 "FlowElement originalObjectLink decoration"
230 };

◆ m_outputMapKey

SG::WriteHandleKey<xAOD::MissingETAssociationMap> ORUtils::FEAssociationTool::m_outputMapKey
private
Initial value:
{
this, "OutputMap", "FEAssociationMap", "Output MissingETAssociationMap"
}

Definition at line 233 of file FEAssociationTool.h.

233 {
234 this, "OutputMap", "FEAssociationMap", "Output MissingETAssociationMap"
235 };

◆ m_phChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> ORUtils::FEAssociationTool::m_phChargedFELinksKey
private
Initial value:
{
this, "PhotonChargedFELinksDecorKey",
"Photons.chargedGlobalFELinks",
"Photon charged global FE links decoration"
}

Definition at line 182 of file FEAssociationTool.h.

182 {
183 this, "PhotonChargedFELinksDecorKey",
184 "Photons.chargedGlobalFELinks",
185 "Photon charged global FE links decoration"
186 };

◆ m_phKey

SG::ReadHandleKey<xAOD::PhotonContainer> ORUtils::FEAssociationTool::m_phKey
private
Initial value:
{
this, "PhotonContainer", "Photons", "Input photon container"
}

Definition at line 146 of file FEAssociationTool.h.

146 {
147 this, "PhotonContainer", "Photons", "Input photon container"
148 };

◆ m_phNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::PhotonContainer> ORUtils::FEAssociationTool::m_phNeutralFELinksKey
private
Initial value:
{
this, "PhotonNeutralFELinksDecorKey",
"Photons.neutralGlobalFELinks",
"Photon neutral global FE links decoration"
}

Definition at line 187 of file FEAssociationTool.h.

187 {
188 this, "PhotonNeutralFELinksDecorKey",
189 "Photons.neutralGlobalFELinks",
190 "Photon neutral global FE links decoration"
191 };

◆ m_srjChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_srjChargedFELinksKey
private
Initial value:
{
this, "SmallRJetChargedFELinksDecorKey",
"AntiKt4EMPFlowJets.chargedGlobalFELinks",
"Small-R jet charged global FE links decoration"
}

Definition at line 204 of file FEAssociationTool.h.

204 {
205 this, "SmallRJetChargedFELinksDecorKey",
206 "AntiKt4EMPFlowJets.chargedGlobalFELinks",
207 "Small-R jet charged global FE links decoration"
208 };

◆ m_srjKey

SG::ReadHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_srjKey
private
Initial value:
{
this, "SmallRJetContainer", "AntiKt4EMPFlowJets", "Input small-R jet container"
}

Definition at line 152 of file FEAssociationTool.h.

152 {
153 this, "SmallRJetContainer", "AntiKt4EMPFlowJets", "Input small-R jet container"
154 };

◆ m_srjNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::JetContainer> ORUtils::FEAssociationTool::m_srjNeutralFELinksKey
private
Initial value:
{
this, "SmallRJetNeutralFELinksDecorKey",
"AntiKt4EMPFlowJets.neutralGlobalFELinks",
"Small-R jet neutral global FE links decoration"
}

Definition at line 209 of file FEAssociationTool.h.

209 {
210 this, "SmallRJetNeutralFELinksDecorKey",
211 "AntiKt4EMPFlowJets.neutralGlobalFELinks",
212 "Small-R jet neutral global FE links decoration"
213 };

◆ m_tauChargedFELinksKey

SG::ReadDecorHandleKey<xAOD::TauJetContainer> ORUtils::FEAssociationTool::m_tauChargedFELinksKey
private
Initial value:
{
this, "TauChargedFELinksDecorKey",
"TauJets.chargedGlobalFELinks",
"Tau charged global FE links decoration"
}

Definition at line 193 of file FEAssociationTool.h.

193 {
194 this, "TauChargedFELinksDecorKey",
195 "TauJets.chargedGlobalFELinks",
196 "Tau charged global FE links decoration"
197 };

◆ m_tauKey

SG::ReadHandleKey<xAOD::TauJetContainer> ORUtils::FEAssociationTool::m_tauKey
private
Initial value:
{
this, "TauContainer", "TauJets", "Input tau container"
}

Definition at line 149 of file FEAssociationTool.h.

149 {
150 this, "TauContainer", "TauJets", "Input tau container"
151 };

◆ m_tauNeutralFELinksKey

SG::ReadDecorHandleKey<xAOD::TauJetContainer> ORUtils::FEAssociationTool::m_tauNeutralFELinksKey
private
Initial value:
{
this, "TauNeutralFELinksDecorKey",
"TauJets.neutralGlobalFELinks",
"Tau neutral global FE links decoration"
}

Definition at line 198 of file FEAssociationTool.h.

198 {
199 this, "TauNeutralFELinksDecorKey",
200 "TauJets.neutralGlobalFELinks",
201 "Tau neutral global FE links decoration"
202 };

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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