1 #ifndef PhysicsTools_HepMCCandAlgos_GenParticlesHelper_h 2 #define PhysicsTools_HepMCCandAlgos_GenParticlesHelper_h 5 #include "HepPDT/ParticleID.hh" 11 #include <unordered_set> 201 return p.status()==1 &&
isPrompt(p);
232 return tau && tau==
dm;
240 return tau && tau==dm &&
isPrompt(*tau);
267 return heppdtid.isHadron();
275 if (p.status()==3)
return true;
278 if (p.status()>20 && p.status()<30)
return true;
284 if (p.status()==1 || p.status()==2) {
288 bool fromResonance = firstcopy && firstcopy->status()==22;
291 bool fsrBranching = umNext && umNext->status()>50 && umNext->status()<60;
293 if (fromResonance && !fsrBranching)
return true;
337 if (p.status()==3)
return true;
341 if (!hpc)
return false;
345 if (hpc->status()==21 && (&
p)==hpc)
return true;
348 if (hpc->status()==22 &&
isLastCopy(p))
return true;
383 std::unordered_set<const P*> dupCheck;
387 if (dupCheck.count(mo))
return nullptr;
396 std::unordered_set<const P*> dupCheck;
398 dupCheck.insert(pcopy);
400 if (dupCheck.count(pcopy))
return nullptr;
409 std::unordered_set<const P*> dupCheck;
411 dupCheck.insert(pcopy);
413 if (dupCheck.count(pcopy))
return nullptr;
423 if (!pcopy)
return nullptr;
424 bool hasDaughterCopy =
true;
425 std::unordered_set<const P*> dupCheck;
426 while (hasDaughterCopy) {
427 dupCheck.insert(pcopy);
428 hasDaughterCopy =
false;
431 for (
unsigned int idau = 0; idau<ndau; ++idau) {
439 for (
unsigned int idau = 0; idau<ndau; ++idau) {
443 hasDaughterCopy =
true;
447 if (dupCheck.count(pcopy))
return nullptr;
457 bool hasDaughterCopy =
true;
458 std::unordered_set<const P*> dupCheck;
459 while (hasDaughterCopy) {
460 dupCheck.insert(pcopy);
461 hasDaughterCopy =
false;
464 for (
unsigned int idau = 0; idau<ndau; ++idau) {
472 for (
unsigned int idau = 0; idau<ndau; ++idau) {
476 hasDaughterCopy =
true;
480 if (dupCheck.count(pcopy))
return nullptr;
493 std::unordered_set<const P*> dupCheck;
495 dupCheck.insert(pcopy);
498 if (dupCheck.count(pcopy))
break;
508 for (
unsigned int imoth = 0; imoth<nmoth; ++imoth) {
509 const P *moth =
mother(p,imoth);
523 for (
unsigned int idau = 0; idau<ndau; ++idau) {
537 std::unordered_set<const P*> dupCheck;
541 if (dupCheck.count(mo))
return nullptr;
550 std::unordered_set<const P*> dupCheck;
554 if (dupCheck.count(mo))
return nullptr;
592 return p.production_vertex() ? p.production_vertex()->particles_in_size() : 0;
604 return p.production_vertex() && p.production_vertex()->particles_in_size() ? *(p.production_vertex()->particles_in_const_begin() + imoth) :
nullptr;
616 return p.end_vertex() ? p.end_vertex()->particles_out_size() : 0;
628 return *(p.end_vertex()->particles_out_const_begin() + idau);
const P * uniqueMother(const P &p) const
bool isPromptDecayed(const P &p) const
bool isDirectHardProcessTauDecayProduct(const P &p) const
int pdgId() const final
PDG identifier.
const P * previousCopy(const P &p) const
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
bool isTauDecayProduct(const P &p) const
bool isLastCopy(const P &p) const
const P * nextCopy(const P &p) const
bool isPromptFinalState(const P &p) const
int absPdgId(const reco::GenParticle &p) const
bool isDecayedLeptonHadron(const P &p) const
bool fromHardProcessDecayed(const P &p) const
size_t numberOfMothers() const override
number of mothers
bool isPrompt(const P &p) const
bool isLastCopyBeforeFSR(const P &p) const
bool isDirectPromptTauDecayProduct(const P &p) const
void setIsLastCopyBeforeFSR(bool b)
bool fromHardProcessFinalState(const P &p) const
void setIsTauDecayProduct(bool b)
void setIsDirectPromptTauDecayProduct(bool b)
bool isHardProcess(const P &p) const
void fillGenStatusFlags(const P &p, reco::GenStatusFlags &statusFlags) const
void setIsDirectHadronDecayProduct(bool b)
void setIsDirectHardProcessTauDecayProduct(bool b)
void setIsHardProcess(bool b)
unsigned int numberOfMothers(const reco::GenParticle &p) const
const P * hardProcessMotherCopy(const P &p) const
const P * lastDaughterCopyBeforeFSR(const P &p) const
Abs< T >::type abs(const T &t)
void setIsHardProcessTauDecayProduct(bool b)
bool isFirstCopy(const P &p) const
bool isMuonDecayProduct(const P &p) const
bool fromHardProcess(const P &p) const
const reco::GenParticle * mother(const reco::GenParticle &p, unsigned int imoth=0) const
unsigned int numberOfDaughters(const reco::GenParticle &p) const
bool fromHardProcessBeforeFSR(const P &p) const
void setFromHardProcess(bool b)
bool isPromptTauDecayProduct(const P &p) const
bool isPromptMuonDecayProduct(const P &p) const
bool isHardProcessTauDecayProduct(const P &p) const
int pdgId(const reco::GenParticle &p) const
const P * lastCopyBeforeFSR(const P &p) const
void setIsPromptTauDecayProduct(bool b)
void setIsDecayedLeptonHadron(bool b)
bool isHadron(const P &p) const
void setIsFirstCopy(bool b)
size_t numberOfDaughters() const override
number of daughters
std::pair< OmniClusterRef, TrackingParticleRef > P
bool isDirectTauDecayProduct(const P &p) const
const P * findDecayedMother(const P &p) const
void setIsDirectTauDecayProduct(bool b)
void setFromHardProcessBeforeFSR(bool b)
const P * lastCopy(const P &p) const
bool isDirectHadronDecayProduct(const P &p) const
void setIsLastCopy(bool b)
const P * firstCopy(const P &p) const
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
const reco::GenParticle * daughter(const reco::GenParticle &p, unsigned int idau) const