ATLAS Offline Software
Loading...
Searching...
No Matches
FtagLargeRJetTruthLabelTool Class Reference

Simplified FTAG large-R jet truth labelling tool. More...

#include <FtagLargeRJetTruthLabelTool.h>

Inheritance diagram for FtagLargeRJetTruthLabelTool:
Collaboration diagram for FtagLargeRJetTruthLabelTool:

Public Member Functions

 FtagLargeRJetTruthLabelTool (const std::string &name)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode decorate (const xAOD::JetContainer &jets) const override
 Decorate a jet collection without otherwise modifying it.
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
virtual StatusCode modify (xAOD::JetContainer &jets) const override final
 Concrete implementation of the function inherited from IJetModifier.
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

FtagLargeRLabel::TypeEnum classifyDecay (const xAOD::TruthParticle *parent, int originPdgId, int nB, int nC, int nTau, int extLabel) const
FtagLargeRLabel::TypeEnum classifyHiggsDecay (const std::set< int > &ids, const std::vector< const xAOD::TruthParticle * > &children, int nB, int nC, int nTau, int extLabel) const
FtagLargeRLabel::TypeEnum classifyTopDecay (const std::vector< const xAOD::TruthParticle * > &children, int nB, int nC) const
FtagLargeRLabel::TypeEnum classifyWDecay (const std::vector< const xAOD::TruthParticle * > &children, int nC) const
FtagLargeRLabel::TypeEnum classifyZDecay (const std::set< int > &ids, int nB, int nC, int nTau, int extLabel) const
FtagLargeRLabel::TypeEnum classifyQCD (int nB, int nC) const
std::vector< const xAOD::TruthParticle * > getDecayProducts (const xAOD::TruthParticle *parent) const
std::vector< const xAOD::TruthParticle * > getDecayProducts (const xAOD::TruthParticle *parent, std::set< const xAOD::TruthParticle * > &visited) 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::JetContainerm_jetsKey {this, "JetContainer", "", "Input jet container"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_decLabel {this, "DecLabel", m_jetsKey, "FtagLargeRTruthLabel", "Decoration name for the truth label"}
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

Simplified FTAG large-R jet truth labelling tool.

Labels jets with a factorized Origin x Decay x Containment scheme using ghost associations only (no kinematic cuts). Origin is the ghost-matched parent; Decay is from its truth decay chain; Containment is checked via ghost hadron counting on the jet.

Definition at line 30 of file FtagLargeRJetTruthLabelTool.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

◆ FtagLargeRJetTruthLabelTool()

FtagLargeRJetTruthLabelTool::FtagLargeRJetTruthLabelTool ( const std::string & name)

Definition at line 17 of file FtagLargeRJetTruthLabelTool.cxx.

18 : asg::AsgTool(name) {}

Member Function Documentation

◆ classifyDecay()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyDecay ( const xAOD::TruthParticle * parent,
int originPdgId,
int nB,
int nC,
int nTau,
int extLabel ) const
private

Definition at line 86 of file FtagLargeRJetTruthLabelTool.cxx.

87 {
88
89 std::vector<const xAOD::TruthParticle*> children = getDecayProducts(parent);
90 if (children.empty()) return FtagLargeRLabel::UNKNOWN;
91
92 std::set<int> ids;
93 for (const auto* c : children) ids.insert(std::abs(c->pdgId()));
94
95 switch (originPdgId) {
96 case 25: return classifyHiggsDecay(ids, children, nB, nC, nTau, extLabel);
97 case 6: return classifyTopDecay(children, nB, nC);
98 case 24: return classifyWDecay(children, nC);
99 case 23: return classifyZDecay(ids, nB, nC, nTau, extLabel);
100 default: return FtagLargeRLabel::UNKNOWN;
101 }
102}
std::vector< const xAOD::TruthParticle * > getDecayProducts(const xAOD::TruthParticle *parent) const
FtagLargeRLabel::TypeEnum classifyHiggsDecay(const std::set< int > &ids, const std::vector< const xAOD::TruthParticle * > &children, int nB, int nC, int nTau, int extLabel) const
FtagLargeRLabel::TypeEnum classifyZDecay(const std::set< int > &ids, int nB, int nC, int nTau, int extLabel) const
FtagLargeRLabel::TypeEnum classifyTopDecay(const std::vector< const xAOD::TruthParticle * > &children, int nB, int nC) const
FtagLargeRLabel::TypeEnum classifyWDecay(const std::vector< const xAOD::TruthParticle * > &children, int nC) const

◆ classifyHiggsDecay()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyHiggsDecay ( const std::set< int > & ids,
const std::vector< const xAOD::TruthParticle * > & children,
int nB,
int nC,
int nTau,
int extLabel ) const
private

Definition at line 104 of file FtagLargeRJetTruthLabelTool.cxx.

106 {
107 if (ids.count(5)) {
108 if (nB >= 2) return FtagLargeRLabel::Hbb;
109 if (nB == 1) return FtagLargeRLabel::Hb;
111 }
112 if (ids.count(4)) {
113 if (nC >= 2) return FtagLargeRLabel::Hcc;
114 if (nC == 1) return FtagLargeRLabel::Hc;
116 }
117 if (ids.count(15)) {
118 if (nTau == 0) return FtagLargeRLabel::Hother;
119 if (nTau == 1) return FtagLargeRLabel::Htau;
120 switch (extLabel) {
121 case 1515: return FtagLargeRLabel::Htautau;
122 case 151511: return FtagLargeRLabel::HtautauEl;
123 case 151513: return FtagLargeRLabel::HtautauMu;
124 default: return FtagLargeRLabel::Hother;
125 }
126 }
127 // H -> VV: navigate each boson's decay to count hadronic vs leptonic legs.
128 // Bosons with no decay vertex are skipped, which demotes the event to Hother.
129 if (ids.count(24)) {
130 int nHadW = 0, nLepW = 0;
131 for (const auto* child : children) {
132 if (std::abs(child->pdgId()) != 24 || !child->hasDecayVtx()) continue;
133 bool lep = false;
134 for (const auto* wc : getDecayProducts(child)) {
135 int id = std::abs(wc->pdgId());
136 if (id == 11 || id == 13 || id == 15) { lep = true; break; }
137 }
138 if (lep) ++nLepW; else ++nHadW;
139 }
140 if (nHadW == 2) return FtagLargeRLabel::HWWhad;
141 if (nHadW == 1 && nLepW == 1) return FtagLargeRLabel::HWWlep;
143 }
144 if (ids.count(23)) {
145 int nHadZ = 0;
146 for (const auto* child : children) {
147 if (std::abs(child->pdgId()) != 23 || !child->hasDecayVtx()) continue;
148 for (const auto* zc : getDecayProducts(child)) {
149 int id = std::abs(zc->pdgId());
150 if (id >= 1 && id <= 6) { ++nHadZ; break; }
151 }
152 }
153 if (nHadZ == 2) return FtagLargeRLabel::HZZhad;
155 }
157}
@ Hbb
H -> bb, nB >= 2.
@ HWWlep
H -> WW, one W -> qq, other W -> lv or tau nu (semileptonic).
@ HtautauEl
H -> tautau, one tau -> e.
@ Hc
H -> cc, nC = 1 (partial containment).
@ Hb
H -> bb, nB = 1 (partial containment).
@ HtautauMu
H -> tautau, one tau -> mu.
@ HZZhad
H -> ZZ, both Z -> qq (fully hadronic).
@ HWWhad
H -> WW, both W -> qq (fully hadronic).
@ Hother
H ghost-matched, decay products not captured (10-59 below are non-Higgs; Higgs sequence continues at ...
@ Htautau
H -> tautau, both taus hadronic.
@ Hcc
H -> cc, nC >= 2.
@ Htau
H -> tautau, nTau = 1 (partial containment).

◆ classifyQCD()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyQCD ( int nB,
int nC ) const
private

Definition at line 231 of file FtagLargeRJetTruthLabelTool.cxx.

232 {
233 if (nB >= 2) return FtagLargeRLabel::QCDbb;
234 if (nB == 1 && nC >= 1) return FtagLargeRLabel::QCDbc;
235 if (nB == 0 && nC >= 2) return FtagLargeRLabel::QCDcc;
236 if (nB == 1) return FtagLargeRLabel::QCDbq;
237 if (nC == 1) return FtagLargeRLabel::QCDcq;
239}
@ QCDqq
no heavy flavour
@ QCDbb
>= 2 ghost B-hadrons
@ QCDbc
1B + >= 1C (after B->C dedup)

◆ classifyTopDecay()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyTopDecay ( const std::vector< const xAOD::TruthParticle * > & children,
int nB,
int nC ) const
private

Definition at line 159 of file FtagLargeRJetTruthLabelTool.cxx.

160 {
161 for (const auto* child : children) {
162 if (std::abs(child->pdgId()) != 24) continue;
163 if (!child->hasDecayVtx()) return FtagLargeRLabel::Wother;
164
165 std::vector<const xAOD::TruthParticle*> wProducts = getDecayProducts(child);
166 if (wProducts.empty()) return FtagLargeRLabel::Wother;
167
168 bool hasCharm = false, hasQuark = false;
169 for (const auto* wc : wProducts) {
170 int id = std::abs(wc->pdgId());
171 if (id >= 1 && id <= 5) hasQuark = true;
172 if (id == 4) hasCharm = true;
173 }
174
175 if (hasCharm) {
176 if (nB >= 1 && nC >= 1) return FtagLargeRLabel::TopBcs;
177 if (nB >= 1) return FtagLargeRLabel::TopBx;
178 if (nC >= 1) return FtagLargeRLabel::Wcs;
180 }
181 if (hasQuark) {
182 if (nB >= 1) return FtagLargeRLabel::TopBqq;
184 }
185 if (nB >= 1) return FtagLargeRLabel::TopBlv;
187 }
189}
bool hasQuark(const T &p, const int &q)
bool hasCharm(const T &p)
Definition AtlasPID.h:737
@ TopBcs
t -> W(->cs)b, nB >= 1, nC >= 1
@ Wqq
W -> qq (ud, us).
@ TopBx
t -> W(->cs)b, nB >= 1, nC = 0 (b contained, charm not)
@ TopBlv
t -> W(->lv)b, nB >= 1
@ Wother
W leptonic, uncontained, or unresolved.
@ TopBqq
t -> W(->qq)b, nB >= 1
@ Wcs
W -> cs, nC >= 1.

◆ classifyWDecay()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyWDecay ( const std::vector< const xAOD::TruthParticle * > & children,
int nC ) const
private

Definition at line 191 of file FtagLargeRJetTruthLabelTool.cxx.

192 {
193 bool hasCharm = false, hasQuark = false;
194 for (const auto* child : children) {
195 int id = std::abs(child->pdgId());
196 if (id >= 1 && id <= 5) hasQuark = true;
197 if (id == 4) hasCharm = true;
198 }
199 if (hasCharm && nC >= 1) return FtagLargeRLabel::Wcs;
200 if (hasQuark) return FtagLargeRLabel::Wqq;
202}

◆ classifyZDecay()

FtagLargeRLabel::TypeEnum FtagLargeRJetTruthLabelTool::classifyZDecay ( const std::set< int > & ids,
int nB,
int nC,
int nTau,
int extLabel ) const
private

Definition at line 204 of file FtagLargeRJetTruthLabelTool.cxx.

205 {
206 if (ids.count(5)) {
207 if (nB >= 2) return FtagLargeRLabel::Zbb;
208 if (nB == 1) return FtagLargeRLabel::Zb;
210 }
211 if (ids.count(4)) {
212 if (nC >= 2) return FtagLargeRLabel::Zcc;
213 if (nC == 1) return FtagLargeRLabel::Zc;
215 }
216 if (ids.count(3)) return FtagLargeRLabel::Zss;
217 if (ids.count(15)) {
218 if (nTau == 0) return FtagLargeRLabel::Zother;
219 if (nTau == 1) return FtagLargeRLabel::Ztau;
220 switch (extLabel) {
221 case 1515: return FtagLargeRLabel::Ztautau;
222 case 151511: return FtagLargeRLabel::ZtautauEl;
223 case 151513: return FtagLargeRLabel::ZtautauMu;
224 default: return FtagLargeRLabel::Zother;
225 }
226 }
227 if (ids.count(1) || ids.count(2)) return FtagLargeRLabel::Zqq;
229}
@ Zbb
Z -> bb, nB >= 2.
@ Zother
Z leptonic or uncontained.
@ Zb
Z -> bb, nB = 1 (partial containment).
@ Ztau
Z -> tautau, nTau = 1 (partial containment).
@ ZtautauMu
Z -> tautau, one tau -> mu.
@ Zc
Z -> cc, nC = 1 (partial containment).
@ ZtautauEl
Z -> tautau, one tau -> e.
@ Zcc
Z -> cc, nC >= 2.
@ Ztautau
Z -> tautau, both taus hadronic.

◆ 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>

◆ decorate()

StatusCode FtagLargeRJetTruthLabelTool::decorate ( const xAOD::JetContainer & jets) const
overridevirtual

Decorate a jet collection without otherwise modifying it.

Implements IJetDecorator.

Definition at line 33 of file FtagLargeRJetTruthLabelTool.cxx.

33 {
34
35 // IJetDecorator::decorate() has no EventContext parameter; retrieve from Gaudi TLS.
36 const EventContext& ctx = Gaudi::Hive::currentContext();
37 SG::WriteDecorHandle<xAOD::JetContainer, int> dec_label(m_decLabel, ctx);
38
39 auto ptComp = [](const xAOD::TruthParticle* a, const xAOD::TruthParticle* b) {
40 return a->pt() < b->pt();
41 };
42
43 for (const xAOD::Jet* jet : jets) {
44 std::vector<const xAOD::TruthParticle*> ghostH = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostHBosons");
45 std::vector<const xAOD::TruthParticle*> ghostTop = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostTQuarksFinal");
46 std::vector<const xAOD::TruthParticle*> ghostZ = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostZBosons");
47 std::vector<const xAOD::TruthParticle*> ghostW = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostWBosons");
48 std::vector<const xAOD::TruthParticle*> ghostB = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostBHadronsFinal");
49 std::vector<const xAOD::TruthParticle*> ghostC = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostCHadronsFinal");
50 std::vector<const xAOD::TruthParticle*> ghostTau = jet->getAssociatedObjects<xAOD::TruthParticle>("GhostTausFinal");
51
52 // Origin priority: H > top > Z > W > QCD
53 int originPdgId = 0;
54 const xAOD::TruthParticle* parent = nullptr;
55 if (!ghostH.empty()) { originPdgId = 25; parent = *std::max_element(ghostH.begin(), ghostH.end(), ptComp); }
56 else if (!ghostTop.empty()) { originPdgId = 6; parent = *std::max_element(ghostTop.begin(), ghostTop.end(), ptComp); }
57 else if (!ghostZ.empty()) { originPdgId = 23; parent = *std::max_element(ghostZ.begin(), ghostZ.end(), ptComp); }
58 else if (!ghostW.empty()) { originPdgId = 24; parent = *std::max_element(ghostW.begin(), ghostW.end(), ptComp); }
59
60 // C-hadron count after removing B->C cascade descendants
61 std::vector<const xAOD::TruthParticle*> deduplicatedC = std::move(ghostC);
62 ParticleJetTools::childrenRemoved(ghostB, deduplicatedC);
63 int nB = static_cast<int>(ghostB.size());
64 int nC = static_cast<int>(deduplicatedC.size());
65 int nTau = static_cast<int>(ghostTau.size());
66
67 // Extended truth label encodes tau-pair decay mode:
68 // 1515 = had-had, 151511 = had + tau->e, 151513 = had + tau->mu
69 static const SG::AuxElement::ConstAccessor<int> accExtLabel("HadronGhostExtendedTruthLabelID");
70 int extLabel = accExtLabel.isAvailable(*jet) ? accExtLabel(*jet) : 0;
71
73 if (originPdgId != 0 && parent && parent->hasDecayVtx())
74 label = classifyDecay(parent, originPdgId, nB, nC, nTau, extLabel);
75 else
76 label = classifyQCD(nB, nC);
77
78 dec_label(*jet) = static_cast<int>(label);
79 }
80
81 return StatusCode::SUCCESS;
82}
static Double_t a
FtagLargeRLabel::TypeEnum classifyQCD(int nB, int nC) const
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decLabel
FtagLargeRLabel::TypeEnum classifyDecay(const xAOD::TruthParticle *parent, int originPdgId, int nB, int nC, int nTau, int extLabel) const
std::string label(const std::string &format, int i)
Definition label.h:19
void childrenRemoved(const std::vector< const xAOD::TruthParticle * > &parents, std::vector< const xAOD::TruthParticle * > &children)
Jet_v1 Jet
Definition of the current "jet version".
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ 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

◆ getDecayProducts() [1/2]

std::vector< const xAOD::TruthParticle * > FtagLargeRJetTruthLabelTool::getDecayProducts ( const xAOD::TruthParticle * parent) const
private

Definition at line 245 of file FtagLargeRJetTruthLabelTool.cxx.

246 {
247 std::set<const xAOD::TruthParticle*> visited;
248 return getDecayProducts(parent, visited);
249}

◆ getDecayProducts() [2/2]

std::vector< const xAOD::TruthParticle * > FtagLargeRJetTruthLabelTool::getDecayProducts ( const xAOD::TruthParticle * parent,
std::set< const xAOD::TruthParticle * > & visited ) const
private

Definition at line 252 of file FtagLargeRJetTruthLabelTool.cxx.

254 {
255 std::vector<const xAOD::TruthParticle*> products;
256 if (!parent || !parent->hasDecayVtx()) return products;
257 if (!visited.insert(parent).second) return products; // cycle detected
258 const xAOD::TruthVertex* vtx = parent->decayVtx();
259 if (!vtx) return products;
260
261 for (size_t i = 0; i < vtx->nOutgoingParticles(); ++i) {
262 const xAOD::TruthParticle* child = vtx->outgoingParticle(i);
263 if (!child || child == parent) continue;
264 int childAbsId = std::abs(child->pdgId());
265
266 // Follow through self-copies (same pdgId -> generator intermediate)
267 if (child->pdgId() == parent->pdgId() && child->hasDecayVtx()) {
268 std::vector<const xAOD::TruthParticle*> gc = getDecayProducts(child, visited);
269 products.insert(products.end(), gc.begin(), gc.end());
270 continue;
271 }
272 // Skip FSR photons and gluons
273 if (childAbsId == 22 || childAbsId == 21) continue;
274
275 products.push_back(child);
276 }
277 return products;
278}
int pdgId() const
PDG ID code.
bool hasDecayVtx() const
Check for a decay vertex on this particle.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15

◆ 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 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ 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 FtagLargeRJetTruthLabelTool::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 20 of file FtagLargeRJetTruthLabelTool.cxx.

20 {
21 if (m_jetsKey.key().empty()) {
22 ATH_MSG_ERROR("JetContainer property must be set");
23 return StatusCode::FAILURE;
24 }
25 ATH_CHECK(m_jetsKey.initialize());
26 ATH_CHECK(m_decLabel.initialize());
27 ATH_MSG_INFO("Initializing FtagLargeRJetTruthLabelTool: container=" << m_jetsKey.key()
28 << " decoration=" << m_decLabel.key());
29
30 return StatusCode::SUCCESS;
31}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey

◆ 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.

◆ modify()

virtual StatusCode IJetDecorator::modify ( xAOD::JetContainer & jets) const
inlinefinaloverridevirtualinherited

Concrete implementation of the function inherited from IJetModifier.

Implements IJetModifier.

Definition at line 32 of file IJetDecorator.h.

32{return decorate(jets);};
virtual StatusCode decorate(const xAOD::JetContainer &jets) const =0
Decorate a jet collection without otherwise modifying it.

◆ 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()

◆ 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_decLabel

SG::WriteDecorHandleKey<xAOD::JetContainer> FtagLargeRJetTruthLabelTool::m_decLabel {this, "DecLabel", m_jetsKey, "FtagLargeRTruthLabel", "Decoration name for the truth label"}
private

Definition at line 53 of file FtagLargeRJetTruthLabelTool.h.

53{this, "DecLabel", m_jetsKey, "FtagLargeRTruthLabel", "Decoration name for the truth label"};

◆ 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_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_jetsKey

SG::ReadHandleKey<xAOD::JetContainer> FtagLargeRJetTruthLabelTool::m_jetsKey {this, "JetContainer", "", "Input jet container"}
private

Definition at line 52 of file FtagLargeRJetTruthLabelTool.h.

52{this, "JetContainer", "", "Input jet container"};

◆ 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: