ATLAS Offline Software
Loading...
Searching...
No Matches
CP::PartonHistoryUtils Namespace Reference

Functions

const xAOD::TruthParticle & findAfterFSR (const xAOD::TruthParticle &particle)
 Return particle after FSR (before the decay vertex).
bool isChildOf (const xAOD::TruthParticle &parent, const xAOD::TruthParticle &potentialChild)
bool isBrokenTop (const xAOD::TruthParticle &particle)
 Looking for tops without children -> must be broken.
bool isAfterFSR (const xAOD::TruthParticle &particle)
 Determine whether particle is afterFSR.
bool hasParticleIdenticalParent (const xAOD::TruthParticle &particle)
 Return true when any parent of the particle has the same pdgId as the particle.
bool hasParentPdgId (const xAOD::TruthParticle &particle, int PdgId)
bool hasParentPdgId (const xAOD::TruthParticle &particle)
bool hasParentAbsPdgId (const xAOD::TruthParticle &particle, int absPdgId)
bool hasIdenticalChild (const xAOD::TruthParticle &particle)
bool isQuarkFromPDF (const xAOD::TruthParticle &particle)

Function Documentation

◆ findAfterFSR()

const xAOD::TruthParticle & CP::PartonHistoryUtils::findAfterFSR ( const xAOD::TruthParticle & particle)

Return particle after FSR (before the decay vertex).

Definition at line 102 of file PartonHistoryUtils.cxx.

102 {
103 // Follow the chain of identical children down to the last copy.
104 const xAOD::TruthParticle* current = &p;
105 while (const xAOD::TruthParticle* child = findIdenticalChild(*current))
106 current = child;
107 return *current;
108}
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ hasIdenticalChild()

bool CP::PartonHistoryUtils::hasIdenticalChild ( const xAOD::TruthParticle & particle)

Definition at line 47 of file PartonHistoryUtils.cxx.

47 {
48 // Checks if the given particle has at least one child with an identical PDG
49 // ID.
50 return findIdenticalChild(p) != nullptr;
51}

◆ hasParentAbsPdgId()

bool CP::PartonHistoryUtils::hasParentAbsPdgId ( const xAOD::TruthParticle & particle,
int absPdgId )

Definition at line 53 of file PartonHistoryUtils.cxx.

53 {
54 // No parent recorded, or a broken truth link to it, is treated as "no
55 // parent".
56 if (p.nParents() == 0)
57 return false;
58 const xAOD::TruthParticle* parent = p.parent(0);
59 // Checks if the parent of the given particle has a specific absolute PDG ID.
60 return parent && parent->absPdgId() == absPdgId;
61}

◆ hasParentPdgId() [1/2]

bool CP::PartonHistoryUtils::hasParentPdgId ( const xAOD::TruthParticle & particle)

Definition at line 42 of file PartonHistoryUtils.cxx.

42 {
43 // Checks if the parent of the given particle has a specific PDG ID.
44 return hasParentPdgId(p, p.pdgId());
45}
bool hasParentPdgId(const xAOD::TruthParticle &particle, int PdgId)

◆ hasParentPdgId() [2/2]

bool CP::PartonHistoryUtils::hasParentPdgId ( const xAOD::TruthParticle & particle,
int PdgId )

Definition at line 32 of file PartonHistoryUtils.cxx.

32 {
33 // No parent recorded, or a broken truth link to it, is treated as "no
34 // parent".
35 if (p.nParents() == 0)
36 return false;
37 const xAOD::TruthParticle* parent = p.parent(0);
38 // Checks if the parent of the given particle has a specific PDG ID.
39 return parent && parent->pdgId() == pdgId;
40}

◆ hasParticleIdenticalParent()

bool CP::PartonHistoryUtils::hasParticleIdenticalParent ( const xAOD::TruthParticle & particle)

Return true when any parent of the particle has the same pdgId as the particle.

A broken parent truth link within nParents() is treated as "not identical".

Definition at line 63 of file PartonHistoryUtils.cxx.

63 {
64 // Checks if particle and any of its parents are identical. A broken
65 // parent truth link is treated as "not identical".
66 for (size_t i = 0; i < p.nParents(); i++) {
67 const xAOD::TruthParticle* parent = p.parent(i);
68 if (parent && parent->pdgId() == p.pdgId())
69 return true;
70 } // for
71 return false;
72}

◆ isAfterFSR()

bool CP::PartonHistoryUtils::isAfterFSR ( const xAOD::TruthParticle & particle)

Determine whether particle is afterFSR.

Definition at line 98 of file PartonHistoryUtils.cxx.

98 {
99 return !hasIdenticalChild(p);
100}
bool hasIdenticalChild(const xAOD::TruthParticle &particle)

◆ isBrokenTop()

bool CP::PartonHistoryUtils::isBrokenTop ( const xAOD::TruthParticle & particle)

Looking for tops without children -> must be broken.

Definition at line 114 of file PartonHistoryUtils.cxx.

114 {
115 // check if particle is a top without children.
116 return (p.absPdgId() == 6 && p.nChildren() == 0);
117}

◆ isChildOf()

bool CP::PartonHistoryUtils::isChildOf ( const xAOD::TruthParticle & parent,
const xAOD::TruthParticle & potentialChild )

Definition at line 74 of file PartonHistoryUtils.cxx.

75 {
76 // Checks if child is child of parent.
77 if (parent.uid() == child.uid()) {
78 return true;
79 }
80 // Loop through all children of the parent
81 for (size_t i = 0; i < parent.nChildren(); ++i) {
82 const xAOD::TruthParticle* c = parent.child(i);
83 // A broken child truth link is treated as "not this child" and skipped.
84 // Recursively check if child is a child of the current child
85 if (c && isChildOf(*c, child)) {
86 return true;
87 }
88 }
89 // If child is not found in the children or their descendants, return
90 // false
91 return false;
92}
bool isChildOf(const xAOD::TruthParticle &parent, const xAOD::TruthParticle &potentialChild)

◆ isQuarkFromPDF()

bool CP::PartonHistoryUtils::isQuarkFromPDF ( const xAOD::TruthParticle & particle)

Definition at line 119 of file PartonHistoryUtils.cxx.

119 {
120 // In principle we could use some status codes here, e.g. 31/41/42/53/61 for
121 // Pythia 8. But that is not guaranteed to be compatible across generators,
122 // so instead we just check if it's a massless quark.
123 bool isQuark = 1 <= particle.absPdgId() && particle.absPdgId() <= 5;
124 bool isMassless = particle.m() == 0;
125 return isQuark && isMassless;
126}
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do ...
Definition AtlasPID.h:173