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
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
136#ifdef HEPMC3
139 int id() const;
140#endif
141
144 long compressedExtBarCode() const { return 0; };
147
149 const TruthParticle * mother(const std::size_t i=0) const;
150
152 const TruthParticle * child( const std::size_t i ) const;
153
157 bool hasMother( const int pdgId ) const;
158
162 bool hasChild( const int pdgId ) const;
163
168 bool hasMother( const int pdgId, std::vector<unsigned int>& indices ) const;
169
174 bool hasChild( const int pdgId, std::vector<unsigned int>& indices ) const;
175
176 // Accessor functions
177
181 bool hasEtIsol() const;
182
188 double etIsol( const TruthParticleParameters::ConeSize coneIdx ) const;
189
192 const TruthEtIsolations::EtIsol_t* etIsol() const;
193
195 unsigned int nParents() const;
196
198 unsigned int nDecay() const;
199
201 CLHEP::HepLorentzVector transformVector( const HepMC::FourVector& ) const;
202
204 CLHEP::HepLorentzVector pDecay( const std::size_t i ) const;
205
207 int pdgDecay( const std::size_t i ) const;
208
209#ifdef HEPMC3
210//FIXME
211#else
214 operator const HepMC::GenParticle&() const;
215#endif
216
218
220 // Non-const methods:
222
223 // Set functions
224
226 void setCharge( const ChargeType charge );
227
228 void set4Mom( const HepMC::FourVector& hlv )
229 { this->momentumBase().set4Mom(hlv); }
230
231 // un-hide base-class' set4Mom
233
235 void setGenEventIndex( size_t index );
236
238 // Protected methods:
240 protected:
241
244
245
246
248 // Protected data:
250 protected:
251
255
260 std::vector<int> m_mothers;
261
266 std::vector<int> m_children;
267
270
271};
272
274// I/O functions
276std::ostream& operator<<( std::ostream& out, const TruthParticle& mc );
277
279// Inline methods:
281
284
289
290inline int TruthParticle::status() const
291{
292 return genParticle()->status();
293}
294
295inline const HepMC::Flow TruthParticle::flow() const
296{
297 return HepMC::flow(genParticle());
298}
299
300inline int TruthParticle::flow( int code_index ) const
301{
302 return HepMC::flow(genParticle(),code_index);
303}
304
305inline const HepMC::Polarization TruthParticle::polarization() const
306{
308}
309
310inline int TruthParticle::barcode() const
311{
312 return HepMC::barcode(genParticle());
313}
314
315#ifdef HEPMC3
316inline int TruthParticle::id() const
317{
318 return genParticle()->id();
319}
320#endif
321
322inline unsigned int TruthParticle::nParents() const
323{ return m_mothers.size(); }
324
325inline unsigned int TruthParticle::nDecay() const
326{ return m_children.size(); }
327
328#ifdef HEPMC3
329
330//FIXME
331#else
332
333inline
334TruthParticle::operator const HepMC::GenParticle&() const
335{
336 return *genParticle();
337}
338
339#endif
341{
342 this->particleBase().setCharge( charge );
343}
344
345inline CLHEP::HepLorentzVector TruthParticle::transformVector( const HepMC::FourVector& fv ) const
346{
347 CLHEP::HepLorentzVector hlv(fv.x(),fv.y(),fv.z(),fv.t());
348 return hlv;
349}
350
354
355
356#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
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:16
Polarization polarization(const T &a)
int flow(const T &a, int i)
Definition Flow.h:51
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
Ensure that the ATLAS eigen extensions are properly loaded.
ConeSize
Enum for Cone size indexes (for isolation)
Definition index.py:1