ATLAS Offline Software
Loading...
Searching...
No Matches
BTaggingUtilities.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3//
4
5// Local include(s).
7
9
15
21
22 namespace {
23
25 const xAOD::BTagging* getBTagging( const SG::AuxElement& part,
26 const Accessor_t& acc ) {
27
28 if( acc.isAvailable( part ) && acc( part ).isValid() ) {
29 return *( acc( part ) );
30 } else {
31 return nullptr;
32 }
33 }
34
35 } // private namespace
36
37 const BTagging* getBTagging( const SG::AuxElement& part ) {
38
39 return getBTagging( part, DEFAULT_ACC );
40 }
41
42 const BTagging* getBTagging( const SG::AuxElement& part,
43 const std::string& linkName ) {
44
45 const Accessor_t btagAcc( linkName );
46 return getBTagging( part, btagAcc );
47 }
48
51
52 // cppcheck-suppress returnTempReference; false positive
53 return DEFAULT_ACC( part );
54 }
55
58 const std::string& linkName ) {
59
60 const Accessor_t btagAcc( linkName );
61 return btagAcc( part );
62 }
63
66
67 DEFAULT_DEC( part ) = el;
68 }
69
72 const std::string& linkName ) {
73
74 const Decorator_t btagDec( linkName );
75 btagDec( part ) = el;
76 }
77
78} // namespace xAOD::BTaggingUtilities
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
Base class for elements of a container that can have aux data.
Definition AuxElement.h:484
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:576
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
const ElementLink< xAOD::BTaggingContainer > & getBTaggingLink(const SG::AuxElement &part)
Access the default xAOD::BTagging link for an object.
static const Decorator_t DEFAULT_DEC(DEFAULT_BTAG_LINK_NAME)
Decorator for the default xAOD::BTagging link.
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
static const Accessor_t DEFAULT_ACC(DEFAULT_BTAG_LINK_NAME)
Accessor for the default xAOD::BTagging link.
void setBTaggingLink(const SG::AuxElement &part, const ElementLink< xAOD::BTaggingContainer > &el)
Set the default xAOD::BTagging link for an object.
SG::AuxElement::Accessor< ElementLink< BTaggingContainer > > Accessor_t
Convenience type for the accessor.
SG::AuxElement::Decorator< ElementLink< BTaggingContainer > > Decorator_t
Convenience type for the decorator.
static const std::string DEFAULT_BTAG_LINK_NAME
The default key for the xAOD::BTagging link.
BTagging_v1 BTagging
Definition of the current "BTagging version".
Definition BTagging.h:17
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.