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 75 of file Common.cxx.

82 {
84 std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> classification = classif->particleTruthClassifier(theParticle, &info);
85 particleOutCome = info.particleOutCome;
86 auto tpl = MCTruthPartClassifier::defOrigOfParticle(theParticle);
87 result = (unsigned int)std::get<0>(tpl);
88 hadron_pdg = std::get<1>(tpl)?std::get<1>(tpl)->pdg_id():0;
89 particleType = classification.first;
90 particleOrigin = classification.second;
91 }
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)

◆ fromTau()

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

Definition at line 56 of file Common.cxx.

57{
58 // Loop through parents
59 // Find a tau -> return true
60 // Find a hadron or parton -> return false
61 // This code, like the code before it, really assumes one incoming particle per vertex...
62 if (!part->production_vertex()) return false;
63 for (const auto& iter: part->production_vertex()->particles_in()){
64 int parent_pdgid = iter->pdg_id();
65 if ( MC::isTau( parent_pdgid ) ) return true;
66 if ( MC::isHadron( parent_pdgid ) || MC::isQuark( parent_pdgid ) ) return false;
67 if ( parent_pdgid == part->pdg_id() ) return fromTau( iter );
68 }
69 return false;
70}
static bool fromTau(const HepMC::ConstGenParticlePtr &part)
Definition Common.cxx:56
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)
bool isTau(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 for (const auto& iter: part->production_vertex()->particles_in()){
47 int parent_pdgid = iter->pdg_id();
48 if ( MC::isW(parent_pdgid) || MC::isZ(parent_pdgid) ) return true;
49 if ( MC::isHadron( parent_pdgid ) ) return false;
50 if ( MC::isQuark( parent_pdgid ) ) return true;
51 if ( parent_pdgid == part->pdg_id() ) return fromWZ( iter );
52 }
53 return false;
54}
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 72 of file Common.cxx.

72{ 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 }