ATLAS Offline Software
Loading...
Searching...
No Matches
CalcPartonHistory.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#ifndef PARTONS_CALCPARTONHISTORY_H
9#define PARTONS_CALCPARTONHISTORY_H
10
11// system include(s):
12#include <array>
13#include <vector>
14
15// Framework include(s):
17
18#include "AsgTools/AsgTool.h"
24
25namespace CP {
26using ROOT::Math::PtEtaPhiMVector;
27
29
30 public:
31 explicit CalcPartonHistory(
32 const std::string& name,
33 const std::vector<std::string>& truthCollections = {"TruthTop"});
34 virtual ~CalcPartonHistory() = default;
35
40
41 void AddToParticleMap(const xAOD::TruthParticle* particle,
42 const std::string& key);
43 bool ExistsInMap(const std::string& key) const;
44 bool ExistsInKey(const std::string& key,
45 const xAOD::TruthParticle* particle) const;
46 bool Retrievep4(const std::string& key, PtEtaPhiMVector& p4);
47 bool Retrievep4(const std::string& key, PtEtaPhiMVector& p4, std::size_t idx);
48 bool Retrievep4Gamma(PtEtaPhiMVector& p4, int& parentpdgId);
49 bool RetrievepdgId(const std::string& key, std::vector<int>& pdgIds);
50 bool RetrievepdgId(const std::string& key, int& pdgId);
51 bool RetrievepdgId(const std::string& key, int& pdgId, std::size_t idx);
52 bool RetrieveParticleInfo(const std::string& prefix,
53 std::vector<const xAOD::TruthParticle*>& particles);
54 bool RetrieveParticleInfo(const std::string& prefix,
55 PtEtaPhiMVector& particle, int& pdgId);
56 bool RetrieveParticleInfo(const std::string& prefix,
57 PtEtaPhiMVector& particle, int& pdgId,
58 std::size_t idx);
59 bool RetrieveParticleInfo(const std::string& prefix,
60 const std::string& alt_prefix,
61 PtEtaPhiMVector& particle, int& pdgId);
62 bool RetrieveParticleInfo(const std::string& prefix,
63 std::vector<PtEtaPhiMVector>& particles,
64 std::vector<int>& pdgIds);
65
67 void InitializeTopDecorators(bool fcnc = false);
68 void InitializeAntiTopDecorators(bool fcnc = false);
80 void InitializeZDecorators(int nZs = 1, bool extend = false);
81 void InitializeWDecorators(int nWs = 1);
82
83 std::string GetParticleType(const xAOD::TruthParticle* particle);
84
85 void TraceParticle(
86 const xAOD::TruthParticle* particle,
87 std::vector<const xAOD::TruthParticle*>& currentPath,
88 std::vector<std::vector<const xAOD::TruthParticle*>>& allPaths);
89 void TraceParticles(const xAOD::TruthParticleContainer* truthParticles);
90
91 void handleFSR(const xAOD::TruthParticle* particle, const std::string& newKey,
92 std::string& key);
93 bool handleDecay(const xAOD::TruthParticle* particle, std::string& key,
94 int decayID);
95
96 void FillParticleMap(
97 std::vector<std::vector<const xAOD::TruthParticle*>>& allPaths);
98
99 // Generic history fillers
100 void FillGenericPartonHistory(const std::string& retrievalstring,
101 const std::string& decorationstring,
102 const int idx);
104 const std::vector<std::string>& retrievalStrings,
105 const std::string& decorationstring, const int idx);
107 const std::vector<std::string>& retrievalStrings,
108 const std::string& decorationstring);
109 void FillGenericVectorPartonHistory(const std::string& retrievalstring,
110 const std::string& decorationstring);
111
112 // Specialised history fillers
114 void FillZPartonHistory(const std::string& parent, int nZs = 1,
115 const std::string& mode = "resonant");
116 void FillZtautauPartonHistory(const std::string& parent, int nZs = 1,
117 const std::string& mode = "resonant");
118 void FillWPartonHistory(const std::string& parent, int nWs = 1,
119 const std::string& mode = "resonant");
120 void FillXPartonHistory(const std::string& parent, // for FCNC t -> qX, where X can be W
121 const std::string& symbolX);
122 void FillTopPartonHistory(bool fcnc = false);
123 void FillAntiTopPartonHistory(bool fcnc = false);
124 void FillHiggsPartonHistory(const std::string& mode);
125 void FillTtbarPartonHistory(bool fcnc = false);
126
127 // Helpers for non-resonant / off-shell reconstruction.
128 void setHiggs(const std::string& fsr);
129 void setW(const std::string& fsr, int nWs);
130 bool getW(const std::string& str_lep, const std::string& str_nu,
131 PtEtaPhiMVector& p1, int& pdgId1, PtEtaPhiMVector& p2, int& pdgId2);
132 void setZ(const std::string& fsr, int nZs);
133 void setZtautau(const std::string& fsr, int nZs);
134 bool getZ(const std::string& str_lep1, const std::string& str_lep2,
135 PtEtaPhiMVector& p1, int& pdgId1, PtEtaPhiMVector& p2, int& pdgId2);
138 PtEtaPhiMVector p4;
139 int pdgId = 0;
140 bool found = false;
141 };
142
145 std::array<ZTauTauProduct, 2> taus;
146 std::array<std::array<ZTauTauProduct, 3>, 2> tauDecays;
147 };
148 ZTauTauDecay getZFromTaus(const std::string& fsr);
149
152#ifndef XAOD_STANDALONE
153 using AsgTool::configure;
154#endif
155 void configure(const PartonSchemeConfig& config);
156
157 virtual StatusCode initialize() override;
158 StatusCode execute();
159
160 protected:
161 std::map<std::string, std::vector<const xAOD::TruthParticle*>> m_particleMap;
163
164 const std::vector<std::string> m_truthCollections;
165 Gaudi::Property<std::string> m_prefix{
166 this, "prefix", "", "Prefix to apply to all names to avoid overwriting"};
167 Gaudi::Property<std::string> m_symbolFCNC{
168 this, "symbolFCNC", "",
169 "Symbol for FCNC, valid only for 'TtbarFCNC' history"};
170
171 // this method is used to perform the linking of various TRUTH3 particle
172 // containers for Partons to work
173 virtual StatusCode linkTruthContainers(
175
176 // this is the method that runs the actual parton history reconstruction
177 virtual StatusCode runHistorySaver(
178 const xAOD::TruthParticleContainer* truthParticles,
179 const xAOD::EventInfo* ttbarPartonHistory);
180
181 virtual void initializeDecorators();
182
184 bool m_configured = false;
185
195 const std::vector<std::string>& collections,
196 const std::string& out_contName);
197
207 StatusCode linkBosonCollections();
208
212 const xAOD::TruthParticle* part, const std::string& decorationName);
213
214 private:
221 const std::string& collectionToDecorate,
222 const std::string& collectionToLink, const std::string& nameOfDecoration);
223};
224
225} // namespace CP
226
227#endif
bool getZ(const std::string &str_lep1, const std::string &str_lep2, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)
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"})
Gaudi::Property< std::string > m_symbolFCNC
void FillGenericVectorPartonHistory(const std::string &retrievalstring, const std::string &decorationstring)
CalcPartonHistory(CalcPartonHistory &&rhs)=delete
CalcPartonHistory & operator=(const CalcPartonHistory &rhs)=delete
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
Gaudi::Property< std::string > m_prefix
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)
bool getW(const std::string &str_lep, const std::string &str_nu, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)
CalcPartonHistory(const CalcPartonHistory &rhs)=delete
void handleFSR(const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
CalcPartonHistory & operator=(CalcPartonHistory &&rhs)=delete
void setZ(const std::string &fsr, int nZs)
void setW(const std::string &fsr, int nWs)
void FillTopPartonHistory(bool fcnc=false)
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)
void FillXPartonHistory(const std::string &parent, const std::string &symbolX)
bool handleDecay(const xAOD::TruthParticle *particle, std::string &key, int decayID)
bool m_configured
true after configure() has been called
void InitializeTopDecorators(bool fcnc=false)
void FillZPartonHistory(const std::string &parent, int nZs=1, const std::string &mode="resonant")
void InitializeAntiTopDecorators(bool fcnc=false)
void TraceParticle(const xAOD::TruthParticle *particle, std::vector< const xAOD::TruthParticle * > &currentPath, std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
virtual void initializeDecorators()
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...
ZTauTauDecay getZFromTaus(const std::string &fsr)
void setZtautau(const std::string &fsr, int nZs)
PartonSchemeConfig m_config
scheme configuration set via configure()
virtual ~CalcPartonHistory()=default
void FillTtbarPartonHistory(bool fcnc=false)
void AddToParticleMap(const xAOD::TruthParticle *particle, const std::string &key)
void FillAntiTopPartonHistory(bool fcnc=false)
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
void setHiggs(const std::string &fsr)
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
Select isolated Photons, Electrons and Muons.
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.
Z->tautau decay chain: taus[0] = tau- (Zdecay1), taus[1] = tau+ (Zdecay2); tauDecays[i][j] = decay pr...
std::array< ZTauTauProduct, 2 > taus
std::array< std::array< ZTauTauProduct, 3 >, 2 > tauDecays
One Z->tautau decay product: kinematics, PDG ID and whether it was found.
Top-level configuration for a named parton history scheme.
Struct to manage and apply decorators to the EventInfo object.