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