ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::TruthVertex_v1 Class Reference

Class describing a truth vertex in the MC record. More...

#include <TruthVertex_v1.h>

Inheritance diagram for xAOD::TruthVertex_v1:
Collaboration diagram for xAOD::TruthVertex_v1:

Public Member Functions

 TruthVertex_v1 ()
 Default constructor.
Type::ObjectType type () const
 The type of the object as a simple enumeration.
void toPersistent ()
 Function making sure that the object is ready for persistification.
Functions identifying the vertex in the MC record
int status () const
 Get the vertex status.
void setStatus (int value)
 Set the vertex status.
int uid () const
 Get the vertex unique ID.
void setUid (int value)
 Set the vertex unique ID.

Links to the particles associated with this vertex

typedef ElementLink< TruthParticleContainerTPLink_t
 Type of one truth particle link.
typedef std::vector< TPLink_tTPLinks_t
 Type used to save the links to incoming and outgoing particles.
const TPLinks_tincomingParticleLinks () const
 Get all the incoming particles.
void setIncomingParticleLinks (const TPLinks_t &links)
 Set all the incoming particles.
size_t nIncomingParticles () const
 Get the number of incoming particles.
const TruthParticle_v1incomingParticle (size_t index) const
 Get one of the incoming particles.
void addIncomingParticleLink (const TPLink_t &link)
 Add one incoming particle.
void clearIncomingParticleLinks ()
 Remove all incoming particles.
const TPLinks_toutgoingParticleLinks () const
 Get all the outgoing particles.
void setOutgoingParticleLinks (const TPLinks_t &links)
 Set all the outgoing particles.
size_t nOutgoingParticles () const
 Get the number of outgoing particles.
const TruthParticle_v1outgoingParticle (size_t index) const
 Get one of the outgoing particles.
std::vector< const TruthParticle * > particles_in () const
 Get the incoming particles.
std::vector< const TruthParticle * > particles_out () const
 Get the outgoing particles.
void addOutgoingParticleLink (const TPLink_t &link)
 Add one outgoing particle.
void clearOutgoingParticleLinks ()
 Remove all outgoing particles.

Vertex position functions

typedef TLorentzVector FourVec_t
 The 4-vector type.
typedef ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourVec_t
 Base 4 Momentum type for TruthVector.
float x () const
 Vertex x displacement.
void setX (float value)
 Set the x displacement of the vertex.
float y () const
 Vertex y displacement.
void setY (float value)
 Set the y displacement of the vertex.
float z () const
 Vertex longitudinal distance along the beam line form the origin.
void setZ (float value)
 Set the vertex's longitudinal distance from the origin.
float perp () const
 Vertex transverse distance from the beam line.
float eta () const
 Vertex pseudorapidity.
float phi () const
 Vertex azimuthal angle.
float t () const
 Vertex time.
void setT (float value)
 Set the vertex time.
FourVec_t v4 () const
 The full 4-vector of the vertex.
GenVecFourVec_t genvecV4 () const
 The full 4-vector of the particle : GenVector form.

Detailed Description

Class describing a truth vertex in the MC record.

The xAOD truth record mimicks the structure of HepMC. Truth particles and truth vertices form a decay tree. Where each truth particle is connected to a single production and decay vertex. And each vertex is connected to one or more incoming, and one or more outgoing particles.

Author
Andy Buckley Andy..nosp@m.Buck.nosp@m.ley@c.nosp@m.ern..nosp@m.ch

Definition at line 37 of file TruthVertex_v1.h.

Member Typedef Documentation

◆ FourVec_t

typedef TLorentzVector xAOD::TruthVertex_v1::FourVec_t

The 4-vector type.

Definition at line 129 of file TruthVertex_v1.h.

◆ GenVecFourVec_t

typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > xAOD::TruthVertex_v1::GenVecFourVec_t

Base 4 Momentum type for TruthVector.

Definition at line 135 of file TruthVertex_v1.h.

◆ TPLink_t

Type of one truth particle link.

Definition at line 62 of file TruthVertex_v1.h.

◆ TPLinks_t

typedef std::vector< TPLink_t > xAOD::TruthVertex_v1::TPLinks_t

Type used to save the links to incoming and outgoing particles.

Definition at line 64 of file TruthVertex_v1.h.

Constructor & Destructor Documentation

◆ TruthVertex_v1()

xAOD::TruthVertex_v1::TruthVertex_v1 ( )

Default constructor.

Definition at line 17 of file TruthVertex_v1.cxx.

18 : SG::AuxElement() {
19
20 }
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.

Member Function Documentation

◆ addIncomingParticleLink()

void xAOD::TruthVertex_v1::addIncomingParticleLink ( const TPLink_t & link)

