4#ifndef TRUTHUTILS_TRUTHCLASSIFIERS_H
5#define TRUTHUTILS_TRUTHCLASSIFIERS_H
132 for (
const auto& it: allJetMothers) {
133 int pdg = abs(it->pdg_id());
139 if (pdg == 35 || pdg == 36 || pdg == 37)
return HiggsMSSM;
140 if (pdg == 32 || pdg == 33 || pdg == 34)
return HeavyBoson;
141 if (pdg == 42)
return LQ;
151 T parent_hadron_ptr =
nullptr;
153 bool uncat = 0, fromHad = 0, fromTau = 0;
157 bool fromBSM =
isBSM;
159 auto prodVtx = thePart->production_vertex();
160 if (isPhysical && prodVtx && !isGeant) {
165 std::bitset<MCTC_bits::totalBits> classifier;
174 unsigned int outputvalue =
static_cast<unsigned int>(classifier.to_ulong());
176 return std::make_tuple(outputvalue,parent_hadron_ptr);
179inline int isPrompt(
const unsigned int classify,
bool allow_prompt_tau_decays =
true) {
180 std::bitset<MCTC_bits::totalBits>
res(classify);
183 if (fromPromptTau)
return int(allow_prompt_tau_decays);
192 int ElecOutNumOfNucFr(0);
193 int ElecOutNumOfElec(0);
195 auto outgoing = EndVert->particles_out();
196 int NumOfElecDaug = outgoing.size();
197 for (
const auto& p: outgoing) {
199 int EndDaugType = p->pdg_id();
202 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) ElecOutNumOfNucFr++;
205 if (ElecOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome =
NuclInteraction;
206 if (ElecOutNumOfElec == 1 && NumOfElecDaug == 1) PartOutCome =
ElectrMagInter;
215 int MuOutNumOfNucFr(0);
217 int NumOfEleNeutr(0);
218 int NumOfMuonNeutr(0);
220 auto outgoing = EndVert->particles_out();
221 int NumOfMuDaug = outgoing.size();
222 for (
const auto& p: outgoing) {
224 int EndDaugType = p->pdg_id();
226 if (abs(EndDaugType) == 12) NumOfEleNeutr++;
227 if (abs(EndDaugType) == 14) NumOfMuonNeutr++;
229 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) MuOutNumOfNucFr++;
232 if (MuOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome =
NuclInteraction;
233 if (NumOfMuDaug == 3 && NumOfElec == 1 && NumOfEleNeutr == 1 && NumOfMuonNeutr == 1) PartOutCome =
DecaytoElectron;
241 int NumOfTauDaug = EndVert->nOutgoingParticles();
243 auto PD = DecayProducts(tauFinalStatePart);
244 int NumOfElec =
PD.apd(11);
245 int NumOfMuon =
PD.apd(13);
246 int NumOfElecNeut =
PD.apd(12);
247 int NumOfMuonNeut =
PD.apd(14);
248 int NumOfPhot =
PD.apd(22);
249 int NumOfPi =
PD.apd(211);
250 int NumOfKaon =
PD.apd(321);
251 int NumOfNucFr =
PD.apd(0) +
PD.apd(1000000000, std::numeric_limits<int>::max());
254 if ((NumOfTauDaug == 3 && NumOfElec == 1 && NumOfElecNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfElecNeut == 1)) PartOutCome =
DecaytoElectron;
255 if ((NumOfTauDaug == 3 && NumOfMuon == 1 && NumOfMuonNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfMuonNeut == 1)) PartOutCome =
DecaytoMuon;
257 if (NumOfPi == 1 || NumOfKaon == 1) PartOutCome =
OneProng;
258 if (NumOfPi + NumOfKaon == 3) PartOutCome =
ThreeProng;
259 if (NumOfPi + NumOfKaon == 5) PartOutCome =
FiveProng;
270 int PhtOutNumOfNucFr(0);
271 int PhtOutNumOfEl(0);
272 int PhtOutNumOfPos(0);
273 int PhtOutNumOfHadr(0);
275 auto outgoing = EndVert->particles_out();
276 int NumOfPhtDaug = outgoing.size();
277 for (
const auto& p: outgoing) {
279 int EndDaugType = p->pdg_id();
280 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) PhtOutNumOfNucFr++;
281 if (EndDaugType == 11) PhtOutNumOfEl++;
282 if (EndDaugType == -11) PhtOutNumOfPos++;
286 if (PhtOutNumOfEl == 1 && PhtOutNumOfPos == 1 && NumOfPhtDaug == 2) PartOutCome =
Converted;
287 if ((NumOfPhtDaug > 1 && PhtOutNumOfNucFr != 0) || PhtOutNumOfHadr > 0) PartOutCome =
NuclInteraction;
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
ATLAS-specific HepMC functions.
std::pair< std::vector< unsigned int >, bool > res
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
ParticleOutCome defOutComeOfElectron(T thePart)
ParticleOutCome defOutComeOfPhoton(T thePart)
ParticleOrigin defJetOrig(const T &allJetMothers)
ParticleType defTypeOfPhoton(ParticleOrigin PhotOrig)
ParticleOrigin convHadronTypeToOrig(ParticleType pType, int motherPDG)
ParticleOutCome defOutComeOfTau(T thePart)
ParticleType defTypeOfTau(ParticleOrigin TauOrig)
ParticleType defTypeOfMuon(ParticleOrigin MuOrig, bool isPrompt)
ParticleOrigin defHadronType(int pdg)
ParticleType defTypeOfHadron(int pdg)
int isPrompt(const unsigned int classify, bool allow_prompt_tau_decays=true)
ParticleOutCome defOutComeOfMuon(T thePart)
ParticleType defTypeOfElectron(ParticleOrigin EleOrig, bool isPrompt)
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
bool isStrangeBaryon(const T &p)
bool isLightBaryon(const T &p)
bool isLightMeson(const T &p)
bool isStrangeMeson(const T &p)
bool isBottomMeson(const T &p)
bool isCharmBaryon(const T &p)
bool isCCbarMeson(const T &p)
bool isFromHadron(T p, U hadron, bool &fromTau, bool &fromBSM)
Function to classify the particle.
bool isBottomBaryon(const T &p)
bool isCharmMeson(const T &p)
bool isElectron(const T &p)
bool isBBbarMeson(const T &p)
auto findFinalStateParticles(V theVert) -> decltype(theVert->particles_out())
Function to find the stable particle descendants of the given vertex..
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do ...
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
bool isBeam(const T &p)
Identify if the particle is beam particle.
bool isHadron(const T &p)
auto findSimulatedEndVertex(T thePart) -> decltype(thePart->end_vertex())
Function to find the end vertex of a particle.
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.