BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtParticle.hh
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtGen/EvtParticle.hh
12//
13// Description:Class to describe all particles
14//
15// Modification history:
16//
17// DJL/RYD Sept. 25, 1996 Module created
18//
19//------------------------------------------------------------------------
20
21#ifndef EVTPARTICLE_HH
22#define EVTPARTICLE_HH
23
24//#include <iostream.h>
25#include <assert.h>
28#include "EvtGenBase/EvtId.hh"
30#include <string>
31
32class EvtDiracSpinor;
33class EvtVector4C;
34class EvtTensor4C;
35class EvtStdHep;
36class EvtSecondary;
37
38const int MAX_DAUG =100;
39const int MAX_LEVEL=10;
40const int MAX_TRIES=10000;
41
43
44public:
45
46 /**
47 * Default constructor.
48 */
50
51 /**
52 * Destructor.
53 */
54 virtual ~EvtParticle();
55
56 /**
57 * Returns polarization vector in the parents restframe.
58 */
59 virtual EvtVector4C epsParent(int i) const;
60
61 /**
62 * Returns polarization vector in the particles own restframe.
63 */
64 virtual EvtVector4C eps(int i) const;
65
66
67 /**
68 * Returns polarization vector in the parents restframe for a photon.
69 */
70 virtual EvtVector4C epsParentPhoton(int i);
71
72 /**
73 * Returns polarization vector in the particles own restframe for a photon.
74 */
75 virtual EvtVector4C epsPhoton(int i);
76
77
78 /**
79 * Returns Dirac spinor in the parents restframe for a Dirac particle.
80 */
81 virtual EvtDiracSpinor spParent(int) const;
82
83 /**
84 * Returns Dirac spinor in the particles own restframe for a Dirac particle.
85 */
86 virtual EvtDiracSpinor sp(int) const;
87
88
89
90 /**
91 * Returns Dirac spinor in the parents restframe for a Neutrino particle.
92 */
93 virtual EvtDiracSpinor spParentNeutrino() const;
94
95 /**
96 * Returns Dirac spinor in the particles own restframe for a
97 * Neutrino particle.
98 */
99 virtual EvtDiracSpinor spNeutrino() const;
100
101
102 /**
103 * Returns tensor in the parents restframe for a spin 2 particle.
104 */
105 virtual EvtTensor4C epsTensorParent(int i) const;
106
107 /**
108 * Returns tensor in the particles own restframe for a spin 2 particle.
109 */
110 virtual EvtTensor4C epsTensor(int i) const;
111
112 /**
113 * Initialiaze particle with id and 4momentum.
114 */
115 virtual void init(EvtId part_n,const EvtVector4R& p4)=0;
116
117 /**
118 * Add another daughter to the particle
119 */
120 void addDaug(EvtParticle *node);
121
122 /**
123 * Decay particle
124 */
125 void decay();
126
127 /**
128 * Delete a decay chain
129 */
130 void deleteTree();
131 void deleteDaughters(bool keepChannel=false);
132
133 /**
134 * Should only be used internally.
135 */
136 void setChannel( int i );
137
138 /**
139 * set generator information; pingrg-2011-1-6
140 */
141 void setGeneratorFlag(int flag){_generatorFlag = flag;}
142
143 /**
144 * get generator information; pingrg-2011-1-6
145 */
146 int getGeneratorFlag(){ return _generatorFlag ;}
147
148 /**
149 * Creates the daughters in the list of ids and
150 * adds them to the parent. Note that momentum
151 * is left uninitialized, this is _only_ creation.
152 */
153 void makeDaughters(int ndaug,EvtId *id);
154
155 /**
156 * Similar to the routine above except that here
157 * momentum is generated according to phase space
158 * daughters are filled with this momentum.
159 */
160 double initializePhaseSpace(int numdaughter,EvtId *daughters,
161 double poleSize=-1., int whichTwo1=0,
162 int whichTwo2=1);
163
164 /**
165 * Get pointer the the i:th daugther.
166 */
167 EvtParticle *getDaug(int i);
168
169 /**
170 * Iterates over the particles in a decay chain.
171 */
172 EvtParticle *nextIter(EvtParticle *rootOfTree=0);
173
174 /**
175 * Makes stdhep list
176 */
177 void makeStdHep(EvtStdHep& stdhep,
178 EvtSecondary& secondary,EvtId *stable_parent_ihep);
179 void makeStdHep(EvtStdHep& stdhep);
180
181 /**
182 * Gets 4vector in the labframe, i.e., the frame in which the root
183 * particles momentum is measured.
184 */
186
187 /**
188 * Gets 4vector in the particles restframe, i.e. this functiont will
189 * return (m,0,0,0)
190 */
192
193 /**
194 * Returns the 4position of the particle in the lab frame.
195 */
197
198 /**
199 * Returns pointer to parent particle.
200 */
202
203 /**
204 * Makes partptr the idaug:th daugther.
205 */
206 void insertDaugPtr(int idaug,EvtParticle* partptr){ _daug[idaug]=partptr;
207 partptr->_parent=this; }
208 /**
209 * Returns mass of particle.
210 */
211 double mass() const;
212
213 /**
214 * Used internally to decide if first time particle is decayed.
215 */
216 int firstornot() const;
217 void setFirstOrNot();
218 void resetFirstOrNot();
219
220 /**
221 * Returns Id of particle.
222 */
223 EvtId getId() const;
224
225 /**
226 * Returns particle type.
227 */
228
230
231 /**
232 * Returns number of spin states of the particle.
233 */
234 int getSpinStates() const;
235
236 /**
237 * Returns 4momentum in parents restframe.
238 */
239 const EvtVector4R& getP4() const;
240
241 /**
242 * Sets the 4momentum in the parents restframe.
243 */
244 void setP4(const EvtVector4R& p4){_p=p4;}
245
246 /**
247 * Retunrs the decay channel.
248 */
249 int getChannel() const;
250
251 /**
252 * Returns number of daugthers.
253 */
254 int getNDaug() const;
255 void resetNDaug() {_ndaug=0; return;}
256
257 /**
258 * Prints out the particle "tree" of a given particle. The
259 * tree consists of all daughters (and their daughters, etc)
260 * and their properties.
261 */
262 void printTree() const;
263
264 void printTreeRec(int level) const;
265 std::string writeTreeRec(std::string ) const;
266
267 void dumpTree( ) const;
268 void dumpTreeRec(int level,int dj) const;
269
270 std::string treeStr() const;
271 std::string treeStrRec(int level) const;
272
273 /**
274 * Prints information for the particle.
275 */
276 void printParticle() const;
277
278 /**
279 * Set lifetime of the particle in parents restframe.
280 */
281 void setLifetime(double tau);
282
283 /**
284 * Generate lifetime according to pure exponential.
285 */
286 void setLifetime();
287
288 /**
289 * Returns the lifetime.
290 */
291 double getLifetime();
292
293 /**
294 * Set diagonal spindensity matrix.
295 */
297
298 /**
299 * Set spindensity matrix for e+e- -> V
300 */
301 void setVectorSpinDensity();
302
303 void setPolarizedSpinDensity(double r00,double r11,double r22); //pingrg for polarized charmonium production
304 /**
305 * Set forward spin density matrix.
306 */
307 void setSpinDensityForward(const EvtSpinDensity& rho){_rhoForward=rho;}
308
309 /**
310 * Set forward spin density matrix according to the density matrix
311 * rho in the helicity amplitude basis.
312 */
315 double alpha,
316 double beta,
317 double gamma);
318
319 /**
320 * Returns a rotation matrix need to rotate the basis state
321 * to the helicity basis. The EvtSpinDensity matrix is just use
322 * as a matrix here. This function is to be implemented in each
323 * derived class.
324 */
327 double beta,
328 double gamma) const=0;
329
330 /**
331 * Get forward spin density matrix.
332 */
334
335 /**
336 * Set backward spin density matrix.
337 */
338 void setSpinDensityBackward(const EvtSpinDensity& rho){_rhoBackward=rho;}
339
340 /**
341 * Get backward spin density matrix.
342 */
344
345 //Hacks will be removed when better solutions are thought of!
346 //This is used to suppress use of random numbers when doing initialization
347 //of some models.
348 void noLifeTime() { _genlifetime=0; }
349
350 //lange - April 29, 2002
351 void setId(EvtId id) { _id=id;}
352 void initDecay(bool useMinMass=false);
353 void generateMassTree();
354
355 double compMassProb();
356
357 //setMass will blow away any existing 4vector
358 void setMass(double m) { _p=EvtVector4R(m,0.0,0.0,0.0);}
359
360 //void setMixed() {_mix=true;}
361 //void setUnMixed() {_mix=false;}
362 //bool getMixed() {return _mix;}
363
364 //void takeCConj() {report(INFO,"EvtGen") << "should take conj\n";}
365
366 //this means that the particle has gone through initDecay
367 // and thus has a mass
368 bool isInitialized() {return _isInit;}
369 bool hasValidP4() {return _validP4;}
370 bool isDecayed() {return _isDecayed;}
371
372
373 // decay prob - only relevent if already decayed
374 // and is a scalar particle
375 // returned is a double* that should be prob/probMax
376 double* decayProb() {return _decayProb;}
377 void setDecayProb( double p);
378
379 void setInclusiveMode(int im){_inclusiveMode=im ;}
380 int getInclusiveMode(){return _inclusiveMode;}
381
382protected:
383
384 void setp( double e, double px, double py, double pz) { _p.set(e,px,py,pz); }
385 void setp( const EvtVector4R& p4 ) { _p =p4; }
386 void setpart_num(EvtId particle_number )
387 {
388 assert(_channel==-10||
389 _id.getId()==particle_number.getId()||
390 _id.getId()==-1);
391 _id = particle_number;
392 }
394
395private:
396
397 EvtParticle* _daug[MAX_DAUG];
398 int _ndaug;
399 EvtParticle* _parent;
400 int _channel;
401 int _first;
402 EvtId _id;
403 EvtVector4R _p;
404 double _t;
405 bool _isInit;
406 bool _isDecayed;
407 int _generatorFlag;
408 //bool _mix;
409
410 EvtSpinDensity _rhoForward;
411 EvtSpinDensity _rhoBackward;
412
413 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep,
414 EvtSecondary& secondary,EvtId *stable_parent_ihep);
415 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep);
416
417
418 //This is a hack until things gets straightened out. (Ryd)
419 int _genlifetime;
420
421 //should never be used, therefor is private.
422 //these does _not_ have an implementation
423 EvtParticle& operator=(const EvtParticle& p);
424 EvtParticle(const EvtParticle& p);
425
426 double *_decayProb;
427
428 //Access the inclusive mode for OPENCHARM
429 int _inclusiveMode;
430
431
432};
433
434std::string IntToStr( int a); //pingrg, 2008-03-24
435#endif
436
const int MAX_LEVEL
Definition: EvtParticle.hh:39
std::string IntToStr(int a)
const int MAX_DAUG
Definition: EvtParticle.hh:38
const int MAX_TRIES
Definition: EvtParticle.hh:40
const double alpha
Definition: EvtId.hh:27
int getId() const
Definition: EvtId.hh:41
void noLifeTime()
Definition: EvtParticle.hh:348
virtual EvtVector4C epsPhoton(int i)
Definition: EvtParticle.cc:596
void setMass(double m)
Definition: EvtParticle.hh:358
void setSpinDensityBackward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:338
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
Definition: EvtParticle.cc:178
void setSpinDensityForward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:307
void setDecayProb(double p)
void makeDaughters(int ndaug, EvtId *id)
virtual ~EvtParticle()
Definition: EvtParticle.cc:56
virtual EvtVector4C epsParent(int i) const
Definition: EvtParticle.cc:563
void initDecay(bool useMinMass=false)
Definition: EvtParticle.cc:237
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void resetNDaug()
Definition: EvtParticle.hh:255
void insertDaugPtr(int idaug, EvtParticle *partptr)
Definition: EvtParticle.hh:206
void decay()
Definition: EvtParticle.cc:404
EvtVector4R getP4Lab()
Definition: EvtParticle.cc:683
virtual EvtTensor4C epsTensorParent(int i) const
Definition: EvtParticle.cc:655
virtual EvtVector4C epsParentPhoton(int i)
Definition: EvtParticle.cc:585
void printTreeRec(int level) const
Definition: EvtParticle.cc:868
EvtId getId() const
Definition: EvtParticle.cc:113
EvtParticle * getParent()
Definition: EvtParticle.cc:87
virtual EvtDiracSpinor spParentNeutrino() const
Definition: EvtParticle.cc:633
void setGeneratorFlag(int flag)
Definition: EvtParticle.hh:141
virtual EvtDiracSpinor spParent(int) const
Definition: EvtParticle.cc:607
void setVectorSpinDensity()
Definition: EvtParticle.cc:138
bool hasValidP4()
Definition: EvtParticle.hh:369
bool isDecayed()
Definition: EvtParticle.hh:370
void printParticle() const
Definition: EvtParticle.cc:998
virtual EvtDiracSpinor spNeutrino() const
Definition: EvtParticle.cc:644
virtual EvtSpinDensity rotateToHelicityBasis(double alpha, double beta, double gamma) const =0
int getSpinStates() const
Definition: EvtParticle.cc:118
EvtVector4R getP4Restframe()
Definition: EvtParticle.cc:698
void setLifetime()
Definition: EvtParticle.cc:93
void setPolarizedSpinDensity(double r00, double r11, double r22)
Definition: EvtParticle.cc:157
double getLifetime()
Definition: EvtParticle.cc:99
void setDiagonalSpinDensity()
Definition: EvtParticle.cc:133
double compMassProb()
Definition: EvtParticle.cc:502
EvtSpinType::spintype getSpinType() const
Definition: EvtParticle.cc:115
void setChannel(int i)
Definition: EvtParticle.cc:81
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
void setp(double e, double px, double py, double pz)
Definition: EvtParticle.hh:384
void printTree() const
Definition: EvtParticle.cc:895
virtual EvtSpinDensity rotateToHelicityBasis() const =0
int getGeneratorFlag()
Definition: EvtParticle.hh:146
void setP4(const EvtVector4R &p4)
Definition: EvtParticle.hh:244
void resetFirstOrNot()
Definition: EvtParticle.cc:77
int getNDaug() const
Definition: EvtParticle.cc:125
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
void dumpTreeRec(int level, int dj) const
Definition: EvtParticle.cc:946
double * decayProb()
Definition: EvtParticle.hh:376
bool isInitialized()
Definition: EvtParticle.hh:368
void deleteDaughters(bool keepChannel=false)
Definition: EvtParticle.cc:538
double mass() const
Definition: EvtParticle.cc:127
virtual EvtDiracSpinor sp(int) const
Definition: EvtParticle.cc:620
void setp(const EvtVector4R &p4)
Definition: EvtParticle.hh:385
void makeStdHep(EvtStdHep &stdhep, EvtSecondary &secondary, EvtId *stable_parent_ihep)
Definition: EvtParticle.cc:757
int firstornot() const
Definition: EvtParticle.cc:111
EvtSpinDensity getSpinDensityBackward()
Definition: EvtParticle.hh:343
void setInclusiveMode(int im)
Definition: EvtParticle.hh:379
EvtVector4R get4Pos()
Definition: EvtParticle.cc:704
virtual EvtVector4C eps(int i) const
Definition: EvtParticle.cc:574
void addDaug(EvtParticle *node)
Definition: EvtParticle.cc:104
void dumpTree() const
Definition: EvtParticle.cc:976
std::string treeStr() const
Definition: EvtParticle.cc:988
std::string treeStrRec(int level) const
Definition: EvtParticle.cc:906
void setpart_num(EvtId particle_number)
Definition: EvtParticle.hh:386
int getChannel() const
Definition: EvtParticle.cc:123
virtual EvtTensor4C epsTensor(int i) const
Definition: EvtParticle.cc:668
void setId(EvtId id)
Definition: EvtParticle.hh:351
std::string writeTreeRec(std::string) const
Definition: EvtParticle.cc:928
void setFirstOrNot()
Definition: EvtParticle.cc:74
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
EvtSpinDensity getSpinDensityForward()
Definition: EvtParticle.hh:333
int getInclusiveMode()
Definition: EvtParticle.hh:380
EvtParticle * nextIter(EvtParticle *rootOfTree=0)
Definition: EvtParticle.cc:727
void generateMassTree()
Definition: EvtParticle.cc:461
void deleteTree()
Definition: EvtParticle.cc:555
void set(int i, double d)
Definition: EvtVector4R.hh:183