1 #ifndef PhysicsTools_HepMCCandAlgos_GenParticlesHelper_h 2 #define PhysicsTools_HepMCCandAlgos_GenParticlesHelper_h 5 #include "HepPDT/ParticleID.hh" 10 #include <unordered_set> 185 template <
typename P>
194 template <
typename P>
196 return p.status() == 1 &&
isPrompt(p);
199 template <
typename P>
204 template <
typename P>
210 template <
typename P>
216 template <
typename P>
223 template <
typename P>
227 return tau && tau ==
dm;
231 template <
typename P>
235 return tau && tau == dm &&
isPrompt(*tau);
239 template <
typename P>
245 template <
typename P>
252 template <
typename P>
259 template <
typename P>
262 return heppdtid.isHadron();
266 template <
typename P>
273 if (p.status() > 20 && p.status() < 30)
280 if (p.status() == 1 || p.status() == 2) {
284 bool fromResonance = firstcopy && firstcopy->status() == 22;
287 bool fsrBranching = umNext && umNext->status() > 50 && umNext->status() < 60;
289 if (fromResonance && !fsrBranching)
298 template <
typename P>
304 template <
typename P>
310 template <
typename P>
316 template <
typename P>
323 template <
typename P>
330 template <
typename P>
343 if (hpc->status() == 21 && (&
p) == hpc)
361 template <
typename P>
367 template <
typename P>
373 template <
typename P>
379 template <
typename P>
382 std::unordered_set<const P *> dupCheck;
386 if (dupCheck.count(mo))
393 template <
typename P>
396 std::unordered_set<const P *> dupCheck;
398 dupCheck.insert(pcopy);
400 if (dupCheck.count(pcopy))
407 template <
typename P>
410 std::unordered_set<const P *> dupCheck;
412 dupCheck.insert(pcopy);
414 if (dupCheck.count(pcopy))
421 template <
typename P>
427 bool hasDaughterCopy =
true;
428 std::unordered_set<const P *> dupCheck;
429 while (hasDaughterCopy) {
430 dupCheck.insert(pcopy);
431 hasDaughterCopy =
false;
434 for (
unsigned int idau = 0; idau < ndau; ++idau) {
442 for (
unsigned int idau = 0; idau < ndau; ++idau) {
446 hasDaughterCopy =
true;
450 if (dupCheck.count(pcopy))
457 template <
typename P>
461 bool hasDaughterCopy =
true;
462 std::unordered_set<const P *> dupCheck;
463 while (hasDaughterCopy) {
464 dupCheck.insert(pcopy);
465 hasDaughterCopy =
false;
468 for (
unsigned int idau = 0; idau < ndau; ++idau) {
476 for (
unsigned int idau = 0; idau < ndau; ++idau) {
480 hasDaughterCopy =
true;
484 if (dupCheck.count(pcopy))
491 template <
typename P>
499 std::unordered_set<const P *> dupCheck;
501 dupCheck.insert(pcopy);
505 if (dupCheck.count(pcopy))
512 template <
typename P>
515 for (
unsigned int imoth = 0; imoth < nmoth; ++imoth) {
516 const P *moth =
mother(p, imoth);
526 template <
typename P>
529 for (
unsigned int idau = 0; idau < ndau; ++idau) {
540 template <
typename P>
543 std::unordered_set<const P *> dupCheck;
547 if (dupCheck.count(mo))
554 template <
typename P>
557 std::unordered_set<const P *> dupCheck;
561 if (dupCheck.count(mo))
568 template <
typename P>
574 template <
typename P>
580 template <
typename P>
586 template <
typename P>
592 template <
typename P>
598 template <
typename P>
600 return p.production_vertex() ? p.production_vertex()->particles_in_size() : 0;
604 template <
typename P>
610 template <
typename P>
612 return p.production_vertex() && p.production_vertex()->particles_in_size()
613 ? *(p.production_vertex()->particles_in_const_begin() + imoth)
618 template <
typename P>
624 template <
typename P>
626 return p.end_vertex() ? p.end_vertex()->particles_out_size() : 0;
630 template <
typename P>
636 template <
typename P>
638 return *(p.end_vertex()->particles_out_const_begin() + idau);
642 template <
typename P>
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