LCIO  "2.7.4"
 All Classes Namespaces Functions Variables Typedefs Friends Pages
MCParticleImpl.h
1 // -*- C++ -*-
2 #ifndef IMPL_MCPARTICLEIMPL_H
3 #define IMPL_MCPARTICLEIMPL_H 1
4 #include <vector>
5 
6 #include "EVENT/LCIO.h"
7 #include "AccessChecked.h"
8 
9 #include "EVENT/MCParticle.h"
10 #include <bitset>
11 
12 namespace IMPL {
13 
14  // fg 01042004 : changed to use vector of pointers !
15  // typedef std::vector<EVENT::MCParticle**> MCParticlePVec ;
16  // use pointers to pointer to MCParticle
17  // as SIO needs the address of the pointer for pointer reallocation....
18 
25 
26  public:
27 
28  MCParticleImpl() ;
29 
30 // /** Copy c'tor */
31 // MCParticleImpl(const EVENT::MCParticle& p) ;
32 
34  virtual ~MCParticleImpl() ;
35 
36  virtual int id() const { return simpleUID() ; }
37 
40  virtual const EVENT::MCParticleVec & getParents() const ;
41 
44  virtual const EVENT::MCParticleVec & getDaughters() const ;
45 
46 
47  // /** Returns the i-th daughter of this particle.
48  // * Same as getDaughter() except for return type.
49  // *
50  // * @see getNumberOfDaughters
51  // */
52  // virtual EVENT::MCParticle * getDaughter(int i) const ;
53 
54 
55  // /** Returns the number of parents of this particle - 0 if mother.
56  // */
57  // virtual int getNumberOfParents() const ;
58 
59 
60  // /** Returns the i-th parent of this particle.
61  // */
62  // virtual EVENT::MCParticle * getParent(int i) const ;
63 
64 
70  virtual const double* getEndpoint() const ;
71 
72  // /** Returns the number of daughters of this particle.
73  // */
74  // virtual int getNumberOfDaughters() const ;
75 
76 
79  virtual int getPDG() const ;
80 
87  virtual int getGeneratorStatus() const ;
88 
102  virtual int getSimulatorStatus() const ;
103 
106  virtual bool isCreatedInSimulation() const ;
107 
110  virtual bool isBackscatter() const ;
111 
114  virtual bool vertexIsNotEndpointOfParent() const ;
115 
118  virtual bool isDecayedInTracker() const ;
119 
122  virtual bool isDecayedInCalorimeter() const ;
123 
126  virtual bool hasLeftDetector() const ;
127 
130  virtual bool isStopped() const ;
131 
134  virtual bool isOverlay() const ;
135 
138  virtual const double* getVertex() const ;
139 
144  virtual float getTime() const ;
145 
148  virtual const double * getMomentum() const ;
149 
150 
153  virtual const double* getMomentumAtEndpoint() const ;
154 
157  virtual double getMass() const ;
158 
161  virtual float getCharge() const ;
162 
163 
167  virtual double getEnergy() const ;
168 
171  virtual const float* getSpin() const ;
172 
173 
176  virtual const int* getColorFlow() const ;
177 
178 
179  // set methods
182  void addParent( EVENT::MCParticle *mom ) ;
183 
184 // // set methods
185 // /** Sets the parent.
186 // */
187 // void setParent( EVENT::MCParticle *mom0 ) ;
188 
189 // /** Sets a second parent.
190 // */
191 // void setSecondParent( EVENT::MCParticle *mom1 ) ;
192 
193 
196  void setPDG(int pdg ) ;
197 
200  void setGeneratorStatus( int status ) ;
201 
204  void setSimulatorStatus( int status ) ;
205 
208  void setVertex( const double vtx[3] ) ;
209 
212  void setTime( float time) ;
213 
217  void setEndpoint( const double pnt[3] ) ;
218 
221  void setMomentum( const float p[3] );
222 
225  void setMomentum( const double p[3] );
226 
229  void setMomentumAtEndpoint( const float p[3] );
230 
233  void setMomentumAtEndpoint( const double p[3] );
234 
237  void setMass( float m ) ;
238 
241  void setCharge( float c ) ;
242 
245  void setSpin( const float spin[3] );
246 
249  void setColorFlow( const int cflow[2] );
250 
251 
252 
253  // setters for simulator status
254  virtual void setCreatedInSimulation(bool val) ;
255 
256  virtual void setBackscatter(bool val) ;
257 
258  virtual void setVertexIsNotEndpointOfParent(bool val) ;
259 
260  virtual void setDecayedInTracker(bool val) ;
261 
262  virtual void setDecayedInCalorimeter(bool val) ;
263 
264  virtual void setHasLeftDetector(bool val) ;
265 
266  virtual void setStopped(bool val) ;
267 
268  virtual void setOverlay(bool val) ;
269 
270  protected:
271 
274  void addDaughter( EVENT::MCParticle* daughter) ;
275 
276 // EVENT::MCParticle* _mother0 ;
277 // EVENT::MCParticle* _mother1 ;
278  int _pdg ;
279  int _genstatus ;
280  // int _simstatus ;
281  std::bitset<32> _simstatus ;
282  double _vertex[3] ;
283  double _endpoint[3] ;
284  double _pEndpoint[3] ;
285  double _p[3] ;
286  double _mass ;
287  float _charge ;
288  float _time ;
289  EVENT::MCParticleVec _parents ;
290  EVENT::MCParticleVec _daughters ;
291  bool _endpointSet ;
292  float _spin[3] ;
293  int _colorFlow[2] ;
294 
295 }; // class
296 } // namespace IMPL
297 #endif /* ifndef IMPL_MCPARTICLEIMPL_H */
std::vector< MCParticle * > MCParticleVec
Vector of (pointers to) MCParticles.
Definition: MCParticle.h:19
virtual bool vertexIsNotEndpointOfParent() const
True if the particle's vertex is not the endpoint of the parent particle.
Definition: MCParticleImpl.cc:185
virtual const int * getColorFlow() const
Returns the color flow.
Definition: MCParticleImpl.cc:168
virtual const double * getMomentumAtEndpoint() const
Returns the particle momentum at the endpoint.
Definition: MCParticleImpl.cc:197
void setTime(float time)
Sets the createion time.
Definition: MCParticleImpl.cc:257
virtual const double * getMomentum() const
Returns the particle momentum at the production vertex.
Definition: MCParticleImpl.cc:196
void setEndpoint(const double pnt[3])
Sets the particle endpoint.
Definition: MCParticleImpl.cc:297
virtual float getTime() const
The creation time of the particle in [ns] wrt.
Definition: MCParticleImpl.cc:195
virtual double getMass() const
Returns the mass of the particle in [GeV].
Definition: MCParticleImpl.cc:198
virtual const EVENT::MCParticleVec & getParents() const
Returns the parents of this particle.
Definition: MCParticleImpl.cc:68
virtual bool hasLeftDetector() const
True if the particle has left the world volume undecayed.
Definition: MCParticleImpl.cc:188
virtual int getGeneratorStatus() const
Returns the status for particles from the generator 0 empty line 1 undecayed particle, stable in the generator 2 particle decayed in the generator 3 documentation line.
Definition: MCParticleImpl.cc:174
virtual bool isBackscatter() const
True if the particle is the result of a backscatter from a calorimeter shower.
Definition: MCParticleImpl.cc:184
void setGeneratorStatus(int status)
Sets the Generator status.
Definition: MCParticleImpl.cc:239
virtual const double * getEndpoint() const
Returns the i-th daughter of this particle.
Definition: MCParticleImpl.cc:140
void addParent(EVENT::MCParticle *mom)
Adds a parent particle.
Definition: MCParticleImpl.cc:219
void addDaughter(EVENT::MCParticle *daughter)
Adds a daughter particle - only called from addParent().
Definition: MCParticleImpl.cc:210
virtual bool isDecayedInTracker() const
True if the particle has interacted in a tracking region.
Definition: MCParticleImpl.cc:186
void setColorFlow(const int cflow[2])
Sets the color flow.
Definition: MCParticleImpl.cc:314
void setSimulatorStatus(int status)
Sets the Simulator status.
Definition: MCParticleImpl.cc:244
void setMass(float m)
Sets the mass.
Definition: MCParticleImpl.cc:288
void setMomentum(const float p[3])
Sets the momentum.
Definition: MCParticleImpl.cc:262
void setMomentumAtEndpoint(const float p[3])
Sets the momentum at the endpoint.
Definition: MCParticleImpl.cc:275
void setVertex(const double vtx[3])
Sets the production vertex.
Definition: MCParticleImpl.cc:251
void setCharge(float c)
Sets the charge.
Definition: MCParticleImpl.cc:292
virtual const EVENT::MCParticleVec & getDaughters() const
Returns the daughters of this particle.
Definition: MCParticleImpl.cc:72
virtual double getEnergy() const
Returns the energy of the particle (at the vertex) in [GeV] computed from the particle's momentum and...
Definition: MCParticleImpl.cc:160
The LCIO Monte Carlo particle.
Definition: MCParticle.h:27
virtual bool isCreatedInSimulation() const
True if the particle has been created by the simulation program (rather than the generator).
Definition: MCParticleImpl.cc:183
void setPDG(int pdg)
Sets the parent.
Definition: MCParticleImpl.cc:235
virtual bool isStopped() const
True if the particle has been stopped by the simulation program.
Definition: MCParticleImpl.cc:189
virtual bool isDecayedInCalorimeter() const
True if the particle has interacted in a calorimeter region.
Definition: MCParticleImpl.cc:187
virtual bool isOverlay() const
True if the particle has been overlayed by the simulation (or digitization) program.
Definition: MCParticleImpl.cc:190
virtual const double * getVertex() const
Returns the production vertex of the particle.
Definition: MCParticleImpl.cc:194
void setSpin(const float spin[3])
Sets the spin.
Definition: MCParticleImpl.cc:307
virtual int getPDG() const
Returns the number of daughters of this particle.
Definition: MCParticleImpl.cc:173
Controls access to objects.
Definition: AccessChecked.h:17
virtual int getSimulatorStatus() const
Returns the status for particles from the simulation, e.g.
Definition: MCParticleImpl.cc:176
virtual float getCharge() const
Returns the particle's charge.
Definition: MCParticleImpl.cc:199
Implementation of MCParticle.
Definition: MCParticleImpl.h:24
virtual ~MCParticleImpl()
Copy c'tor.
Definition: MCParticleImpl.cc:65
virtual const float * getSpin() const
Returns the spin.
Definition: MCParticleImpl.cc:164
virtual int id() const
Returns an object id for internal (debugging) use in LCIO.
Definition: MCParticleImpl.h:36