ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// TruthParticle.h
8// Header file for class TruthParticle
9// Author : Frank Paige Created : Jan 2004
10// Author : Ketevi A. Assamagan Updated : May 2004
11// Author : Sebastien Binet Updated : Jan 2005
13#ifndef MCPARTICLEEVENT_TRUTHPARTICLE_H
14#define MCPARTICLEEVENT_TRUTHPARTICLE_H
15
22
23// STL includes
24#include <vector>
25
26// HepMC / CLHEP includes
27#include "CLHEP/Vector/LorentzVector.h"
30#include "AtlasHepMC/Flow.h"
31
32// Gaudi includes
33
34// EventKernel includes
36
37// FourMom includes
38
39// ParticleEvent includes
41
42// McParticleEvent includes
48
49// Forward declaration
50namespace Trk { class RecVertex; }
52
54 TruthParticleNavigation,
55 TruthParticleMomentum,
56 TruthParticleBase
57 >
58{
59
61 // Public typedefs:
63 public:
64
65 // for readability and lazy people
70
71 typedef std::size_t evtIndex_t;
73 // Public methods:
75 public:
76
80
83 TruthParticle( const TruthParticle& rhs );
84
90 const TruthParticleContainer * container = 0 );
91
95
99
101 // Const methods:
103
105 HepMC::ConstGenParticlePtr genMother(const std::size_t i=0) const;
106
109
111 HepMC::ConstGenParticlePtr genChild( const std::size_t i ) const;
112
115
118 int status() const;
119
122 const HepMC::Flow flow() const;
123
126 int flow( int code_index ) const;
127
130 const HepMC::Polarization polarization() const;
131
134 int barcode() const;
135
138 int id() const;
139
142 long compressedExtBarCode() const { return 0; };
145
147 const TruthParticle * mother(const std::size_t i=0) const;
148
150 const TruthParticle * child( const std::size_t i ) const;
151
155 bool hasMother( const int pdgId ) const;
156
160 bool hasChild( const int pdgId ) const;
161
166 bool hasMother( const int pdgId, std::vector<unsigned int>& indices ) const;
167
172 bool hasChild( const int pdgId, std::vector<unsigned int>& indices ) const;
173
174 // Accessor functions
175
179 bool hasEtIsol() const;
180
186 double etIsol( const TruthParticleParameters::ConeSize coneIdx ) const;
187
190 const TruthEtIsolations::EtIsol_t* etIsol() const;
191
193 unsigned int nParents() const;
194
196 unsigned int nDecay() const;
197
199 CLHEP::HepLorentzVector transformVector( const HepMC::FourVector& ) const;
200
202 CLHEP::HepLorentzVector pDecay( const std::size_t i ) const;
203
205 int pdgDecay( const std::size_t i ) const;
206
208
210 // Non-const methods:
212
213 // Set functions
214
216 void setCharge( const ChargeType charge );
217
219 { this->momentumBase().set4Mom(hlv); }
220
221 // un-hide base-class' set4Mom
223
225 void setGenEventIndex( size_t index );
226
228 // Protected methods:
230 protected:
231
234
235
236
238 // Protected data:
240 protected:
241
245
250 std::vector<int> m_mothers;
251
256 std::vector<int> m_children;
257
260
261};
262
264// I/O functions
266std::ostream& operator<<( std::ostream& out, const TruthParticle& mc );
267
269// Inline methods:
271
274
279
280inline int TruthParticle::status() const
281{
282 return genParticle()->status();
283}
284
286{
287 return HepMC::flow(genParticle());
288}
289
290inline int TruthParticle::flow( int code_index ) const
291{
292 return HepMC::flow(genParticle(),code_index);
293}
294
299
300inline int TruthParticle::barcode() const
301{
302 return HepMC::barcode(genParticle());
303}
304
305inline int TruthParticle::id() const
306{
307 return genParticle()->id();
308}
309
310inline unsigned int TruthParticle::nParents() const
311{ return m_mothers.size(); }
312
313inline unsigned int TruthParticle::nDecay() const
314{ return m_children.size(); }
315
317{
318 this->particleBase().setCharge( charge );
319}
320
321inline CLHEP::HepLorentzVector TruthParticle::transformVector( const HepMC::FourVector& fv ) const
322{
323 CLHEP::HepLorentzVector hlv(fv.x(),fv.y(),fv.z(),fv.t());
324 return hlv;
325}
326
330
331
332#endif //> MCPARTICLEEVENT_TRUTHPARTICLE_H
double charge(const T &p)
Definition AtlasPID.h:997
double ChargeType
typedef ChargeType used to anticipate changes here
std::ostream & operator<<(std::ostream &out, const TruthParticle &mc)
NavigableTerminalNode TruthParticleNavigation
Trk::RecVertex inherits from Trk::Vertex.
Definition RecVertex.h:44
McAod::EtIsolations EtIsol_t
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
void setCharge(const ChargeType charge)
Set the charge of this TruthParticleBase.
HepMC::ConstGenParticlePtr genParticle() const
return the HepMC::GenParticle which is being proxied
virtual void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
const HepMC::Polarization polarization() const
Forwards the HepMC::GenParticle::polarization() information.
std::vector< int > m_children
vector of barcodes of all the children of this particle.
int barcode() const
Forwards the HepMC::GenParticle::barcode() information.
int status() const
Forwards the HepMC::GenParticle::status() information.
int pdgDecay(const std::size_t i) const
Return the PDG-Id of the i-th child of this particle.
bool hasMother(const int pdgId) const
Return true if the given PDG::id to match can be found within the parents of this TruthParticle.
HepMC::ConstGenParticlePtr genChild(const std::size_t i) const
Retrieve the i-th child (GenParticle) of this TruthParticle.
std::vector< int > m_mothers
vector of barcodes of all the mothers of this particle.
ParticleImpl< TruthParticleNavigation, TruthParticleMomentum, TruthParticleBase > TruthParticleImpl_t
int id() const
Forwards the HepMC::GenParticle::id() information.
HepMC::ConstGenParticlePtr genParticle() const
Retrieve the GenParticle this TruthParticle has been made from (if any).
const TruthParticle * mother(const std::size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
CLHEP::HepLorentzVector transformVector(const HepMC::FourVector &) const
returns a Pointer to a CLHEP::LorentzVector from a HepMC::FourVector
HepMC::ConstGenParticlePtr genMother(const std::size_t i=0) const
Retrieve the GenParticle mother of this TruthParticle.
void setCharge(const ChargeType charge)
Set the charge of this TruthParticle.
const TruthParticleContainer * m_container
Pointer to the collection holding ourself.
unsigned int nParents() const
Number of parents of this particle.
void setGenParticle(HepMC::ConstGenParticlePtr particle)
Fill the data members of ParticleBase from the GenParticle.
evtIndex_t m_nGenEventIdx
the index of the GenEvent this particle is in
bool hasEtIsol() const
Return true if one has filled the Et isolation infos for this TruthParticle.
long compressedExtBarCode() const
Forwards the HepMC::GenParticle::barcode() information.
unsigned int nDecay() const
Number of children of this particle.
const TruthEtIsolations::EtIsol_t * etIsol() const
Return the transverse energies for all the isolation cones.
TruthParticle()
Default constructor.
const HepMC::Flow flow() const
Forwards the HepMC::GenParticle::flow() information.
const TruthParticle * child(const std::size_t i) const
Retrieve the i-th child (TruthParticle) of this TruthParticle.
TruthParticle & operator=(const TruthParticle &rhs)
Assignment operator.
CLHEP::HepLorentzVector pDecay(const std::size_t i) const
Return the 4-vec of i-th child of this particle.
bool hasChild(const int pdgId) const
Return true if the given PDG::id to match can be found within the children of this TruthParticle.
int barcode(const T *p)
Definition Barcode.h:15
HepMC3::FourVector FourVector
Polarization polarization(const T &a)
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
int flow(const HepMC3::GenParticlePtr &p, int i)
Definition Flow.h:13
std::shared_ptr< HepMC3::VectorIntAttribute > Flow
Definition Flow.h:12
Ensure that the ATLAS eigen extensions are properly loaded.
ConeSize
Enum for Cone size indexes (for isolation).
Definition index.py:1