ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticle Class Reference

(HepMC) Monte Carlo particle. More...

#include <TruthParticle.h>

Inheritance diagram for TruthParticle:
Collaboration diagram for TruthParticle:

Public Types

typedef ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBaseTruthParticleImpl_t
typedef std::size_t evtIndex_t
typedef TruthParticleNavigation navigable_type
 publish the type of the base class (ie: 'traits-itize' it)
typedef TruthParticleMomentum momentum_type
 publish the type of the base class (ie: 'traits-itize' it)
typedef TruthParticleBase particle_type
 publish the type of the base class (ie: 'traits-itize' it)
typedef ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBaseself_type
 publish the type of the base class (ie: 'traits-itize' it)
enum  Kind

Public Member Functions

 TruthParticle ()
 Default constructor.
 TruthParticle (const TruthParticle &rhs)
 Copy constructor.
 TruthParticle (HepMC::ConstGenParticlePtr genParticle, const TruthParticleContainer *container=0)
 Constructor with parameters: construct a TruthParticle from a HepMC::GenParticle and the TruthParticleContainer holding this TruthParticle.
TruthParticleoperator= (const TruthParticle &rhs)
 Assignment operator.
 ~TruthParticle ()
 Default constructor:
HepMC::ConstGenParticlePtr genMother (const std::size_t i=0) const
 Retrieve the GenParticle mother of this TruthParticle.
HepMC::ConstGenParticlePtr genParticle () const
 Retrieve the GenParticle this TruthParticle has been made from (if any)
HepMC::ConstGenParticlePtr genChild (const std::size_t i) const
 Retrieve the i-th child (GenParticle) of this TruthParticle.
const TruthParticlemother (const std::size_t i=0) const
 Retrieve the i-th mother (TruthParticle) of this TruthParticle.
const TruthParticlechild (const std::size_t i) const
 Retrieve the i-th child (TruthParticle) of this TruthParticle.
bool hasMother (const int pdgId) const
 Return true if the given PDG::id to match can be found within the parents of this TruthParticle.
bool hasChild (const int pdgId) const
 Return true if the given PDG::id to match can be found within the children of this TruthParticle.
bool hasMother (const int pdgId, std::vector< unsigned int > &indices) const
 Return true if the given PDG::id to match can be found within the parents of this TruthParticle.
bool hasChild (const int pdgId, std::vector< unsigned int > &indices) const
 Return true if the given PDG::id to match can be found within the children of this TruthParticle.
bool hasEtIsol () const
 Return true if one has filled the Et isolation infos for this TruthParticle.
double etIsol (const TruthParticleParameters::ConeSize coneIdx) const
 Return the transverse energy in a given cone size of isolation.
const TruthEtIsolations::EtIsol_tetIsol () const
 Return the transverse energies for all the isolation cones.
unsigned int nParents () const
 Number of parents of this particle.
unsigned int nDecay () const
 Number of children of this particle.
CLHEP::HepLorentzVector transformVector (const HepMC::FourVector &) const
 returns a Pointer to a CLHEP::LorentzVector from a HepMC::FourVector
CLHEP::HepLorentzVector pDecay (const std::size_t i) const
 Return the 4-vec of i-th child of this particle.
int pdgDecay (const std::size_t i) const
 Return the PDG-Id of the i-th child of this particle.
 operator const HepMC::GenParticle & () const
 conversion operator: convert a TruthParticle to its underlying HepMC::GenParticle
evtIndex_t genEventIndex () const
void setCharge (const ChargeType charge)
 Set the charge of this TruthParticle.
void set4Mom (const HepMC::FourVector &hlv)
void setGenEventIndex (size_t index)
 set the GenEvent index
virtual void set4Mom (const I4Momentum &p4)
 set 4Momentum (will throw exception if cannot be implemented)
virtual void set4Mom (const I4Momentum *const p4)
 set 4Momentum (will throw exception if cannot be implemented)
virtual void set4Mom (const CLHEP::HepLorentzVector &hlv)
 set 4Momentum (will throw exception if cannot be implemented)
const navigable_typenavigableBase () const
 access to underlying base type (INavigable-like)
navigable_typenavigableBase ()
 access to underlying base type (INavigable-like)
const momentum_typemomentumBase () const
 access to underlying base type (I4Momentum-like)
