4#ifndef TRUTHUTILS_TRUTHCLASSIFIERS_H
5#define TRUTHUTILS_TRUTHCLASSIFIERS_H
133 for (
const auto& it: allJetMothers) {
134 int pdg = abs(it->pdg_id());
140 if (pdg == 35 || pdg == 36 || pdg == 37)
return HiggsMSSM;
141 if (pdg == 32 || pdg == 33 || pdg == 34)
return HeavyBoson;
142 if (pdg == 42)
return LQ;
153 T parent_hadron_ptr =
nullptr;
155 bool uncat = 0, fromHad = 0, fromTau = 0;
159 bool fromBSM =
isBSM;
161 auto prodVtx = thePart->production_vertex();
162 if (isPhysical && prodVtx && !isGeant) {
167 std::bitset<MCTC_bits::totalBits> classifier;
176 unsigned int outputvalue =
static_cast<unsigned int>(classifier.to_ulong());
178 return std::make_tuple(outputvalue,parent_hadron_ptr);
180 inline int isPrompt(
const unsigned int classify,
bool allow_prompt_tau_decays =
true) {
181 std::bitset<MCTC_bits::totalBits>
res(classify);
184 if (fromPromptTau)
return int(allow_prompt_tau_decays);
194 int ElecOutNumOfNucFr(0);
195 int ElecOutNumOfElec(0);
197 auto outgoing = EndVert->particles_out();
198 int NumOfElecDaug = outgoing.size();
199 for (
const auto& p: outgoing) {
201 int EndDaugType = p->pdg_id();
204 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) ElecOutNumOfNucFr++;
207 if (ElecOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome =
NuclInteraction;
208 if (ElecOutNumOfElec == 1 && NumOfElecDaug == 1) PartOutCome =
ElectrMagInter;
217 int MuOutNumOfNucFr(0);
219 int NumOfEleNeutr(0);
220 int NumOfMuonNeutr(0);
222 auto outgoing = EndVert->particles_out();
223 int NumOfMuDaug = outgoing.size();
224 for (
const auto& p: outgoing) {
226 int EndDaugType = p->pdg_id();
228 if (abs(EndDaugType) == 12) NumOfEleNeutr++;
229 if (abs(EndDaugType) == 14) NumOfMuonNeutr++;
231 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) MuOutNumOfNucFr++;
234 if (MuOutNumOfNucFr != 0 || NumOfHadr != 0) PartOutCome =
NuclInteraction;
235 if (NumOfMuDaug == 3 && NumOfElec == 1 && NumOfEleNeutr == 1 && NumOfMuonNeutr == 1) PartOutCome =
DecaytoElectron;
244 int NumOfTauDaug = EndVert->nOutgoingParticles();
246 auto PD = DecayProducts(tauFinalStatePart);
247 int NumOfElec =
PD.apd(11);
248 int NumOfMuon =
PD.apd(13);
249 int NumOfElecNeut =
PD.apd(12);
250 int NumOfMuonNeut =
PD.apd(14);
251 int NumOfPhot =
PD.apd(22);
252 int NumOfPi =
PD.apd(211);
253 int NumOfKaon =
PD.apd(321);
254 int NumOfNucFr =
PD.apd(0) +
PD.apd(1000000000, std::numeric_limits<int>::max());
257 if ((NumOfTauDaug == 3 && NumOfElec == 1 && NumOfElecNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfElecNeut == 1)) PartOutCome =
DecaytoElectron;
258 if ((NumOfTauDaug == 3 && NumOfMuon == 1 && NumOfMuonNeut == 1) || (NumOfTauDaug == (3 + NumOfPhot) && NumOfMuonNeut == 1)) PartOutCome =
DecaytoMuon;
260 if (NumOfPi == 1 || NumOfKaon == 1) PartOutCome =
OneProng;
261 if (NumOfPi + NumOfKaon == 3) PartOutCome =
ThreeProng;
262 if (NumOfPi + NumOfKaon == 5) PartOutCome =
FiveProng;
273 int PhtOutNumOfNucFr(0);
274 int PhtOutNumOfEl(0);
275 int PhtOutNumOfPos(0);
276 int PhtOutNumOfHadr(0);
278 auto outgoing = EndVert->particles_out();
279 int NumOfPhtDaug = outgoing.size();
280 for (
const auto& p: outgoing) {
282 int EndDaugType = p->pdg_id();
283 if (EndDaugType > 1000000000 || EndDaugType == 0 || abs(EndDaugType) == 2212 || abs(EndDaugType) == 2112) PhtOutNumOfNucFr++;
284 if (EndDaugType == 11) PhtOutNumOfEl++;
285 if (EndDaugType == -11) PhtOutNumOfPos++;
289 if (PhtOutNumOfEl == 1 && PhtOutNumOfPos == 1 && NumOfPhtDaug == 2) PartOutCome =
Converted;
290 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 isBottomBaryon(const T &p)
bool isCharmMeson(const T &p)
bool isElectron(const T &p)
bool isBBbarMeson(const T &p)
bool isFromHadron(T p, T hadron, bool &fromTau, bool &fromBSM)
Function to classify the particle.
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.