BOSS 7.0.3
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>
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 * set int flag for ConExc: pingrg-2015-2-7
150 **/
151 void setIntFlag(std::vector<int> vi){
152 _intFlag=vi;
153 }
154
155 /**
156 * get int flag for ConExc: pingrg-2015-2-7
157 **/
158 std::vector<int> getIntFlag(){
159 return _intFlag;
160 }
161
162 /**
163 * Creates the daughters in the list of ids and
164 * adds them to the parent. Note that momentum
165 * is left uninitialized, this is _only_ creation.
166 */
167 void makeDaughters(int ndaug,EvtId *id);
168
169 /**
170 * Similar to the routine above except that here
171 * momentum is generated according to phase space
172 * daughters are filled with this momentum.
173 */
174 double initializePhaseSpace(int numdaughter,EvtId *daughters,
175 double poleSize=-1., int whichTwo1=0,
176 int whichTwo2=1);
177
178 /**
179 * Get pointer the the i:th daugther.
180 */
181 EvtParticle *getDaug(int i);
182
183 /**
184 * Iterates over the particles in a decay chain.
185 */
186 EvtParticle *nextIter(EvtParticle *rootOfTree=0);
187
188 /**
189 * Makes stdhep list
190 */
191 void makeStdHep(EvtStdHep& stdhep,
192 EvtSecondary& secondary,EvtId *stable_parent_ihep);
193 void makeStdHep(EvtStdHep& stdhep);
194
195 /**
196 * Gets 4vector in the labframe, i.e., the frame in which the root
197 * particles momentum is measured.
198 */
200
201 /**
202 * Gets 4vector in the particles restframe, i.e. this functiont will
203 * return (m,0,0,0)
204 */
206
207 /**
208 * Returns the 4position of the particle in the lab frame.
209 */
211
212 /**
213 * Returns pointer to parent particle.
214 */
216
217 /**
218 * Makes partptr the idaug:th daugther.
219 */
220 void insertDaugPtr(int idaug,EvtParticle* partptr){ _daug[idaug]=partptr;
221 partptr->_parent=this; }
222 /**
223 * Returns mass of particle.
224 */
225 double mass() const;
226
227 /**
228 * Used internally to decide if first time particle is decayed.
229 */
230 int firstornot() const;
231 void setFirstOrNot();
232 void resetFirstOrNot();
233
234 /**
235 * Returns Id of particle.
236 */
237 EvtId getId() const;
238
239 /**
240 * Returns particle type.
241 */
242
244
245 /**
246 * Returns number of spin states of the particle.
247 */
248 int getSpinStates() const;
249
250 /**
251 * Returns 4momentum in parents restframe.
252 */
253 const EvtVector4R& getP4() const;
254
255 /**
256 * Sets the 4momentum in the parents restframe.
257 */
258 void setP4(const EvtVector4R& p4){_p=p4;}
259
260 /**
261 * Retunrs the decay channel.
262 */
263 int getChannel() const;
264
265 /**
266 * Returns number of daugthers.
267 */
268 int getNDaug() const;
269 void resetNDaug() {_ndaug=0; return;}
270
271 /**
272 * Prints out the particle "tree" of a given particle. The
273 * tree consists of all daughters (and their daughters, etc)
274 * and their properties.
275 */
276 void printTree() const;
277
278 void printTreeRec(int level) const;
279 std::string writeTreeRec(std::string ) const;
280
281 void dumpTree( ) const;
282 void dumpTreeRec(int level,int dj) const;
283
284 std::string treeStr() const;
285 std::string treeStrRec(int level) const;
286
287 /**
288 * Prints information for the particle.
289 */
290 void printParticle() const;
291
292 /**
293 * Set lifetime of the particle in parents restframe.
294 */
295 void setLifetime(double tau);
296
297 /**
298 * Generate lifetime according to pure exponential.
299 */
300 void setLifetime();
301
302 /**
303 * Returns the lifetime.
304 */
305 double getLifetime();
306
307 /**
308 * Set diagonal spindensity matrix.
309 */
311
312 /**
313 * Set spindensity matrix for e+e- -> V
314 */
315 void setVectorSpinDensity();
316
317 void setPolarizedSpinDensity(double r00,double r11,double r22); //pingrg for polarized charmonium production
318 /**
319 * Set forward spin density matrix.
320 */
321 void setSpinDensityForward(const EvtSpinDensity& rho){_rhoForward=rho;}
322
323 /**
324 * Set forward spin density matrix according to the density matrix
325 * rho in the helicity amplitude basis.
326 */
329 double alpha,
330 double beta,
331 double gamma);
332
333 /**
334 * Returns a rotation matrix need to rotate the basis state
335 * to the helicity basis. The EvtSpinDensity matrix is just use
336 * as a matrix here. This function is to be implemented in each
337 * derived class.
338 */
341 double beta,
342 double gamma) const=0;
343
344 /**
345 * Get forward spin density matrix.
346 */
348
349 /**
350 * Set backward spin density matrix.
351 */
352 void setSpinDensityBackward(const EvtSpinDensity& rho){_rhoBackward=rho;}
353
354 /**
355 * Get backward spin density matrix.
356 */
358
359 //Hacks will be removed when better solutions are thought of!
360 //This is used to suppress use of random numbers when doing initialization
361 //of some models.
362 void noLifeTime() { _genlifetime=0; }
363
364 //lange - April 29, 2002
365 void setId(EvtId id) { _id=id;}
366 void initDecay(bool useMinMass=false);
367 void generateMassTree();
368
369 double compMassProb();
370
371 //setMass will blow away any existing 4vector
372 void setMass(double m) { _p=EvtVector4R(m,0.0,0.0,0.0);}
373
374 //void setMixed() {_mix=true;}
375 //void setUnMixed() {_mix=false;}
376 //bool getMixed() {return _mix;}
377
378 //void takeCConj() {report(INFO,"EvtGen") << "should take conj\n";}
379
380 //this means that the particle has gone through initDecay
381 // and thus has a mass
382 bool isInitialized() {return _isInit;}
383 bool hasValidP4() {return _validP4;}
384 bool isDecayed() {return _isDecayed;}
385
386
387 // decay prob - only relevent if already decayed
388 // and is a scalar particle
389 // returned is a double* that should be prob/probMax
390 double* decayProb() {return _decayProb;}
391 void setDecayProb( double p);
392
393 void setInclusiveMode(int im){_inclusiveMode=im ;}
394 int getInclusiveMode(){return _inclusiveMode;}
395
396protected:
397
398 void setp( double e, double px, double py, double pz) { _p.set(e,px,py,pz); }
399 void setp( const EvtVector4R& p4 ) { _p =p4; }
400 void setpart_num(EvtId particle_number )
401 {
402 assert(_channel==-10||
403 _id.getId()==particle_number.getId()||
404 _id.getId()==-1);
405 _id = particle_number;
406 }
408
409private:
410
411 EvtParticle* _daug[MAX_DAUG];
412 int _ndaug;
413 EvtParticle* _parent;
414 int _channel;
415 int _first;
416 EvtId _id;
417 EvtVector4R _p;
418 double _t;
419 bool _isInit;
420 bool _isDecayed;
421 int _generatorFlag;
422 //bool _mix;
423
424 EvtSpinDensity _rhoForward;
425 EvtSpinDensity _rhoBackward;
426
427 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep,
428 EvtSecondary& secondary,EvtId *stable_parent_ihep);
429 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep);
430
431
432 //This is a hack until things gets straightened out. (Ryd)
433 int _genlifetime;
434
435 //should never be used, therefor is private.
436 //these does _not_ have an implementation
437 EvtParticle& operator=(const EvtParticle& p);
438 EvtParticle(const EvtParticle& p);
439
440 double *_decayProb;
441
442 //Access the inclusive mode for OPENCHARM
443 int _inclusiveMode;
444 //Set mode index for ConExc
445 std::vector<int> _intFlag;
446
447
448};
449
450std::string IntToStr( int a); //pingrg, 2008-03-24
451#endif
452
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:362
virtual EvtVector4C epsPhoton(int i)
Definition: EvtParticle.cc:598
void setMass(double m)
Definition: EvtParticle.hh:372
void setSpinDensityBackward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:352
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
Definition: EvtParticle.cc:178
void setSpinDensityForward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:321
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:565
void initDecay(bool useMinMass=false)
Definition: EvtParticle.cc:237
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void resetNDaug()
Definition: EvtParticle.hh:269
void insertDaugPtr(int idaug, EvtParticle *partptr)
Definition: EvtParticle.hh:220
void decay()
Definition: EvtParticle.cc:404
EvtVector4R getP4Lab()
Definition: EvtParticle.cc:685
virtual EvtTensor4C epsTensorParent(int i) const
Definition: EvtParticle.cc:657
virtual EvtVector4C epsParentPhoton(int i)
Definition: EvtParticle.cc:587
void printTreeRec(int level) const
Definition: EvtParticle.cc:870
EvtId getId() const
Definition: EvtParticle.cc:113
EvtParticle * getParent()
Definition: EvtParticle.cc:87
virtual EvtDiracSpinor spParentNeutrino() const
Definition: EvtParticle.cc:635
void setGeneratorFlag(int flag)
Definition: EvtParticle.hh:141
virtual EvtDiracSpinor spParent(int) const
Definition: EvtParticle.cc:609
void setVectorSpinDensity()
Definition: EvtParticle.cc:138
bool hasValidP4()
Definition: EvtParticle.hh:383
bool isDecayed()
Definition: EvtParticle.hh:384
void printParticle() const
virtual EvtDiracSpinor spNeutrino() const
Definition: EvtParticle.cc:646
virtual EvtSpinDensity rotateToHelicityBasis(double alpha, double beta, double gamma) const =0
int getSpinStates() const
Definition: EvtParticle.cc:118
EvtVector4R getP4Restframe()
Definition: EvtParticle.cc:700
void setLifetime()
Definition: EvtParticle.cc:93
void setPolarizedSpinDensity(double r00, double r11, double r22)
Definition: EvtParticle.cc:157
void setIntFlag(std::vector< int > vi)
Definition: EvtParticle.hh:151
double getLifetime()
Definition: EvtParticle.cc:99
void setDiagonalSpinDensity()
Definition: EvtParticle.cc:133
double compMassProb()
Definition: EvtParticle.cc:504
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:398
void printTree() const
Definition: EvtParticle.cc:897
virtual EvtSpinDensity rotateToHelicityBasis() const =0
int getGeneratorFlag()
Definition: EvtParticle.hh:146
void setP4(const EvtVector4R &p4)
Definition: EvtParticle.hh:258
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:948
double * decayProb()
Definition: EvtParticle.hh:390
bool isInitialized()
Definition: EvtParticle.hh:382
std::vector< int > getIntFlag()
Definition: EvtParticle.hh:158
void deleteDaughters(bool keepChannel=false)
Definition: EvtParticle.cc:540
double mass() const
Definition: EvtParticle.cc:127
virtual EvtDiracSpinor sp(int) const
Definition: EvtParticle.cc:622
void setp(const EvtVector4R &p4)
Definition: EvtParticle.hh:399
void makeStdHep(EvtStdHep &stdhep, EvtSecondary &secondary, EvtId *stable_parent_ihep)
Definition: EvtParticle.cc:759
int firstornot() const
Definition: EvtParticle.cc:111
EvtSpinDensity getSpinDensityBackward()
Definition: EvtParticle.hh:357
void setInclusiveMode(int im)
Definition: EvtParticle.hh:393
EvtVector4R get4Pos()
Definition: EvtParticle.cc:706
virtual EvtVector4C eps(int i) const
Definition: EvtParticle.cc:576
void addDaug(EvtParticle *node)
Definition: EvtParticle.cc:104
void dumpTree() const
Definition: EvtParticle.cc:978
std::string treeStr() const
Definition: EvtParticle.cc:990
std::string treeStrRec(int level) const
Definition: EvtParticle.cc:908
void setpart_num(EvtId particle_number)
Definition: EvtParticle.hh:400
int getChannel() const
Definition: EvtParticle.cc:123
virtual EvtTensor4C epsTensor(int i) const
Definition: EvtParticle.cc:670
void setId(EvtId id)
Definition: EvtParticle.hh:365
std::string writeTreeRec(std::string) const
Definition: EvtParticle.cc:930
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:347
int getInclusiveMode()
Definition: EvtParticle.hh:394
EvtParticle * nextIter(EvtParticle *rootOfTree=0)
Definition: EvtParticle.cc:729
void generateMassTree()
Definition: EvtParticle.cc:461
void deleteTree()
Definition: EvtParticle.cc:557
void set(int i, double d)
Definition: EvtVector4R.hh:183