ATLAS Offline Software
Loading...
Searching...
No Matches
CalcPartonHistory.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9
11
14
15#ifdef XAOD_STANDALONE
16#define TDS() evtStore()->tds()
17#else
18#define TDS() evtStore()
19#endif
20
21namespace {
22const std::vector<const xAOD::TruthParticle*>* findVector(
23 const std::map<std::string, std::vector<const xAOD::TruthParticle*>>& map,
24 const std::string& key) {
25 auto it = map.find(key);
26 return it == map.end() ? nullptr : &it->second;
27}
28
29constexpr const char* kBeforeFSR = "_beforeFSR";
30constexpr const char* kAfterFSR = "_afterFSR";
31} // namespace
32
33namespace CP {
34using ROOT::Math::PtEtaPhiMVector;
35
37 const std::string& name, const std::vector<std::string>& truthCollection)
38 : asg::AsgTool(name), m_truthCollections(truthCollection) {
39 declareProperty("prefix", m_prefix = "",
40 "Prefix to apply to all names to avoid overwriting");
41}
42
43bool CalcPartonHistory::ExistsInMap(const std::string& key) const {
44 // Checks whether a given key exists in the particle map.
45 return m_particleMap.find(key) != m_particleMap.end();
46}
47
48bool CalcPartonHistory::ExistsInKey(const std::string& key,
49 const xAOD::TruthParticle* p) const {
50 // Checks whether a given particle exists in the vector for the given key.
51 if (const auto* v = findVector(m_particleMap, key)) {
52 return std::find(v->begin(), v->end(), p) != v->end();
53 }
54 return false;
55}
56
57bool CalcPartonHistory::Retrievep4(const std::string& key,
58 PtEtaPhiMVector& p4) {
59 return Retrievep4(key, p4, 0);
60}
61
62bool CalcPartonHistory::Retrievep4(const std::string& key, PtEtaPhiMVector& p4,
63 const int& idx) {
64 const auto* v = findVector(m_particleMap, key);
65 if (!v || idx < 0)
66 return false;
67 const auto uidx = static_cast<std::size_t>(idx);
68 if (uidx >= v->size())
69 return false;
70 p4 = GetPtEtaPhiMfromTruth(v->at(uidx));
71 return true;
72}
73
74bool CalcPartonHistory::Retrievep4Gamma(PtEtaPhiMVector& p4, int& parentpdgId) {
75 // Finds the highest-pT photon from any 'GammaRad' key in the m_particleMap.
76 const xAOD::TruthParticle* bestPhoton = nullptr;
77 for (const auto& [key, particles] : m_particleMap) {
78 if (key.find("GammaRad") != std::string::npos) {
79 auto it = std::max_element(
80 particles.begin(), particles.end(),
81 [](const auto* a, const auto* b) { return a->pt() < b->pt(); });
82 if (it != particles.end() &&
83 (!bestPhoton || (*it)->pt() > bestPhoton->pt()))
84 bestPhoton = *it;
85 }
86 }
87 if (!bestPhoton) {
88 parentpdgId = 0;
89 return false;
90 }
91 p4 = GetPtEtaPhiMfromTruth(bestPhoton);
92 parentpdgId = bestPhoton->nParents() > 0 ? bestPhoton->parent(0)->pdgId() : 0;
93 return true;
94}
95
96bool CalcPartonHistory::RetrievepdgId(const std::string& key, int& pdgId) {
97 return RetrievepdgId(key, pdgId, 0);
98}
99
100bool CalcPartonHistory::RetrievepdgId(const std::string& key,
101 std::vector<int>& pdgIds) {
102 const auto* v = findVector(m_particleMap, key);
103 if (!v)
104 return false;
105 pdgIds.reserve(pdgIds.size() + v->size());
106 for (const auto* p : *v)
107 if (p)
108 pdgIds.push_back(p->pdgId());
109 return true;
110}
111
112bool CalcPartonHistory::RetrievepdgId(const std::string& key, int& pdgId,
113 const int& idx) {
114 const auto* v = findVector(m_particleMap, key);
115 if (!v || idx < 0)
116 return false;
117 const auto uidx = static_cast<std::size_t>(idx);
118 if (uidx >= v->size())
119 return false;
120 pdgId = v->at(uidx)->pdgId();
121 return true;
122}
123
125 const std::string& prefix, std::vector<const xAOD::TruthParticle*>& out) {
126 const auto* v = findVector(m_particleMap, prefix);
127 if (!v)
128 return false;
129 out.insert(out.end(), v->begin(), v->end());
130 return true;
131}
132
134 const std::string& prefix, std::vector<PtEtaPhiMVector>& particles,
135 std::vector<int>& pdgIds) {
136 const auto* v = findVector(m_particleMap, prefix);
137 if (!v)
138 return false;
139 particles.reserve(particles.size() + v->size());
140 pdgIds.reserve(pdgIds.size() + v->size());
141 for (const auto* p : *v) {
142 particles.push_back(GetPtEtaPhiMfromTruth(p));
143 pdgIds.push_back(p->pdgId());
144 }
145 return true;
146}
147
148bool CalcPartonHistory::RetrieveParticleInfo(const std::string& prefix,
149 PtEtaPhiMVector& particle,
150 int& pdgId) {
151 return RetrieveParticleInfo(prefix, particle, pdgId, 0);
152}
153
154bool CalcPartonHistory::RetrieveParticleInfo(const std::string& prefix,
155 PtEtaPhiMVector& particle,
156 int& pdgId, const int& idx) {
157 return Retrievep4(prefix, particle, idx) && RetrievepdgId(prefix, pdgId, idx);
158}
159
160bool CalcPartonHistory::RetrieveParticleInfo(const std::string& prefix,
161 const std::string& alt_prefix,
162 PtEtaPhiMVector& particle,
163 int& pdgId) {
164 if (Retrievep4(prefix, particle) && RetrievepdgId(prefix, pdgId))
165 return true;
166 return Retrievep4(alt_prefix, particle) && RetrievepdgId(alt_prefix, pdgId);
167}
168
170 const xAOD::TruthParticle* particle) {
171 static const std::unordered_map<int, std::string> pdgMap = {
172 {1, "_q"}, {2, "_q"}, {3, "_q"}, {-1, "_qbar"},
173 {-2, "_qbar"}, {-3, "_qbar"}, {6, "_t"}, {-6, "_tbar"},
174 {5, "_b"}, {-5, "_bbar"}, {4, "_c"}, {-4, "_cbar"},
175 {25, "_H"}, {24, "_W"}, {-24, "_W"}, {23, "_Z"},
176 {22, "_gamma"}, {21, "_g"}, {11, "_l"}, {13, "_l"},
177 {15, "_l"}, {-11, "_lbar"}, {-13, "_lbar"}, {-15, "_lbar"},
178 {12, "_nu"}, {14, "_nu"}, {16, "_nu"}, {-12, "_nubar"},
179 {-14, "_nubar"}, {-16, "_nubar"}, {2212, "_p"}, {1103, "_dd"},
180 {2101, "_ud"}, {2103, "_ud"}, {2203, "_uu"}, {3101, "_sd"},
181 {3103, "_sd"}, {3201, "_su"}, {3203, "_su"}, {3303, "_ss"},
182 {4101, "_cd"}, {4103, "_cd"}, {4201, "_cu"}, {4203, "_cu"},
183 {4301, "_cs"}, {4303, "_cs"}, {4403, "_cc"}, {5101, "_bd"},
184 {5103, "_bd"}, {5201, "_bu"}, {5203, "_bu"}, {5301, "_bs"},
185 {5303, "_bs"}, {5401, "_bc"}, {5403, "_bc"}, {5503, "_bb"}};
186 int pdgId = particle->pdgId();
187 auto it = pdgMap.find(pdgId);
188 return it != pdgMap.end() ? it->second : "_" + std::to_string(pdgId);
189}
190
192 const xAOD::TruthParticle* p, std::vector<const xAOD::TruthParticle*>& path,
193 std::vector<std::vector<const xAOD::TruthParticle*>>& allPaths) {
194 // Recursively builds decay paths from p down to stable particles.
195 // Each completed root-to-leaf path is appended to allPaths and later
196 // processed by FillParticleMap to assign m_particleMap keys.
197 //
198 // FSR handling: a particle that radiates before decaying appears as a chain
199 // of identical PDG-ID nodes (e.g. t → t → t → W b). findAfterFSR() follows
200 // that chain to the last node before the actual decay vertex, so the path
201 // records the pre- and post-FSR instances rather than every intermediate.
202 //
203 // W linking (DAOD_PHYS only): TruthTop links to Ws in TruthBoson, which
204 // carry no decay products. When we encounter such a W (isAfterFSR &&
205 // |pdg|==24) we swap it for the corresponding entry in
206 // TruthBosonsWithDecayParticles via the
207 // "CustomLinkedTruthBosonWithDecayParticles" decoration so that the subsequent
208 // child traversal finds the W decay products.
210 return;
211
212 // If this W node has no identical child (i.e. it is the after-FSR instance)
213 // but lacks decay products, swap to the linked decay-product-bearing copy.
214 if (PartonHistoryUtils::isAfterFSR(p) && std::abs(p->pdgId()) == 24) {
216 p, "CustomLinkedTruthBosonWithDecayParticles");
217 }
218
219 path.push_back(p);
220
221 // Leaf node: record the completed path.
222 if (p->nChildren() == 0) {
223 allPaths.push_back(path);
224 path.pop_back();
225 return;
226 }
227
229 // Same W-linking fix for the after-FSR node reached by findAfterFSR().
230 if (std::abs(afterFSR->pdgId()) == 24) {
232 afterFSR, "CustomLinkedTruthBosonWithDecayParticles");
233 }
234
235 if (afterFSR != p) {
236 // There was FSR: continue the path from the post-FSR node.
237 TraceParticle(afterFSR, path, allPaths);
238 } else {
239 // No FSR: branch into each child (e.g. W→lν gives two sub-paths).
240 for (std::size_t i = 0; i < afterFSR->nChildren(); ++i) {
241 if (const auto* c = afterFSR->child(i))
242 TraceParticle(c, path, allPaths);
243 }
244 }
245 path.pop_back();
246}
247
249 const std::string& key) {
250 if (!ExistsInKey(key, p))
251 m_particleMap[key].push_back(p);
252}
253
255 const std::string& newKey, std::string& key) {
257 key += newKey;
258
259 if (p->nParents() == 0) {
260 AddToParticleMap(p, key + kBeforeFSR);
262 AddToParticleMap(p, key + kAfterFSR);
263 return true;
264 }
265
267 AddToParticleMap(p, key + kAfterFSR);
268 } else {
269 AddToParticleMap(p, key + kBeforeFSR);
271 AddToParticleMap(p, key + kAfterFSR);
272 }
273 return true;
274}
275
277 std::string& key, int decayID) {
278 const bool fromH = PartonHistoryUtils::hasParentAbsPdgId(p, 25) &&
280 const bool fromW = PartonHistoryUtils::hasParentAbsPdgId(p, 24) &&
282 const bool fromZ = PartonHistoryUtils::hasParentAbsPdgId(p, 23) &&
284 if (!fromH && !fromW && !fromZ)
285 return false;
286
287 const std::string decayStr = "Decay" + std::to_string(decayID);
288 key += decayStr;
289 AddToParticleMap(p, key + kBeforeFSR);
291 AddToParticleMap(p, key + kAfterFSR);
292 return true;
293}
294
296 std::string& key) {
297 AddToParticleMap(particle, key);
298}
299
301 const std::string& newKey,
302 std::string& key) {
303 AddToParticleMap(particle, key + newKey);
304 key += newKey;
305}
306
308 std::vector<std::vector<const xAOD::TruthParticle*>>& allPaths) {
309 // Converts the raw decay paths produced by TraceParticles into the
310 // m_particleMap used by all Retrieve* and Fill* methods.
311 //
312 // Key construction: each path is walked particle by particle, accumulating
313 // a string key of the form
314 // "<prefix>_MC_<type1>_<type2>_..._<beforeFSR|afterFSR>". For example, a b
315 // quark from a top gives "MySch_MC_t_b_beforeFSR". Decay products of W/Z/H
316 // get an additional "Decay<N>" segment to distinguish the two daughters, e.g.
317 // "MySch_MC_t_WDecay1_beforeFSR".
318 //
319 // Handler priority (first match wins for each particle in the path):
320 // handleDecay — daughters of W/Z/H: appends "Decay<N>" and records
321 // beforeFSR/afterFSR handleFSR — the radiating particle itself:
322 // records both before and after FSR copies handleSameAsParent —
323 // intermediate FSR copies (same PDG as parent): stored under current key
324 // handleDefault — all other particles: appends the type suffix and
325 // advances the key
326 m_particleMap.clear();
327 static const SG::Accessor<unsigned int> acc_classification("Classification");
328 static const SG::Accessor<unsigned int> acc_classifierParticleOrigin(
329 "classifierParticleOrigin");
330 static const SG::Accessor<unsigned int> acc_classifierParticleType(
331 "classifierParticleType");
332
333 for (const auto& path : allPaths) {
334 // m_particleMap keys always include the prefix, built once here.
335 std::string key = m_prefix + "_" + "MC";
336
337 for (const auto* p : path) {
338 // beforeFSR: this node has an identical child (it will radiate).
339 // afterFSR: this node's parent has the same PDG ID (it was radiated
340 // from).
341 const bool beforeFSR = PartonHistoryUtils::hasIdenticalChild(p);
342 const bool afterFSR = PartonHistoryUtils::hasParentPdgId(p);
343
344 // Determine which child index this particle is under its parent; used to
345 // label W/Z/H decay daughters as Decay1, Decay2. Falls back to sign of
346 // pdgId (negative → 2) if parent navigation is unavailable.
347 int decayID = (p->pdgId() < 0) ? 2 : 1;
348 if (p->nParents() != 0 && p->parent(0)) {
349 const auto* par = p->parent(0);
350 for (std::size_t i = 0; i < par->nChildren(); ++i) {
351 if (par->child(i) == p) {
352 decayID = static_cast<int>(i) + 1;
353 break;
354 }
355 }
356 }
357
358 const std::string new_key = GetParticleType(p);
359
360 // Skip pure intermediate FSR nodes that are neither the first nor last
361 // in the FSR chain — they carry no additional physics information.
362 if (beforeFSR && afterFSR)
363 continue;
364 if (handleDecay(p, key, decayID))
365 continue;
366 if (handleFSR(p, new_key, key))
367 continue;
369 handleSameAsParent(p, key);
370 continue;
371 }
372 if (!new_key.empty())
373 handleDefault(p, new_key, key);
374 }
375 }
376}
377
379 const xAOD::TruthParticleContainer* truthParticles) {
380 std::vector<std::vector<const xAOD::TruthParticle*>> allPaths;
381 allPaths.reserve(truthParticles->size());
382 for (const xAOD::TruthParticle* p : *truthParticles) {
384 continue;
385 std::vector<const xAOD::TruthParticle*> path;
386 path.reserve(16);
387 TraceParticle(p, path, allPaths);
388 }
389 FillParticleMap(allPaths);
390}
391
393 m_dec.setPrefix(m_prefix);
395 return StatusCode::SUCCESS;
396}
397
399 const xAOD::TruthParticleContainer* truthParticles{nullptr};
400 ANA_CHECK(linkTruthContainers(truthParticles));
401
402 const xAOD::EventInfo* partonHistory = nullptr;
403 ANA_CHECK(evtStore()->retrieve(partonHistory, "EventInfo"));
404
405 ANA_CHECK(runHistorySaver(truthParticles, partonHistory));
406 return StatusCode::SUCCESS;
407}
408
410 const std::vector<std::string>& collections,
411 const std::string& out_contName) {
412 // In DAOD_PHYS there is no single TruthParticles collection, so we merge
413 // several dedicated collections (e.g. TruthTop,
414 // TruthBosonsWithDecayParticles) into one working container stored in the
415 // event store.
416 //
417 // The merge must avoid double-counting: the same particle can appear in
418 // multiple collections (e.g. the b from a top appears in both TruthTop and
419 // TruthBottom). We therefore keep only "root" particles — those that are not
420 // a descendant of any other candidate in the merged pool. TraceParticles then
421 // walks down from these roots, naturally visiting all descendants regardless
422 // of which original collection they came from.
426 std::vector<const xAOD::TruthParticle*> p_candidates;
427 std::vector<const xAOD::TruthParticle*> p_parents;
428
429 for (const std::string& collection : collections) {
430 const xAOD::TruthParticleContainer* cont = nullptr;
431 ANA_CHECK(evtStore()->retrieve(cont, collection));
432 p_candidates.insert(p_candidates.end(), cont->begin(), cont->end());
433 }
434 // Retain only particles that have no ancestor among the other candidates.
435 for (const xAOD::TruthParticle* potential_parent : p_candidates) {
436 if (PartonHistoryUtils::isQuarkFromPDF(potential_parent)) {
437 continue;
438 }
439
440 if (std::none_of(p_candidates.begin(), p_candidates.end(),
441 [&](const xAOD::TruthParticle* other_candidate) {
442 return other_candidate != potential_parent &&
443 !PartonHistoryUtils::isQuarkFromPDF(
444 other_candidate) &&
445 PartonHistoryUtils::isChildOf(other_candidate,
446
447 potential_parent);
448 }))
449 p_parents.push_back(potential_parent);
450 }
451 out_cont->insert(out_cont->end(), p_parents.begin(), p_parents.end());
452 StatusCode save = TDS()->record(out_cont, out_contName);
453 if (!save)
454 return StatusCode::FAILURE;
455 return StatusCode::SUCCESS;
456}
457
460 "TruthBoson", "TruthBosonsWithDecayParticles",
461 "CustomLinkedTruthBosonWithDecayParticles");
462}
463
465 const std::string& collectionToDecorate,
466 const std::string& collectionToLink, const std::string& nameOfDecoration) {
467 const SG::Decorator<const xAOD::TruthParticle*> dec(nameOfDecoration);
468 const xAOD::TruthParticleContainer* cont1 = nullptr;
469 const xAOD::TruthParticleContainer* cont2 = nullptr;
470 ANA_CHECK(evtStore()->retrieve(cont1, collectionToDecorate));
471 ANA_CHECK(evtStore()->retrieve(cont2, collectionToLink));
472 for (const auto* p : *cont1) {
473 const xAOD::TruthParticle* link = nullptr;
474 for (const auto* q : *cont2) {
475 if (p->pdgId() == q->pdgId() && p->uid() == q->uid()) {
476 link = q;
477 break;
478 }
479 }
480 dec(*p) = link;
481 }
482 return StatusCode::SUCCESS;
483}
484
487 const xAOD::TruthParticle* part, const std::string& decorationName) {
489 if (!acc.isAvailable(*part))
490 return part;
491 const xAOD::TruthParticle* link = acc(*part);
492 return link ? link : part;
493}
494
496 const xAOD::TruthParticleContainer*& tp) {
497 const std::string key = m_prefix + "_TruthParticles";
499 const auto& collections =
500 m_configured ? m_config.truthCollections : m_truthCollections;
502 ANA_CHECK(evtStore()->retrieve(tp, key));
504 return StatusCode::SUCCESS;
505 }
506 ANA_CHECK(evtStore()->retrieve(tp, key));
507 return StatusCode::SUCCESS;
508}
509
511 m_config = config;
512 m_configured = true;
513}
514
516 if (!m_configured)
517 return;
518
519 for (const auto& group : m_config.decoratorGroups) {
520 switch (group) {
523 break;
526 break;
529 break;
532 break;
535 break;
538 break;
541 break;
544 break;
547 break;
550 break;
553 break;
556 break;
559 break;
562 break;
563 }
564 }
565
566 for (const auto& zw : m_config.decoratorZWs) {
567 if (zw.type == DecoratorZW::Z)
568 InitializeZDecorators(zw.count, zw.extended);
569 else
570 InitializeWDecorators(zw.count);
571 }
572
573 for (const auto& fill : m_config.genericFills) {
574 if (fill.isVector) {
575 m_dec.initializeVectorPtEtaPhiMDecorator(fill.decorationKey);
576 m_dec.initializeVectorIntDecorator(fill.decorationKey + "_pdgId");
577 } else {
578 m_dec.initializePtEtaPhiMDecorator(fill.decorationKey);
579 m_dec.initializeIntDecorator(fill.decorationKey + "_pdgId");
580 }
581 }
582}
583
585 const xAOD::TruthParticleContainer* truthParticles,
586 const xAOD::EventInfo* partonHistory) {
587
588 // Register the EventInfo for this event; all m_dec.decorate*() calls
589 // will write to it automatically.
590 m_dec.setEventInfo(partonHistory);
591
592 TraceParticles(truthParticles);
593
594 for (const auto& op : m_config.specialFills) {
595 switch (op.type) {
598 break;
601 break;
604 break;
606 FillZPartonHistory(op.parent, op.count, op.mode);
607 break;
609 FillZtautauPartonHistory(op.parent, op.count, op.mode);
610 break;
612 FillWPartonHistory(op.parent, op.count, op.mode);
613 break;
615 FillHiggsPartonHistory(op.mode);
616 break;
618 FillGammaPartonHistory(op.parent);
619 break;
620 }
621 }
622
623 for (const auto& fill : m_config.genericFills) {
624 if (fill.isVector) {
625 FillGenericVectorPartonHistory(fill.retrievalKeys.at(0),
626 fill.decorationKey);
627 } else if (fill.retrievalKeys.size() == 1) {
628 FillGenericPartonHistory(fill.retrievalKeys.at(0), fill.decorationKey,
629 fill.idx);
630 } else {
631 FillGenericPartonHistory(fill.retrievalKeys, fill.decorationKey,
632 fill.idx);
633 }
634 }
635
636 return StatusCode::SUCCESS;
637}
638
639} // namespace CP
#define TDS()
DataVector adapter that acts like it holds const pointers.
#define ANA_CHECK(EXP)
check whether the given expression was successful
static Double_t a
ROOT::Math::PtEtaPhiMVector GetPtEtaPhiMfromTruth(const xAOD::TruthParticle *TruthParticle)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
StatusCode buildContainerFromMultipleCollections(const std::vector< std::string > &collections, const std::string &out_contName)
used to build container from multiple collections in DAOD_PHYS we don't have the TruthParticles colle...
CalcPartonHistory(const std::string &name, const std::vector< std::string > &truthCollections={"TruthTop"})
void FillGenericVectorPartonHistory(const std::string &retrievalstring, const std::string &decorationstring)
bool ExistsInKey(const std::string &key, const xAOD::TruthParticle *particle) const
void configure(const PartonSchemeConfig &config)
const xAOD::TruthParticle * getTruthParticleLinkedFromDecoration(const xAOD::TruthParticle *part, const std::string &decorationName)
helper method to handle retriveing the truth particle linked in the decoration of another particle
virtual StatusCode runHistorySaver(const xAOD::TruthParticleContainer *truthParticles, const xAOD::EventInfo *ttbarPartonHistory)
void FillParticleMap(std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
bool Retrievep4Gamma(PtEtaPhiMVector &p4, int &parentpdgId)
bool RetrieveParticleInfo(const std::string &prefix, std::vector< const xAOD::TruthParticle * > &particles)
const std::vector< std::string > m_truthCollections
void FillHiggsPartonHistory(const std::string &mode)
std::map< std::string, std::vector< const xAOD::TruthParticle * > > m_particleMap
virtual StatusCode linkTruthContainers(const xAOD::TruthParticleContainer *&tp)
void FillWPartonHistory(const std::string &parent, int nWs=1, const std::string &mode="resonant")
std::string GetParticleType(const xAOD::TruthParticle *particle)
bool Retrievep4(const std::string &key, PtEtaPhiMVector &p4)
std::string m_prefix
prefix applied to all decorator and m_particleMap names
void FillGammaPartonHistory(const std::string &parent)
bool ExistsInMap(const std::string &key) const
void InitializeZDecorators(int nZs=1, bool extend=false)
void FillZtautauPartonHistory(const std::string &parent, int nZs=1, const std::string &mode="resonant")
bool RetrievepdgId(const std::string &key, std::vector< int > &pdgIds)
bool handleDecay(const xAOD::TruthParticle *particle, std::string &key, int decayID)
bool m_configured
true after configure() has been called
void FillZPartonHistory(const std::string &parent, int nZs=1, const std::string &mode="resonant")
void TraceParticle(const xAOD::TruthParticle *particle, std::vector< const xAOD::TruthParticle * > &currentPath, std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
void handleDefault(const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
virtual void initializeDecorators()
virtual StatusCode execute()
void TraceParticles(const xAOD::TruthParticleContainer *truthParticles)
StatusCode linkBosonCollections()
currently in DAOD_PHYS TruthTop have links to Ws from the TruthBoson collection, which have no link t...
void FillGenericPartonHistory(const std::string &retrievalstring, const std::string &decorationstring, const int idx)
StatusCode decorateCollectionWithLinksToAnotherCollection(const std::string &collectionToDecorate, const std::string &collectionToLink, const std::string &nameOfDecoration)
helper method currently used in DAOD_PHYS to link particles from a given collection to the same parti...
bool handleFSR(const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
void handleSameAsParent(const xAOD::TruthParticle *particle, std::string &key)
PartonSchemeConfig m_config
scheme configuration set via configure()
void AddToParticleMap(const xAOD::TruthParticle *particle, const std::string &key)
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
DataVector adapter that acts like it holds const pointers.
iterator begin() noexcept
Return an iterator pointing at the beginning of the collection.
iterator end() noexcept
Return an iterator pointing past the end of the collection.
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Helper class to provide type-safe access to aux data.
Helper class to provide constant type-safe access to aux data.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
STL class.
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
int pdgId() const
PDG ID code.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
size_t nParents() const
Number of parents of this particle.
size_t nChildren() const
Number of children of this particle.
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116
bool hasIdenticalChild(const xAOD::TruthParticle *particle)
bool hasParticleIdenticalParent(const xAOD::TruthParticle *particle)
Return true when particle is a top before FSR.
bool isQuarkFromPDF(const xAOD::TruthParticle *particle)
bool hasParentPdgId(const xAOD::TruthParticle *particle, int PdgId)
const xAOD::TruthParticle * findAfterFSR(const xAOD::TruthParticle *particle)
Return particle after FSR (before the decay vertex).
bool isAfterFSR(const xAOD::TruthParticle *particle)
Determine whether particle is afterFSR.
bool isBrokenTop(const xAOD::TruthParticle *particle)
Looking for tops without children -> must be broken.
bool hasParentAbsPdgId(const xAOD::TruthParticle *particle, int absPdgId)
Select isolated Photons, Electrons and Muons.
@ Z
FillZPartonHistory(history, parent, dec, count, mode).
@ Ttbar
FillTtbarPartonHistory.
@ W
FillWPartonHistory(history, parent, dec, count, mode).
@ Ztautau
FillZtautauPartonHistory(history, parent, dec, count, mode).
@ Higgs
FillHiggsPartonHistory(history, mode, dec).
@ Top
FillTopPartonHistory.
@ AntiTop
FillAntiTopPartonHistory.
@ Gamma
FillGammaPartonHistory(history, parent, dec).
@ FourTop
Initialize4TopDecorators().
@ VectorAntiBottom
InitializeVectorAntiBottomDecorators().
@ VectorAntiCharm
InitializeVectorAntiCharmDecorators().
@ Bottom
InitializeBottomDecorators().
@ Charm
InitializeCharmDecorators().
@ AntiCharm
InitializeAntiCharmDecorators().
@ VectorBottom
InitializeVectorBottomDecorators().
@ Ttbar
InitializeTtbarDecorators().
@ VectorCharm
InitializeVectorCharmDecorators().
@ Higgs
InitializeHiggsDecorators().
@ Top
InitializeTopDecorators().
@ AntiBottom
InitializeAntiBottomDecorators().
@ AntiTop
InitializeAntiTopDecorators().
@ Photon
InitializePhotonDecorators().
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
EventInfo_v1 EventInfo
Definition of the latest event info version.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
enum CP::DecoratorZW::Type Z
Top-level configuration for a named parton history scheme.
void fill(H5::Group &out_file, size_t iterations)