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

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

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

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

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