ATLAS Offline Software
BTaggingUtilities.cxx
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 //
4 
5 // Local include(s).
7 
9 
14  static const Accessor_t DEFAULT_ACC( DEFAULT_BTAG_LINK_NAME );
15 
20  static const Decorator_t DEFAULT_DEC( DEFAULT_BTAG_LINK_NAME );
21 
22  namespace {
23 
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 
38 
39  return getBTagging( part, DEFAULT_ACC );
40  }
41 
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
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
BTaggingUtilities.h
xAOD::BTaggingUtilities::Decorator_t
SG::AuxElement::Decorator< ElementLink< BTaggingContainer > > Decorator_t
Convenience type for the decorator.
Definition: BTaggingUtilities.cxx:18
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
xAOD::BTaggingUtilities::setBTaggingLink
void setBTaggingLink(const SG::AuxElement &part, const ElementLink< xAOD::BTaggingContainer > &el)
Set the default xAOD::BTagging link for an object.
Definition: BTaggingUtilities.cxx:64
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
xAOD::BTagging_v1
Definition: BTagging_v1.h:39
xAOD::BTaggingUtilities::Accessor_t
SG::AuxElement::Accessor< ElementLink< BTaggingContainer > > Accessor_t
Convenience type for the accessor.
Definition: BTaggingUtilities.cxx:12
xAOD::BTaggingUtilities
Definition: BTaggingUtilities.cxx:8
xAOD::BTaggingUtilities::getBTagging
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
Definition: BTaggingUtilities.cxx:37
xAOD::BTaggingUtilities::getBTaggingLink
const ElementLink< xAOD::BTaggingContainer > & getBTaggingLink(const SG::AuxElement &part)
Access the default xAOD::BTagging link for an object.
Definition: BTaggingUtilities.cxx:50