BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/McTruth/include/McTruth/McParticle.h
Go to the documentation of this file.
1#ifndef Event_McParticle_H
2#define Event_McParticle_H
3
4#include "CLHEP/Geometry/Point3D.h"
5#include "CLHEP/Vector/LorentzVector.h"
6#include "EventModel/EventModel.h"
7#include "GaudiKernel/ContainedObject.h"
8#include "GaudiKernel/Kernel.h"
9#include "GaudiKernel/ObjectList.h"
10#include "GaudiKernel/ObjectVector.h"
11#include "GaudiKernel/SmartRef.h"
12#include "GaudiKernel/SmartRefVector.h"
13#include <iostream>
14using namespace CLHEP;
15/** @class McParticle
16 * @brief The Monte Carlo particle kinematics information
17 *
18 * The class McParticle uses the Class Library for HEP (CLHEP).
19 *
20 * Based on LHCbEvent's MCParticle
21 *
22 */
23extern const CLID& CLID_McParticle;
24
25namespace Event { // NameSpace
26
27 class McParticle : virtual public ContainedObject {
28 public:
29 typedef int StdHepId;
30
31 //! status bits modeled
32
34 DECAYED = 1, //! Decayed by generator
35 DECAYFLT = 1 << 1, //! Decayed in flight
36 PRIMARY = 1 << 2, //! primary particle
37 LEAF = 1 << 3, //! this particle is a leaf in the particle tree
38 ERROR = 1 << 4 //! error
39 // MISSED= 1<<2, //! Does not hit detector
40 // NOINTER =1<<3, //! Traverses detector w/o interacting
41 // STOPPED =1<<4, //! Energy below cut; other bits may say why
42 // INTERACT=1<<5, //! Interacted, no further decision to be made
43 // INTSHDEP=1<<6, //! Interacted, further decision depends on ! selection of shower
44 // deposition PRIMARY =1<<7, //! primary particle SWERROR =1<<8, //! Error occurred in
45 // swimming the track BCKSPL=1<<9, //! The particle is backsplashed from the CAL back
46 // in the TKR region POSHIT =1<<10, //! The particle released a hit a PositionHit
47 // detector NOTTRACK=1<<11, //! Not tracked by user request Swum = 1<<12, //! this
48 // particle was produced by the swimmer LEAF = 1<<13 //! this particle is a leaf in
49 // the particle tree
50 };
51
52 virtual const CLID& clID() const { return McParticle::classID(); }
53 static const CLID& classID() { return CLID_McParticle; }
54 /// Constructors
55 McParticle() : m_statusFlags( 0 ) {}
56 /// Destructor
57 virtual ~McParticle() {}
58
59 //! completely initialize a newed object. No other way to set most attributes.
60 //! it will be replaced by the following methods (left here just in the transition)
61 void init( McParticle* mother, StdHepId id, unsigned int statusBits,
62 const HepLorentzVector& initialMomentum, const HepLorentzVector& finalMomentum,
63 const HepLorentzVector& initialPosition, const HepLorentzVector& finalPosition,
64 const std::string process = "" );
65
66 //! Set the initial attributes of the McParticle
67 void initialize( StdHepId id, unsigned int statusBits,
68 const HepLorentzVector& initialMomentum,
69 const HepLorentzVector& initialPosition, const std::string process = "" );
70
71 void initialize( McParticle* mother, StdHepId id, unsigned int statusBits,
72 const HepLorentzVector& initialMomentum,
73 const HepLorentzVector& initialPosition, const std::string process = "" );
74
75 //! Set the final attributes of the McParticle
76 // void finalize( const HepLorentzVector& finalMomentum,const HepLorentzVector&
77 // finalPosition);
78
79 void finalize( const HepLorentzVector& finalPosition );
80
81 /// Retrieve particle property
83
84 /// retrieve all of status flags for const object
85 unsigned int statusFlags() const;
86
87 /// add a new flag to the status flags
88 void addStatusFlag( unsigned int flag ) { m_statusFlags |= flag; };
89
90 /// Retrieve whether this is a primary particle:
91 /// there's no mother for a primary particle
92 bool primaryParticle() const;
93
94 /// Retrieve whether this is a leaf particle
95 bool leafParticle() const;
96
97 /// Decayed from generator
98 bool decayFromGenerator() const;
99
100 /// Decayed in flight
101 bool decayInFlight() const;
102
103 /// methods for setting and getting vertex indexes
104 void setVertexIndex0( int index0 ) { m_vertexIndex0 = index0; }
105
106 int vertexIndex0() const { return m_vertexIndex0; }
107
108 void setVertexIndex1( int index1 ) { m_vertexIndex1 = index1; }
109
110 int vertexIndex1() const { return m_vertexIndex1; }
111
112 // Set track index
113 void setTrackIndex( int trackIndex ) { m_trackIndex = trackIndex; }
114
115 // Get track index
116 int trackIndex() const { return m_trackIndex; }
117
118 /// Retrieve pointer to the start, end vertex positions
119 const HepLorentzVector& initialPosition() const;
120 const HepLorentzVector& finalPosition() const;
121
122 const HepLorentzVector& initialFourMomentum() const;
123 // const HepLorentzVector& finalFourMomentum()const;
124
125 /// access to the mother particle
126 const McParticle& mother() const;
127
128 /// set the mother particle
129 void setMother( const SmartRef<McParticle> m );
130
131 /// add a daugther particle to this particle
132 void addDaughter( const SmartRef<McParticle> d ) { m_daughters.push_back( d ); };
133
134 /// Used for pruning
135 void removeDaughter( const SmartRef<McParticle> mcPart );
136
137 /// access the process name
138 // const std::string getProcess()const{return m_process;};
139
140 /// set the initial and final volume identifiers
141 // void setInitialId(idents::VolumeIdentifier id){m_initialId = id;};
142 // void setFinalId(idents::VolumeIdentifier id){m_finalId = id;};
143
144 /// get the initial and final volume identifier
145 // idents::VolumeIdentifier getInitialId(){return m_initialId;};
146 // idents::VolumeIdentifier getFinalId(){return m_finalId;};
147
148 /// access to the list of daughters
149 const SmartRefVector<McParticle>& daughterList() const { return m_daughters; };
150
151 private:
152 /// particle property (such as electron or proton or ....) ID
153 StdHepId m_particleID;
154
155 int m_trackIndex;
156
157 /// the index for the vertex where the particle starts
158 int m_vertexIndex0;
159
160 /// the index for the vertex where the particle stops
161 int m_vertexIndex1;
162
163 /// Bit-field status flag
164 unsigned long m_statusFlags;
165 /// Initial position
166 HepLorentzVector m_initialPosition;
167 /// Final position
168 HepLorentzVector m_finalPosition;
169
170 /// Initial 4-momentum
171 HepLorentzVector m_initialFourMomentum;
172 /// Final 4-momentum
173 HepLorentzVector m_finalFourMomentum;
174 /// Pointer to mother particle
175 SmartRef<McParticle> m_mother;
176 /// Vector of pointers to daughter particles
177 SmartRefVector<McParticle> m_daughters;
178 /// String with the process name that poduces this particle
179 std::string m_process;
180
181 /// Volume identifiers where the particle start
182 // idents::VolumeIdentifier m_initialId;
183
184 /// Volume identifiers where the particle stop
185 // idents::VolumeIdentifier m_finalId;
186 };
187
188 typedef ObjectList<McParticle> McParticleCol;
189
190} // NameSpace Event
191
192#endif // Event_McParticle_H
const CLID & CLID_McParticle
void setVertexIndex0(int index0)
methods for setting and getting vertex indexes
void removeDaughter(const SmartRef< McParticle > mcPart)
Used for pruning.
bool primaryParticle() const
Retrieve whether this is a primary particle.
const HepLorentzVector & initialPosition() const
Retrieve pointer to the start, end vertex positions.
void setMother(const SmartRef< McParticle > m)
set the mother particle
@ ERROR
this particle is a leaf in the particle tree
const HepLorentzVector & initialFourMomentum() const
const McParticle & mother() const
access to the mother particle
unsigned int statusFlags() const
retrieve all of status flags for const object
void initialize(StdHepId id, unsigned int statusBits, const HepLorentzVector &initialMomentum, const HepLorentzVector &initialPosition, const std::string process="")
Set the initial attributes of the McParticle.
bool decayFromGenerator() const
Decayed from generator.
bool leafParticle() const
Retrieve whether this is a leaf particle.
const SmartRefVector< McParticle > & daughterList() const
access the process name
void addStatusFlag(unsigned int flag)
add a new flag to the status flags
void finalize(const HepLorentzVector &finalPosition)
Set the final attributes of the McParticle.
void addDaughter(const SmartRef< McParticle > d)
add a daugther particle to this particle
bool decayInFlight() const
Decayed in flight.
void init(McParticle *mother, StdHepId id, unsigned int statusBits, const HepLorentzVector &initialMomentum, const HepLorentzVector &finalMomentum, const HepLorentzVector &initialPosition, const HepLorentzVector &finalPosition, const std::string process="")
const HepLorentzVector & finalPosition() const
StdHepId particleProperty() const
Retrieve particle property.
Definition McParticle.cxx:7
ObjectList< McParticle > McParticleCol