Add one incoming particle.

Definition at line 88 of file TruthVertex_v1.cxx.

88 {
89
90 incomingParticleLinksAcc( *this ).push_back( link );
91 return;
92 }

◆ addOutgoingParticleLink()

void xAOD::TruthVertex_v1::addOutgoingParticleLink ( const TPLink_t & link)

Add one outgoing particle.

Definition at line 138 of file TruthVertex_v1.cxx.

138 {
139
140 outgoingParticleLinksAcc( *this ).push_back( link );
141 return;
142 }

◆ clearIncomingParticleLinks()

void xAOD::TruthVertex_v1::clearIncomingParticleLinks ( )

Remove all incoming particles.

Definition at line 94 of file TruthVertex_v1.cxx.

94 {
95
96 incomingParticleLinksAcc( *this ).clear();
97 return;
98 }

◆ clearOutgoingParticleLinks()

void xAOD::TruthVertex_v1::clearOutgoingParticleLinks ( )

Remove all outgoing particles.

Definition at line 144 of file TruthVertex_v1.cxx.

144 {
145
146 outgoingParticleLinksAcc( *this ).clear();
147 return;
148 }

◆ eta()

float xAOD::TruthVertex_v1::eta ( ) const

Vertex pseudorapidity.

Definition at line 171 of file TruthVertex_v1.cxx.

171 {
172
173 // This is not necessarily what Andy was thinking about...
174 return genvecV4().Eta();
175 }
GenVecFourVec_t genvecV4() const
The full 4-vector of the particle : GenVector form.

◆ genvecV4()

TruthVertex_v1::GenVecFourVec_t xAOD::TruthVertex_v1::genvecV4 ( ) const

The full 4-vector of the particle : GenVector form.

Definition at line 189 of file TruthVertex_v1.cxx.

189 {
190 return GenVecFourVec_t(x(), y(), z(), t());
191 }
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float t() const
Vertex time.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourVec_t
Base 4 Momentum type for TruthVector.
float x() const
Vertex x displacement.

◆ incomingParticle()

const TruthParticle * xAOD::TruthVertex_v1::incomingParticle ( size_t index) const

Get one of the incoming particles.

Definition at line 70 of file TruthVertex_v1.cxx.

70 {
71
72 // Check that the variable exists, and that it has enough elements in it:
73 if( ( ! incomingParticleLinksAcc.isAvailable( *this ) ) ||
74 ( incomingParticleLinksAcc( *this ).size() <= index ) ) {
75 return nullptr;
76 }
77
78 // Retrieve the link object and check its validity:
79 const TPLink_t& ipl = incomingParticleLinksAcc( *this )[ index ];
80 if( ! ipl.isValid() ) {
81 return nullptr;
82 }
83
84 // Finally, de-reference the link:
85 return *ipl;
86 }
ElementLink< TruthParticleContainer > TPLink_t
Type of one truth particle link.
str index
Definition DeMoScan.py:362

◆ incomingParticleLinks()

const TPLinks_t & xAOD::TruthVertex_v1::incomingParticleLinks ( ) const

Get all the incoming particles.

◆ nIncomingParticles()

size_t xAOD::TruthVertex_v1::nIncomingParticles ( ) const

Get the number of incoming particles.

◆ nOutgoingParticles()

size_t xAOD::TruthVertex_v1::nOutgoingParticles ( ) const

Get the number of outgoing particles.

◆ outgoingParticle()

const TruthParticle * xAOD::TruthVertex_v1::outgoingParticle ( size_t index) const

Get one of the outgoing particles.

Definition at line 120 of file TruthVertex_v1.cxx.

120 {
121
122 // Check that the variable exists, and that it has enough elements in it:
123 if( ( ! outgoingParticleLinksAcc.isAvailable( *this ) ) ||
124 ( outgoingParticleLinksAcc( *this ).size() <= index ) ) {
125 return nullptr;
126 }
127
128 // Retrieve the link object and check its validity:
129 const TPLink_t& opl = outgoingParticleLinksAcc( *this )[ index ];
130 if( ! opl.isValid() ) {
131 return nullptr;
132 }
133
134 // Finally, de-reference the link:
135 return *opl;
136 }

◆ outgoingParticleLinks()

const TPLinks_t & xAOD::TruthVertex_v1::outgoingParticleLinks ( ) const

Get all the outgoing particles.

◆ particles_in()

std::vector< const TruthParticle * > xAOD::TruthVertex_v1::particles_in ( ) const

Get the incoming particles.

Definition at line 60 of file TruthVertex_v1.cxx.