momentum_typemomentumBase ()
 access to underlying base type (I4Momentum-like)
const particle_typeparticleBase () const
 access to underlying base type (IParticle-like)
particle_typeparticleBase ()
 access to underlying base type (IParticle-like)
virtual void set_dataType (ParticleDataType::DataType x)
virtual void set_charge (ChargeType x)
virtual void set_pdgId (int x)
virtual void set_origin (const VxContainer *theContainer, int index)
virtual void set_origin (const VxContainer *theContainer, const Trk::VxCandidate *vertex)
void set_origin (const ElementLink< VxContainer > &origin)
int status () const
 Forwards the HepMC::GenParticle::status() information.
const HepMC::Flow flow () const
 Forwards the HepMC::GenParticle::flow() information.
int flow (int code_index) const
 Forwards the HepMC::GenParticle::flow(idx) information.
const HepMC::Polarization polarization () const
 Forwards the HepMC::GenParticle::polarization() information.
int barcode () const
 Forwards the HepMC::GenParticle::barcode() information.
long compressedExtBarCode () const
 Forwards the HepMC::GenParticle::barcode() information.
virtual void fillToken (INavigationToken &thisToken) const
virtual void fillToken (INavigationToken &thisToken, const std::any &weight) const
AthenaBarCode_t getAthenaBarCode () const
void setAthenaBarCode (AthenaBarCode_t)
bool hasSameAthenaBarCode (const IAthenaBarCode &) const
bool hasSameAthenaBarCodeExceptVersion (const IAthenaBarCode &) const
AthenaBarCodeVersion_t getVersion () const
void newVersion ()
void setVersion (AthenaBarCodeVersion_t newversion)
virtual double px () const
 x component of momentum
virtual double py () const
 y component of momentum
virtual double pz () const
 z component of momentum
virtual double m () const
 mass
virtual double m2 () const
 mass squared
virtual double p () const
 mass momentum magnitude
virtual double p2 () const
 square of momentum magnitude
virtual double rapidity () const
 rapidity
virtual double eta () const
 pseudo rapidity
