ATLAS Offline Software
Loading...
Searching...
No Matches
Common Namespace Reference

Functions

bool prompt (const xAOD::TruthParticle *part, ToolHandle< IMCTruthClassifier > &m_classif)
bool fromWZorTau (const HepMC::ConstGenParticlePtr &part)
void classify (ToolHandle< IMCTruthClassifier > &m_classif, const xAOD::TruthParticle *theParticle, unsigned int &particleOutCome, unsigned int &result, int &hadron_pdg, unsigned int &particleType, unsigned int &particleOrigin)
static bool fromWZ (const HepMC::ConstGenParticlePtr &part)
static bool fromTau (const HepMC::ConstGenParticlePtr &part)

Function Documentation

◆ classify()

void Common::classify ( ToolHandle< IMCTruthClassifier > & m_classif,
const xAOD::TruthParticle * theParticle,
unsigned int & particleOutCome,
unsigned int & result,
int & hadron_pdg,
unsigned int & particleType,
unsigned int & particleOrigin )

Definition at line 96 of file Common.cxx.

103 {
105 std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> classification = classif->particleTruthClassifier(theParticle, &info);
106 particleOutCome = info.particleOutCome;
107 auto tpl = MCTruthPartClassifier::defOrigOfParticle(theParticle);
108 result = (unsigned int)std::get<0>(tpl);
109 hadron_pdg = std::get<1>(tpl)?std::get<1>(tpl)->pdg_id():0;
110 particleType = classification.first;
111 particleOrigin = classification.second;
112 }
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)

◆ fromTau()

bool Common::fromTau ( const HepMC::ConstGenParticlePtr & part)
static

Definition at line 67 of file Common.cxx.

68{
69 // Loop through parents
70 // Find a tau -> return true
71 // Find a hadron or parton -> return false
72 // This code, like the code before it, really assumes one incoming particle per vertex...
73 if (!part->production_vertex()) return false;
74#ifdef HEPMC3
75 for (const auto& iter: part->production_vertex()->particles_in()){
76 int parent_pdgid = iter->pdg_id();
77 if ( std::abs( parent_pdgid ) == 15 ) return true;
78 if (MC::isHadron( parent_pdgid ) || MC::isQuark( parent_pdgid ) ) return false;
79 if ( parent_pdgid == part->pdg_id() ) return fromTau( iter );
80 }
81#else
82 for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin();
83 iter!=part->production_vertex()->particles_in_const_end();++iter){
84 int parent_pdgid = (*iter)->pdg_id();
85 if ( std::abs( parent_pdgid ) == 15 ) return true;
86 if (MC::isHadron( parent_pdgid ) || MC::isQuark( parent_pdgid ) ) return false;
87 if ( parent_pdgid == part->pdg_id() ) return fromTau( *iter );
88 }
89#endif
90 return false;
91}
static bool fromTau(const HepMC::ConstGenParticlePtr &part)
Definition Common.cxx:67
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do ...
bool isHadron(const T &p)

◆ fromWZ()

bool Common::fromWZ ( const HepMC::ConstGenParticlePtr & part)
static

Definition at line 37 of file Common.cxx.

38{
39 // Loop through parents
40 // Hit a hadron -> return false
41 // Hit a parton -> return true
42 // This catch is important - we *cannot* look explicitly for the W or Z, because some
43 // generators do not include the W or Z in the truth record (like Sherpa)
44 // This code, like the code before it, really assumes one incoming particle per vertex...
45 if (!part->production_vertex()) return false;
46#ifdef HEPMC3
47 for (const auto& iter: part->production_vertex()->particles_in()){
48 int parent_pdgid = iter->pdg_id();
49 if (MC::isW(parent_pdgid) || MC::isZ(parent_pdgid)) return true;
50 if (MC::isHadron( parent_pdgid ) ) return false;
51 if ( std::abs( parent_pdgid ) < 9 ) return true;
52 if ( parent_pdgid == part->pdg_id() ) return fromWZ( iter );
53 }
54#else
55 for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin();
56 iter!=part->production_vertex()->particles_in_const_end();++iter){
57 int parent_pdgid = (*iter)->pdg_id();
58 if (MC::isW(parent_pdgid) || MC::isZ(parent_pdgid)) return true;
59 if (MC::isHadron( parent_pdgid ) ) return false;
60 if ( std::abs( parent_pdgid ) < 9 ) return true;
61 if ( parent_pdgid == part->pdg_id() ) return fromWZ( *iter );
62 }
63#endif
64 return false;
65}
static bool fromWZ(const HepMC::ConstGenParticlePtr &part)
Definition Common.cxx:37
bool isZ(const T &p)
bool isW(const T &p)

◆ fromWZorTau()

bool Common::fromWZorTau ( const HepMC::ConstGenParticlePtr & part)

Definition at line 93 of file Common.cxx.

93{ return fromWZ(part)||fromTau(part); }

◆ prompt()

bool Common::prompt ( const xAOD::TruthParticle * part,
ToolHandle< IMCTruthClassifier > & m_classif )

Definition at line 7 of file Common.cxx.

7 {
8 MCTruthPartClassifier::ParticleOrigin orig = classif->particleTruthClassifier( part ).second;
9
10 switch(orig) {
29 return false;
30 default:
31 break;
32 }
33 return true;
34 }