60 {
61 std::vector<const TruthParticle*> res;
62 for (size_t i=0; i<nIncomingParticles();i++) res.push_back(incomingParticle(i));
63 return res;
64 }
std::pair< std::vector< unsigned int >, bool > res
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
size_t nIncomingParticles() const
Get the number of incoming particles.

◆ particles_out()

std::vector< const TruthParticle * > xAOD::TruthVertex_v1::particles_out ( ) const

Get the outgoing particles.

Definition at line 65 of file TruthVertex_v1.cxx.

65 {
66 std::vector<const TruthParticle*> res;
67 for (size_t i=0; i<nOutgoingParticles();i++) res.push_back(outgoingParticle(i));
68 return res;
69 }
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
size_t nOutgoingParticles() const
Get the number of outgoing particles.

◆ perp()

float xAOD::TruthVertex_v1::perp ( ) const

Vertex transverse distance from the beam line.

Definition at line 164 of file TruthVertex_v1.cxx.

164 {
165
166 // Do the calculation by hand. Could make it faster than this even in a
167 // future iteration...
168 return std::sqrt( x() * x() + y() * y() );
169 }

◆ phi()

float xAOD::TruthVertex_v1::phi ( ) const

Vertex azimuthal angle.

Definition at line 177 of file TruthVertex_v1.cxx.

177 {
178
179 // This is not necessarily what Andy was thinking about...
180 return genvecV4().Phi();
181 }

◆ setIncomingParticleLinks()

void xAOD::TruthVertex_v1::setIncomingParticleLinks ( const TPLinks_t & links)

Set all the incoming particles.

◆ setOutgoingParticleLinks()

void xAOD::TruthVertex_v1::setOutgoingParticleLinks ( const TPLinks_t & links)

Set all the outgoing particles.

◆ setStatus()

void xAOD::TruthVertex_v1::setStatus ( int value)

Set the vertex status.

◆ setT()

void xAOD::TruthVertex_v1::setT ( float value)

Set the vertex time.

◆ setUid()

void xAOD::TruthVertex_v1::setUid ( int value)

Set the vertex unique ID.

◆ setX()

void xAOD::TruthVertex_v1::setX ( float value)

Set the x displacement of the vertex.

◆ setY()

void xAOD::TruthVertex_v1::setY ( float value)

Set the y displacement of the vertex.

◆ setZ()

void xAOD::TruthVertex_v1::setZ ( float value)

Set the vertex's longitudinal distance from the origin.

◆ status()

int xAOD::TruthVertex_v1::status ( ) const

Get the vertex status.

◆ t()

float xAOD::TruthVertex_v1::t ( ) const

Vertex time.

◆ toPersistent()

void xAOD::TruthVertex_v1::toPersistent ( )

Function making sure that the object is ready for persistification.

Definition at line 201 of file TruthVertex_v1.cxx.

201 {
202
203 // Prepare the incoming particle links for persistification:
204 if( incomingParticleLinksAcc.isAvailableWritable( *this ) ) {
205 TPLinks_t::iterator itr = incomingParticleLinksAcc( *this ).begin();
206 TPLinks_t::iterator end = incomingParticleLinksAcc( *this ).end();
207 for( ; itr != end; ++itr ) {
208 itr->toPersistent();
209 }
210 }
211
212 // Prepare the outgoing particle links for persistification:
213 if( outgoingParticleLinksAcc.isAvailableWritable( *this ) ) {
214 TPLinks_t::iterator itr = outgoingParticleLinksAcc( *this ).begin();
215 TPLinks_t::iterator end = outgoingParticleLinksAcc( *this ).end();
216 for( ; itr != end; ++itr ) {
217 itr->toPersistent();
218 }
219 }
220
221 return;
222 }

◆ type()

Type::ObjectType xAOD::TruthVertex_v1::type ( ) const

The type of the object as a simple enumeration.

Definition at line 196 of file TruthVertex_v1.cxx.

196 {
197
198 return Type::TruthVertex;
199 }

◆ uid()

int xAOD::TruthVertex_v1::uid ( ) const

Get the vertex unique ID.

◆ v4()

TruthVertex_v1::FourVec_t xAOD::TruthVertex_v1::v4 ( ) const

The full 4-vector of the vertex.

Definition at line 185 of file TruthVertex_v1.cxx.

185 {
186 return FourVec_t(x(), y(), z(), t());
187 }
TLorentzVector FourVec_t
The 4-vector type.

◆ x()

float xAOD::TruthVertex_v1::x ( ) const

Vertex x displacement.

◆ y()

float xAOD::TruthVertex_v1::y ( ) const

Vertex y displacement.

◆ z()

float xAOD::TruthVertex_v1::z ( ) const

Vertex longitudinal distance along the beam line form the origin.


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