virtual double phi () const
 phi in [-pi,pi[
virtual double e () const
 energy
virtual double et () const
 transverse energy defined to be e*sin(theta)
virtual double pt () const
 transverse momentum
virtual double iPt () const
 inverse of transverse momentum
virtual double cosPhi () const
 cosinus phi
virtual double sinPhi () const
 sinus phi
virtual double tanTh () const
 tan theta
virtual double cosTh () const
 cosinus theta
virtual double sinTh () const
 sinus theta
virtual double cotTh () const
 cottan theta
virtual CLHEP::HepLorentzVector hlv () const
 CLHEP HepLorentzVector.
virtual const I4MomentumErrorerrors () const
 Access to errors, if available; returns 0 if no errors.
virtual I4Momentum::Kind kind () const
 add Kind which tells what kind (P4XYZ) the underlying implementation has
virtual std::ostream & dump (std::ostream &out) const
 Print I4Momentum content.
virtual ParticleDataType::DataType dataType () const
 Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the following values: {Data = 0, Full = 1, FastShower = 2, Fast = 3, True = 4}.
virtual const Trk::RecVertexorigin () const
 Return a RecVertex corresponding to particle Origin.
virtual const ElementLink< VxContainer > & originLink () const
 Return an ElementLink corresponding to particle's Origin.
virtual bool hasCharge () const
 method to check if charge information is available
virtual ChargeType charge () const
 returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed to an int and ask jets to extend this interface
virtual bool hasPdgId () const
 method to check if particle id information is available
virtual int pdgId () const
 Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg.h.

Static Public Attributes

static const AthenaBarCode_t UNDEFINEDBARCODE
static const AthenaBarCode_t UNDEFINEDVERSION

Protected Member Functions

void setGenParticle (HepMC::ConstGenParticlePtr particle)
 Fill the data members of ParticleBase from the GenParticle.

Protected Attributes

const TruthParticleContainerm_container
 Pointer to the collection holding ourself.
std::vector< int > m_mothers
 vector of barcodes of all the mothers of this particle.
std::vector< int > m_children
 vector of barcodes of all the children of this particle.
evtIndex_t m_nGenEventIdx
 the index of the GenEvent this particle is in

Private Attributes

TruthParticleNavigation m_nav
 The navigable part.
TruthParticleMomentum m_mom
 The 4-momentum part.
TruthParticleBase m_part
 The particle-id part.

Detailed Description

(HepMC) Monte Carlo particle.

Adds isolation information. Adapts the HepMC::GenParticle to the IParticle interface.

Definition at line 53 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

Member Typedef Documentation

◆ evtIndex_t

◆ momentum_type

publish the type of the base class (ie: 'traits-itize' it)

Definition at line 52 of file ParticleImpl.h.

◆ navigable_type

publish the type of the base class (ie: 'traits-itize' it)

Definition at line 48 of file ParticleImpl.h.

◆ particle_type

publish the type of the base class (ie: 'traits-itize' it)

Definition at line 56 of file ParticleImpl.h.

◆ self_type

publish the type of the base class (ie: 'traits-itize' it)

Definition at line 62 of file ParticleImpl.h.

◆ TruthParticleImpl_t

Member Enumeration Documentation

◆ Kind

Constructor & Destructor Documentation

◆ TruthParticle() [1/3]

TruthParticle::TruthParticle ( )

Default constructor.

Definition at line 33 of file TruthParticle.cxx.

33 :
34 INavigable ( ),
35 I4Momentum ( ),
36 INavigable4Momentum ( ),
38 m_container ( 0 ),
39 m_mothers ( 0 ),
40 m_children ( 0 ),
41 m_nGenEventIdx ( 0 )
42{}
std::vector< int > m_children
vector of barcodes of all the children of this particle.
std::vector< int > m_mothers
vector of barcodes of all the mothers of this particle.
ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase > TruthParticleImpl_t
const TruthParticleContainer * m_container
Pointer to the collection holding ourself.
evtIndex_t m_nGenEventIdx
the index of the GenEvent this particle is in

◆ TruthParticle() [2/3]

TruthParticle::TruthParticle ( const TruthParticle & rhs)

Copy constructor.

Definition at line 44 of file TruthParticle.cxx.

44 :
45 IAthenaBarCode ( rhs ),
46 INavigable ( rhs ),
47 I4Momentum ( rhs ),
48 INavigable4Momentum ( rhs ),
49 TruthParticleImpl_t ( rhs ),
51 m_mothers ( rhs.m_mothers ),
52 m_children ( rhs.m_children ),
54{}

◆ TruthParticle() [3/3]

TruthParticle::TruthParticle ( HepMC::ConstGenParticlePtr genParticle,
const TruthParticleContainer * container = 0 )

Constructor with parameters: construct a TruthParticle from a HepMC::GenParticle and the TruthParticleContainer holding this TruthParticle.

Definition at line 56 of file TruthParticle.cxx.

57 :
58 INavigable ( ),
59 I4Momentum ( ),
60 INavigable4Momentum ( ),
62 m_container ( container ),
63 m_mothers ( 0 ),
64 m_children ( 0 ),
65 m_nGenEventIdx ( 0 )
66{
67 setGenParticle( std::move(particle) );
68 m_nGenEventIdx = container ? container->genEventIdx() : 0;
69}
std::size_t genEventIdx() const
Retrieve the index (within a McEventCollection) of the HepMC::GenEvent this TruthParticleContainer is...
void setGenParticle(HepMC::ConstGenParticlePtr particle)
Fill the data members of ParticleBase from the GenParticle.

◆ ~TruthParticle()

TruthParticle::~TruthParticle ( )
inline

Member Function Documentation

◆ barcode()

int TruthParticle::barcode ( ) const
inline

Forwards the HepMC::GenParticle::barcode() information.

Definition at line 310 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

311{
312 return HepMC::barcode(genParticle());
313}
HepMC::ConstGenParticlePtr genParticle() const
Retrieve the GenParticle this TruthParticle has been made from (if any)
int barcode(const T *p)
Definition Barcode.h:16

◆ charge()

returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed to an int and ask jets to extend this interface

Implements IParticle.

◆ child()

const TruthParticle * TruthParticle::child ( const std::size_t i) const

Retrieve the i-th child (TruthParticle) of this TruthParticle.

Definition at line 98 of file TruthParticle.cxx.

99{
100 if ( m_children.empty() ||
101 i >= m_children.size() ||
102 nullptr == m_container ) return nullptr;
103 return m_container->truthParticle(m_children[i], m_nGenEventIdx);
104}

◆ compressedExtBarCode()

long TruthParticle::compressedExtBarCode ( ) const
inline

Forwards the HepMC::GenParticle::barcode() information.

Definition at line 144 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

144{ return 0; };

◆ cosPhi()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::cosPhi ( ) const
virtualinherited

cosinus phi

Implements I4Momentum.

◆ cosTh()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::cosTh ( ) const
virtualinherited

cosinus theta

Implements I4Momentum.

◆ cotTh()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::cotTh ( ) const
virtualinherited

cottan theta

Implements I4Momentum.

◆ dataType()

Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the following values: {Data = 0, Full = 1, FastShower = 2, Fast = 3, True = 4}.

IParticle interface forwarding

Implements IParticle.

◆ dump()

virtual std::ostream & ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::dump ( std::ostream & out) const
virtualinherited

Print I4Momentum content.

Implements I4Momentum.

◆ e()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::e ( ) const
virtualinherited

energy

Implements I4Momentum.

◆ errors()

virtual const I4MomentumError * ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::errors ( ) const
virtualinherited

Access to errors, if available; returns 0 if no errors.

Implements I4Momentum.

◆ et()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::et ( ) const
virtualinherited

transverse energy defined to be e*sin(theta)

Implements I4Momentum.

◆ eta()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::eta ( void ) const
virtualinherited

pseudo rapidity

Implements I4Momentum.

◆ etIsol() [1/2]

const TruthEtIsolations::EtIsol_t * TruthParticle::etIsol ( ) const

Return the transverse energies for all the isolation cones.

Definition at line 188 of file TruthParticle.cxx.

189{
190 return m_container->etIsolations( barcode() );
191}
int barcode() const
Forwards the HepMC::GenParticle::barcode() information.

◆ etIsol() [2/2]

double TruthParticle::etIsol ( const TruthParticleParameters::ConeSize coneIdx) const

Return the transverse energy in a given cone size of isolation.

Note that the size of the code must be one of the encoded sizes (see TruthParticleParamDefs.h file) and that the index is checked for out of bounds.

Definition at line 194 of file TruthParticle.cxx.

195{
196 if ( coneIdx >= 0 && // just to be sure... as it is a signed integer...
198 return m_container->etIsol( barcode(), coneIdx );
199 } else {
200 std::string error = "WRONG index for TruthParticle::etIsol(coneIdx)";
201 throw std::out_of_range(error);
202 }
203}

◆ fillToken() [1/2]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::fillToken ( INavigationToken & thisToken) const
virtualinherited

INavigable interface forwarding

Implements INavigable.

◆ fillToken() [2/2]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::fillToken ( INavigationToken & thisToken,
const std::any & weight ) const
virtualinherited

Implements INavigable.

◆ flow() [1/2]

const HepMC::Flow TruthParticle::flow ( ) const
inline

Forwards the HepMC::GenParticle::flow() information.

Definition at line 295 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

296{
297 return HepMC::flow(genParticle());
298}
int flow(const T &a, int i)
Definition Flow.h:51

◆ flow() [2/2]

int TruthParticle::flow ( int code_index) const
inline

Forwards the HepMC::GenParticle::flow(idx) information.

Definition at line 300 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

301{
302 return HepMC::flow(genParticle(),code_index);
303}

◆ genChild()

HepMC::ConstGenParticlePtr TruthParticle::genChild ( const std::size_t i) const

Retrieve the i-th child (GenParticle) of this TruthParticle.

Definition at line 118 of file TruthParticle.cxx.

119{
120 if ( i < m_children.size() ) {
121 auto child = this->child(i);
122 return child ? child->genParticle() : nullptr;
123 } else {
124 std::string error = "WRONG index for TruthParticle::genChild(index)";
125 throw std::out_of_range(error);
126 }
127}
const TruthParticle * child(const std::size_t i) const
Retrieve the i-th child (TruthParticle) of this TruthParticle.

◆ genEventIndex()

evtIndex_t TruthParticle::genEventIndex ( ) const
inline

◆ genMother()

HepMC::ConstGenParticlePtr TruthParticle::genMother ( const std::size_t i = 0) const

Retrieve the GenParticle mother of this TruthParticle.

Definition at line 107 of file TruthParticle.cxx.

108{
109 if ( i < m_mothers.size() ) {
110 auto mother = this->mother(i);
111 return mother ? mother->genParticle() : nullptr;
112 } else {
113 std::string error = "WRONG index for TruthParticle::genMother(index)";
114 throw std::out_of_range(error);
115 }
116}
const TruthParticle * mother(const std::size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.

◆ genParticle()

HepMC::ConstGenParticlePtr TruthParticle::genParticle ( ) const
inline

Retrieve the GenParticle this TruthParticle has been made from (if any)

Definition at line 285 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

286{
287 return this->particleBase().genParticle();
288}
HepMC::ConstGenParticlePtr genParticle() const
return the HepMC::GenParticle which is being proxied

◆ getAthenaBarCode()

IAthenaBarCode interface forwarding

Reimplemented from IAthenaBarCode.

◆ getVersion()

◆ hasCharge()

virtual bool ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::hasCharge ( ) const
virtualinherited

method to check if charge information is available

Implements IParticle.

◆ hasChild() [1/2]

bool TruthParticle::hasChild ( const int pdgId) const

Return true if the given PDG::id to match can be found within the children of this TruthParticle.

Definition at line 141 of file TruthParticle.cxx.

142{
143 const std::size_t nChildren = m_children.size();
144 for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) {
145 auto child = this->child(iChild);
146 if ( child && ( pdgId == child->pdgId() ) ) {
147 return true;
148 }
149 }
150 return false;
151}
virtual int pdgId() const =0
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....

◆ hasChild() [2/2]

bool TruthParticle::hasChild ( const int pdgId,
std::vector< unsigned int > & indices ) const

Return true if the given PDG::id to match can be found within the children of this TruthParticle.

It also fills the given vector with the indices toward the matching particles.

Definition at line 168 of file TruthParticle.cxx.

170{
171 bool found = false;
172 const std::size_t nChildren = m_children.size();
173 for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) {
174 auto child = this->child(iChild);
175 if ( child && ( pdgId == child->pdgId() ) ) {
176 found = true;
177 indices.push_back(iChild);
178 }
179 }
180 return found;
181}
std::pair< long int, long int > indices

◆ hasEtIsol()

bool TruthParticle::hasEtIsol ( ) const

Return true if one has filled the Et isolation infos for this TruthParticle.

Definition at line 183 of file TruthParticle.cxx.

184{
185 return m_container->hasEtIsol( barcode() );
186}

◆ hasMother() [1/2]

bool TruthParticle::hasMother ( const int pdgId) const

Return true if the given PDG::id to match can be found within the parents of this TruthParticle.

Definition at line 129 of file TruthParticle.cxx.

130{
131 const std::size_t nMothers = m_mothers.size();
132 for ( std::size_t iMother = 0; iMother != nMothers; ++iMother ) {
133 auto mother = this->mother(iMother);
134 if ( mother && ( pdgId == mother->pdgId() ) ) {
135 return true;
136 }
137 }
138 return false;
139}

◆ hasMother() [2/2]

bool TruthParticle::hasMother ( const int pdgId,
std::vector< unsigned int > & indices ) const

Return true if the given PDG::id to match can be found within the parents of this TruthParticle.

It also fills the given vector with the indices toward the matching particles.

Definition at line 153 of file TruthParticle.cxx.

155{
156 bool found = false;
157 const std::size_t nMothers = m_mothers.size();
158 for ( std::size_t iMother = 0; iMother != nMothers; ++iMother ) {
159 auto mother = this->mother(iMother);
160 if ( mother && ( pdgId == mother->pdgId() ) ) {
161 found = true;
162 indices.push_back(iMother);
163 }
164 }
165 return found;
166}

◆ hasPdgId()

virtual bool ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::hasPdgId ( ) const
virtualinherited

method to check if particle id information is available

Implements IParticle.

◆ hasSameAthenaBarCode()

bool ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::hasSameAthenaBarCode ( const IAthenaBarCode & ) const
virtualinherited

Reimplemented from IAthenaBarCode.

◆ hasSameAthenaBarCodeExceptVersion()

bool ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::hasSameAthenaBarCodeExceptVersion ( const IAthenaBarCode & ) const
virtualinherited

Reimplemented from IAthenaBarCode.

◆ hlv()

virtual CLHEP::HepLorentzVector ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::hlv ( ) const
virtualinherited

CLHEP HepLorentzVector.

Implements I4Momentum.

◆ iPt()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::iPt ( ) const
virtualinherited

inverse of transverse momentum

Implements I4Momentum.

◆ kind()

add Kind which tells what kind (P4XYZ) the underlying implementation has

Implements I4Momentum.

◆ m()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::m ( void ) const
virtualinherited

mass

Implements I4Momentum.

◆ m2()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::m2 ( ) const
virtualinherited

mass squared

Implements I4Momentum.

◆ momentumBase() [1/2]

access to underlying base type (I4Momentum-like)

◆ momentumBase() [2/2]

access to underlying base type (I4Momentum-like)

◆ mother()

const TruthParticle * TruthParticle::mother ( const std::size_t i = 0) const

Retrieve the i-th mother (TruthParticle) of this TruthParticle.

Definition at line 90 of file TruthParticle.cxx.

91{
92 if ( m_mothers.empty() ||
93 i >= m_mothers.size() ||
94 nullptr == m_container ) return nullptr;
95 return m_container->truthParticle(m_mothers[i], m_nGenEventIdx);
96}

◆ navigableBase() [1/2]

access to underlying base type (INavigable-like)

◆ navigableBase() [2/2]

access to underlying base type (INavigable-like)

◆ nDecay()

unsigned int TruthParticle::nDecay ( ) const
inline

Number of children of this particle.

Definition at line 325 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

326{ return m_children.size(); }

◆ newVersion()

Reimplemented from IAthenaBarCode.

◆ nParents()

unsigned int TruthParticle::nParents ( ) const
inline

Number of parents of this particle.

Definition at line 322 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

323{ return m_mothers.size(); }

◆ operator const HepMC::GenParticle &()

TruthParticle::operator const HepMC::GenParticle & ( ) const
inline

conversion operator: convert a TruthParticle to its underlying HepMC::GenParticle

Definition at line 334 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

335{
336 return *genParticle();
337}

◆ operator=()

TruthParticle & TruthParticle::operator= ( const TruthParticle & rhs)

Assignment operator.

Definition at line 71 of file TruthParticle.cxx.

72{
73 if ( this != &rhs ) {
74 INavigable::operator=(rhs);
75 I4Momentum::operator=(rhs);
76 INavigable4Momentum::operator=(rhs);
79 m_mothers = rhs.m_mothers;
82 }
83 return *this;
84}

◆ origin()

virtual const Trk::RecVertex * ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::origin ( ) const
virtualinherited

Return a RecVertex corresponding to particle Origin.

Implements IParticle.

◆ originLink()

virtual const ElementLink< VxContainer > & ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::originLink ( ) const
virtualinherited

Return an ElementLink corresponding to particle's Origin.

Implements IParticle.

◆ p()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::p ( ) const
virtualinherited

mass momentum magnitude

Implements I4Momentum.

◆ p2()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::p2 ( ) const
virtualinherited

square of momentum magnitude

Implements I4Momentum.

◆ particleBase() [1/2]

access to underlying base type (IParticle-like)

◆ particleBase() [2/2]

access to underlying base type (IParticle-like)

◆ pDecay()

CLHEP::HepLorentzVector TruthParticle::pDecay ( const std::size_t i) const

Return the 4-vec of i-th child of this particle.

Definition at line 205 of file TruthParticle.cxx.

206{
207 if ( i < m_children.size() ) {
208 auto child = this->child(i);
209 if ( child ) {
210 return child->hlv();
211 } else {
212 const std::string error = "Caught INVALID pointer to child in TruthParticle::pDecay call!";
213 throw std::out_of_range(error);
214 }
215 } else {
216 std::string error = "Caught INVALID pointer to child in TruthParticle::pDecay call!";
217 throw std::out_of_range(error);
218 }
219}

◆ pdgDecay()

int TruthParticle::pdgDecay ( const std::size_t i) const

Return the PDG-Id of the i-th child of this particle.

Definition at line 221 of file TruthParticle.cxx.

222{
223 if ( i < m_children.size() ) {
224 auto child = this->child(i);
225 if ( child ) {
226 return child->pdgId();
227 } else {
228 const std::string error = "Caught INVALID pointer to child in TruthParticle::pdgDecay call!";
229 throw std::out_of_range(error);
230 }
231 } else {
232 const std::string error = "Caught INVALID pointer to child in TruthParticle::pdgDecay call!";
233 throw std::out_of_range(error);
234 }
235}

◆ pdgId()

virtual int ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::pdgId ( ) const
virtualinherited

Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg.h.

Implements IParticle.

◆ phi()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::phi ( void ) const
virtualinherited

phi in [-pi,pi[

Implements I4Momentum.

◆ polarization()

const HepMC::Polarization TruthParticle::polarization ( ) const
inline

Forwards the HepMC::GenParticle::polarization() information.

Definition at line 305 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

306{
308}
Polarization polarization(const T &a)

◆ pt()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::pt ( void ) const
virtualinherited

transverse momentum

Implements I4Momentum.

◆ px()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::px ( ) const
virtualinherited

x component of momentum

I4Momentum interface forwarding

Implements I4Momentum.

◆ py()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::py ( ) const
virtualinherited

y component of momentum

Implements I4Momentum.

◆ pz()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::pz ( ) const
virtualinherited

z component of momentum

Implements I4Momentum.

◆ rapidity()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::rapidity ( ) const
virtualinherited

rapidity

Implements I4Momentum.

◆ set4Mom() [1/4]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set4Mom ( const CLHEP::HepLorentzVector & theHlv)
virtual

set 4Momentum (will throw exception if cannot be implemented)

Reimplemented from ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >.

◆ set4Mom() [2/4]

void TruthParticle::set4Mom ( const HepMC::FourVector & hlv)
inline

Definition at line 228 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

229 { this->momentumBase().set4Mom(hlv); }
virtual CLHEP::HepLorentzVector hlv() const =0
CLHEP HepLorentzVector.
virtual void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)

◆ set4Mom() [3/4]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set4Mom ( const I4Momentum & theI4Mom)
virtual

set 4Momentum (will throw exception if cannot be implemented)

Reimplemented from ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >.

◆ set4Mom() [4/4]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set4Mom ( const I4Momentum *const theI4Mom)
virtual

set 4Momentum (will throw exception if cannot be implemented)

Reimplemented from ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >.

◆ set_charge()

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set_charge ( ChargeType x)
virtualinherited

◆ set_dataType()

◆ set_origin() [1/3]

◆ set_origin() [2/3]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set_origin ( const VxContainer * theContainer,
const Trk::VxCandidate * vertex )
virtualinherited

◆ set_origin() [3/3]

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set_origin ( const VxContainer * theContainer,
int index )
virtualinherited

◆ set_pdgId()

virtual void ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::set_pdgId ( int x)
virtualinherited

◆ setAthenaBarCode()

Reimplemented from IAthenaBarCode.

◆ setCharge()

void TruthParticle::setCharge ( const ChargeType charge)
inline

Set the charge of this TruthParticle.

Definition at line 340 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

341{
342 this->particleBase().setCharge( charge );
343}
virtual ChargeType charge() const =0
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
void setCharge(const ChargeType charge)
Set the charge of this TruthParticleBase.

◆ setGenEventIndex()

void TruthParticle::setGenEventIndex ( size_t index)
inline

set the GenEvent index

Definition at line 351 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

351 {
353}
str index
Definition DeMoScan.py:362

◆ setGenParticle()

void TruthParticle::setGenParticle ( HepMC::ConstGenParticlePtr particle)
protected

Fill the data members of ParticleBase from the GenParticle.

Definition at line 240 of file TruthParticle.cxx.

241{
242 this->particleBase().setGenParticle( particle );
243
244 if ( particle ) {
245 this->set4Mom(particle->momentum());
246
247 // children
248 auto dcyVtx = particle->end_vertex();
249#ifdef HEPMC3
250 m_children.reserve( dcyVtx ? dcyVtx->particles_out().size() : 0 );
251
252 if ( dcyVtx ) {
253 for ( const auto& itr: dcyVtx->particles_out()) {
254 m_children.push_back( HepMC::barcode(itr) );
255 }//> end loop over outgoing particles
256 }//> decay vertex exists
257
258 // parents
259 auto prodVtx = particle->production_vertex();
260 m_mothers.reserve( prodVtx ? prodVtx->particles_in().size() : 0 );
261 if ( prodVtx ) {
262 for (const auto& itr: prodVtx->particles_in()) {
263 m_mothers.push_back( HepMC::barcode(itr) );
264 }//> end loop over ingoing particles
265 }//> production vertex exists
266#else
267
268 m_children.reserve( dcyVtx ? dcyVtx->particles_out_size() : 0 );
269
270 if ( dcyVtx ) {
271 for ( HepMC::GenVertex::particles_out_const_iterator itr =
272 dcyVtx->particles_out_const_begin();
273 itr != dcyVtx->particles_out_const_end();
274 ++itr ) {
275 m_children.push_back( (*itr)->barcode() );
276 }//> end loop over outgoing particles
277 }//> decay vertex exists
278
279 // parents
280 auto prodVtx = particle->production_vertex();
281 m_mothers.reserve( prodVtx ? prodVtx->particles_in_size() : 0 );
282 if ( prodVtx ) {
283 for ( HepMC::GenVertex::particles_in_const_iterator itr =
284 prodVtx->particles_in_const_begin();
285 itr != prodVtx->particles_in_const_end();
286 ++itr ) {
287 m_mothers.push_back( (*itr)->barcode() );
288 }//> end loop over ingoing particles
289 }//> production vertex exists
290
291#endif
292 } else {
293 m_mothers.resize( 0 );
294 m_children.resize( 0 );
295 }
296}
void setGenParticle(HepMC::ConstGenParticlePtr particle)
Fill the data members of ParticleBase from the GenParticle.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ setVersion()

Reimplemented from IAthenaBarCode.

◆ sinPhi()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::sinPhi ( ) const
virtualinherited

sinus phi

Implements I4Momentum.

◆ sinTh()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::sinTh ( ) const
virtualinherited

sinus theta

Implements I4Momentum.

◆ status()

int TruthParticle::status ( ) const
inline

Forwards the HepMC::GenParticle::status() information.

HepMC::GenParticle forwarding interface

Definition at line 290 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

291{
292 return genParticle()->status();
293}

◆ tanTh()

virtual double ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase >::tanTh ( ) const
virtualinherited

tan theta

Implements I4Momentum.

◆ transformVector()

CLHEP::HepLorentzVector TruthParticle::transformVector ( const HepMC::FourVector & fv) const
inline

returns a Pointer to a CLHEP::LorentzVector from a HepMC::FourVector

Definition at line 345 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

346{
347 CLHEP::HepLorentzVector hlv(fv.x(),fv.y(),fv.z(),fv.t());
348 return hlv;
349}

Member Data Documentation

◆ m_children

std::vector<int> TruthParticle::m_children
protected

vector of barcodes of all the children of this particle.

This will be forwarded to the container holding ourself to be able to retrieve TruthParticle pointers.

Definition at line 266 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

◆ m_container

const TruthParticleContainer* TruthParticle::m_container
protected

Pointer to the collection holding ourself.

Definition at line 254 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

◆ m_mom

The 4-momentum part.

Definition at line 310 of file ParticleImpl.h.

◆ m_mothers

std::vector<int> TruthParticle::m_mothers
protected

vector of barcodes of all the mothers of this particle.

This will be forwarded to the container holding ourself to be able to retrieve TruthParticle pointers.

Definition at line 260 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

◆ m_nav

The navigable part.

Definition at line 307 of file ParticleImpl.h.

◆ m_nGenEventIdx

evtIndex_t TruthParticle::m_nGenEventIdx
protected

the index of the GenEvent this particle is in

Definition at line 269 of file PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h.

◆ m_part

The particle-id part.

Definition at line 313 of file ParticleImpl.h.

◆ UNDEFINEDBARCODE

const AthenaBarCode_t IAthenaBarCode::UNDEFINEDBARCODE
staticinherited

Definition at line 52 of file AthenaKernel/AthenaKernel/IAthenaBarCode.h.

◆ UNDEFINEDVERSION

const AthenaBarCode_t IAthenaBarCode::UNDEFINEDVERSION
staticinherited

Definition at line 53 of file AthenaKernel/AthenaKernel/IAthenaBarCode.h.


The documentation for this class was generated from the following files: