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