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 138 of file FEAssociationTool.cxx.

142{
143 ANA_CHECK_SET_TYPE(StatusCode);
144
145 std::vector<ObjView> objects;
146#ifndef XAOD_STANDALONE
147 ANA_CHECK(collectObjects(ctx, objects));
148#else
149 ANA_CHECK(collectObjects(objects));
150#endif
151
152 ANA_MSG_DEBUG("Collected " << objects.size() << " objects");
153
154#ifndef XAOD_STANDALONE
155 ANA_CHECK(buildMapFromPairs(ctx, objects));
156#else
158#endif
159
160 return StatusCode::SUCCESS;
161}
#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 472 of file FEAssociationTool.cxx.

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

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

169{
170 ANA_CHECK_SET_TYPE(StatusCode);
171
172 auto collect_one = [&](ObjView::Type type, const xAOD::IParticleContainer* base)
173 {
174 if (!base) return;
175 for (std::size_t idx = 0; idx < base->size(); ++idx)
176 {
177 ObjView view(type, base, idx);
178#ifndef XAOD_STANDALONE
179 collectFEsFromIndex(ctx, type, base, idx, view);
180#else
181 collectFEsFromIndex(type, base, idx, view);
182#endif
183 objects.emplace_back(std::move(view));
184 }
185 };
186
187#ifndef XAOD_STANDALONE
188 {
189 SG::ReadHandle<xAOD::ElectronContainer> h(m_elKey, ctx);
190 if (h.isValid()) {
191 collect_one(ObjView::Type::Electron,
192 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
193 }
194 }
195 {
196 SG::ReadHandle<xAOD::MuonContainer> h(m_muKey, ctx);
197 if (h.isValid()) {
198 collect_one(ObjView::Type::Muon,
199 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
200 }
201 }
202 {
203 SG::ReadHandle<xAOD::PhotonContainer> h(m_phKey, ctx);
204 if (h.isValid()) {
205 collect_one(ObjView::Type::Photon,
206 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
207 }
208 }
209 {
210 SG::ReadHandle<xAOD::TauJetContainer> h(m_tauKey, ctx);
211 if (h.isValid()) {
212 collect_one(ObjView::Type::Tau,
213 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
214 }
215 }
216 {
217 SG::ReadHandle<xAOD::JetContainer> h(m_srjKey, ctx);
218 if (h.isValid()) {
219 collect_one(ObjView::Type::SmallRJet,
220 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
221 }
222 }
223 {
224 SG::ReadHandle<xAOD::JetContainer> h(m_lrjKey, ctx);
225 if (h.isValid()) {
226 collect_one(ObjView::Type::LargeRJet,
227 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
228 }
229 }
230#else
231 {
232 SG::ReadHandle<xAOD::ElectronContainer> h(m_elKey);
233 if (h.isValid()) {
234 collect_one(ObjView::Type::Electron,
235 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
236 }
237 }
238 {
239 SG::ReadHandle<xAOD::MuonContainer> h(m_muKey);
240 if (h.isValid()) {
241 collect_one(ObjView::Type::Muon,
242 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
243 }
244 }
245 {
246 SG::ReadHandle<xAOD::PhotonContainer> h(m_phKey);
247 if (h.isValid()) {
248 collect_one(ObjView::Type::Photon,
249 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
250 }
251 }
252 {
253 SG::ReadHandle<xAOD::TauJetContainer> h(m_tauKey);
254 if (h.isValid()) {
255 collect_one(ObjView::Type::Tau,
256 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
257 }
258 }
259 {
260 SG::ReadHandle<xAOD::JetContainer> h(m_srjKey);
261 if (h.isValid()) {
262 collect_one(ObjView::Type::SmallRJet,
263 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
264 }
265 }
266 {
267 SG::ReadHandle<xAOD::JetContainer> h(m_lrjKey);
268 if (h.isValid()) {
269 collect_one(ObjView::Type::LargeRJet,
270 static_cast<const xAOD::IParticleContainer*>(h.cptr()));
271 }
272 }
273#endif
274
275 return StatusCode::SUCCESS;
276}
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:81
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 ANA_CHECK_SET_TYPE(StatusCode);
97
98#ifndef XAOD_STANDALONE
99 ATH_CHECK(m_elKey.initialize(SG::AllowEmpty));
100 ATH_CHECK(m_muKey.initialize(SG::AllowEmpty));
101 ATH_CHECK(m_phKey.initialize(SG::AllowEmpty));
102 ATH_CHECK(m_tauKey.initialize(SG::AllowEmpty));
103 ATH_CHECK(m_srjKey.initialize(SG::AllowEmpty));
104 ATH_CHECK(m_lrjKey.initialize(SG::AllowEmpty));
105
114 // You'd think we could use SG::AllowEmpty here, but
115 // `ReadDecorHandleKey` has a custom `initialize(bool)` override that
116 // hides the `initialize(AllowEmptyEnum)` method.
122#else
123 ATH_CHECK(m_elKey.initialize());
124 ATH_CHECK(m_muKey.initialize());
125 ATH_CHECK(m_phKey.initialize());
126 ATH_CHECK(m_tauKey.initialize());
127 ATH_CHECK(m_srjKey.initialize());
128 ATH_CHECK(m_lrjKey.initialize());
129#endif
130
131 ATH_CHECK(m_outputMapKey.initialize());
132
133 ANA_MSG_INFO("Initializing FEAssociationTool; OutputMap=" << m_outputMapKey.key());
134 return StatusCode::SUCCESS;
135}
#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: