]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 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> | |
26 | #include "EvtGenBase/EvtVector4R.hh" | |
27 | #include "EvtGenBase/EvtSpinDensity.hh" | |
28 | #include "EvtGenBase/EvtId.hh" | |
29 | #include "EvtGenBase/EvtSpinType.hh" | |
30 | #include <string> | |
31 | ||
32 | class EvtDiracSpinor; | |
33 | class EvtVector4C; | |
34 | class EvtTensor4C; | |
35 | class EvtStdHep; | |
36 | class EvtSecondary; | |
37 | class EvtRaritaSchwinger; | |
38 | ||
39 | const int MAX_DAUG =100; | |
40 | const int MAX_LEVEL=10; | |
41 | const int MAX_TRIES=10000; | |
42 | ||
43 | class EvtParticle{ | |
44 | ||
45 | public: | |
46 | ||
47 | /** | |
48 | * Default constructor. | |
49 | */ | |
50 | EvtParticle(); | |
51 | ||
52 | /** | |
53 | * Destructor. | |
54 | */ | |
55 | virtual ~EvtParticle(); | |
56 | ||
57 | /** | |
58 | * Returns polarization vector in the parents restframe. | |
59 | */ | |
60 | virtual EvtVector4C epsParent(int i) const; | |
61 | ||
62 | /** | |
63 | * Returns polarization vector in the particles own restframe. | |
64 | */ | |
65 | virtual EvtVector4C eps(int i) const; | |
66 | ||
67 | ||
68 | /** | |
69 | * Returns polarization vector in the parents restframe for a photon. | |
70 | */ | |
71 | virtual EvtVector4C epsParentPhoton(int i); | |
72 | ||
73 | /** | |
74 | * Returns polarization vector in the particles own restframe for a photon. | |
75 | */ | |
76 | virtual EvtVector4C epsPhoton(int i); | |
77 | ||
78 | ||
79 | /** | |
80 | * Returns Dirac spinor in the parents restframe for a Dirac particle. | |
81 | */ | |
82 | virtual EvtDiracSpinor spParent(int) const; | |
83 | ||
84 | /** | |
85 | * Returns Dirac spinor in the particles own restframe for a Dirac particle. | |
86 | */ | |
87 | virtual EvtDiracSpinor sp(int) const; | |
88 | ||
89 | ||
90 | ||
91 | /** | |
92 | * Returns Dirac spinor in the parents restframe for a Neutrino particle. | |
93 | */ | |
94 | virtual EvtDiracSpinor spParentNeutrino() const; | |
95 | ||
96 | /** | |
97 | * Returns Dirac spinor in the particles own restframe for a | |
98 | * Neutrino particle. | |
99 | */ | |
100 | virtual EvtDiracSpinor spNeutrino() const; | |
101 | ||
102 | ||
103 | /** | |
104 | * Returns tensor in the parents restframe for a spin 2 particle. | |
105 | */ | |
106 | virtual EvtTensor4C epsTensorParent(int i) const; | |
107 | ||
108 | /** | |
109 | * Returns tensor in the particles own restframe for a spin 2 particle. | |
110 | */ | |
111 | virtual EvtTensor4C epsTensor(int i) const; | |
112 | ||
113 | /** | |
114 | * Returns Rarita-Schwinger spinor in the parents restframe for a | |
115 | * Rarita-Schwinger particle. | |
116 | */ | |
117 | virtual EvtRaritaSchwinger spRSParent(int) const; | |
118 | ||
119 | /** | |
120 | * Returns Rarita-Schwinger spinor in the particles own restframe for a | |
121 | * Rarita-Schwinger particle. | |
122 | */ | |
123 | virtual EvtRaritaSchwinger spRS(int) const; | |
124 | ||
125 | ||
126 | ||
127 | /** | |
128 | * Initialiaze particle with id and 4momentum. | |
129 | */ | |
130 | virtual void init(EvtId part_n,const EvtVector4R& p4)=0; | |
131 | ||
132 | /** | |
133 | * Add another daughter to the particle | |
134 | */ | |
135 | void addDaug(EvtParticle *node); | |
136 | ||
137 | /** | |
138 | * Decay particle | |
139 | */ | |
140 | void decay(); | |
141 | ||
142 | /** | |
143 | * Delete a decay chain | |
144 | */ | |
145 | void deleteTree(); | |
146 | void deleteDaughters(bool keepChannel=false); | |
147 | ||
148 | /** | |
149 | * Should only be used internally. | |
150 | */ | |
151 | void setChannel( int i ); | |
152 | ||
153 | /** | |
154 | * Creates the daughters in the list of ids and | |
155 | * adds them to the parent. Note that momentum | |
156 | * is left uninitialized, this is _only_ creation. | |
157 | */ | |
158 | void makeDaughters(unsigned int ndaug,EvtId *id); | |
159 | ||
160 | /** | |
161 | * Similar to the routine above except that here | |
162 | * momentum is generated according to phase space | |
163 | * daughters are filled with this momentum. | |
164 | */ | |
165 | double initializePhaseSpace(unsigned int numdaughter,EvtId *daughters, | |
166 | bool forceResetMasses=false, | |
167 | double poleSize=-1., int whichTwo1=0, | |
168 | int whichTwo2=1); | |
169 | ||
170 | /** | |
171 | * Get pointer the the i:th daugther. | |
172 | */ | |
173 | EvtParticle *getDaug(int i); | |
174 | ||
175 | /** | |
176 | * Iterates over the particles in a decay chain. | |
177 | */ | |
178 | EvtParticle *nextIter(EvtParticle *rootOfTree=0); | |
179 | ||
180 | /** | |
181 | * Makes stdhep list | |
182 | */ | |
183 | void makeStdHep(EvtStdHep& stdhep, | |
184 | EvtSecondary& secondary,EvtId *stable_parent_ihep); | |
185 | void makeStdHep(EvtStdHep& stdhep); | |
186 | ||
187 | /** | |
188 | * Gets 4vector in the labframe, i.e., the frame in which the root | |
189 | * particles momentum is measured. | |
190 | */ | |
191 | EvtVector4R getP4Lab() const; | |
192 | ||
193 | ||
194 | /** | |
195 | * Gets 4vector in the labframe for the 4-momentum befor FSR was | |
196 | * generated in the parents decay. The lab frame is where the root | |
197 | * particles momentum is measured. | |
198 | */ | |
199 | EvtVector4R getP4LabBeforeFSR(); | |
200 | ||
201 | /** | |
202 | * Gets 4vector in the particles restframe, i.e. this functiont will | |
203 | * return (m,0,0,0) | |
204 | */ | |
205 | EvtVector4R getP4Restframe() const; | |
206 | ||
207 | /** | |
208 | * Returns the 4position of the particle in the lab frame. | |
209 | */ | |
210 | EvtVector4R get4Pos() const; | |
211 | ||
212 | /** | |
213 | * Returns pointer to parent particle. | |
214 | */ | |
215 | EvtParticle *getParent() const; | |
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 | ||
243 | EvtSpinType::spintype getSpinType() const; | |
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){ | |
259 | _p=p4; | |
260 | _pBeforeFSR=p4; | |
261 | } | |
262 | ||
263 | void setP4WithFSR(const EvtVector4R& p4){ | |
264 | _p=p4; | |
265 | } | |
266 | ||
267 | void setFSRP4toZero(){ | |
268 | _pBeforeFSR.set(0.0,0.0,0.0,0.0); | |
269 | } | |
270 | ||
271 | /** | |
272 | * Retunrs the decay channel. | |
273 | */ | |
274 | int getChannel() const; | |
275 | ||
276 | /** | |
277 | * Returns number of daugthers. | |
278 | */ | |
279 | size_t getNDaug() const; | |
280 | void resetNDaug() {_ndaug=0; return;} | |
281 | ||
282 | /** | |
283 | * Prints out the particle "tree" of a given particle. The | |
284 | * tree consists of all daughters (and their daughters, etc) | |
285 | * and their properties. | |
286 | */ | |
287 | void printTree() const; | |
288 | ||
289 | void printTreeRec(unsigned int level) const; | |
290 | ||
291 | std::string treeStr() const; | |
292 | std::string treeStrRec(unsigned int level) const; | |
293 | ||
294 | /** | |
295 | * Prints information for the particle. | |
296 | */ | |
297 | void printParticle() const; | |
298 | ||
299 | /** | |
300 | * Set lifetime of the particle in parents restframe. | |
301 | */ | |
302 | void setLifetime(double tau); | |
303 | ||
304 | /** | |
305 | * Generate lifetime according to pure exponential. | |
306 | */ | |
307 | void setLifetime(); | |
308 | ||
309 | /** | |
310 | * Returns the lifetime. | |
311 | */ | |
312 | double getLifetime(); | |
313 | ||
314 | /** | |
315 | * Set diagonal spindensity matrix. | |
316 | */ | |
317 | void setDiagonalSpinDensity(); | |
318 | ||
319 | /** | |
320 | * Set spindensity matrix for e+e- -> V | |
321 | */ | |
322 | void setVectorSpinDensity(); | |
323 | ||
324 | /** | |
325 | * Set forward spin density matrix. | |
326 | */ | |
327 | void setSpinDensityForward(const EvtSpinDensity& rho){_rhoForward=rho;} | |
328 | ||
329 | /** | |
330 | * Set forward spin density matrix according to the density matrix | |
331 | * rho in the helicity amplitude basis. | |
332 | */ | |
333 | void setSpinDensityForwardHelicityBasis(const EvtSpinDensity& rho); | |
334 | void setSpinDensityForwardHelicityBasis(const EvtSpinDensity& rho, | |
335 | double alpha, | |
336 | double beta, | |
337 | double gamma); | |
338 | ||
339 | /** | |
340 | * Returns a rotation matrix need to rotate the basis state | |
341 | * to the helicity basis. The EvtSpinDensity matrix is just use | |
342 | * as a matrix here. This function is to be implemented in each | |
343 | * derived class. | |
344 | */ | |
345 | virtual EvtSpinDensity rotateToHelicityBasis() const=0; | |
346 | virtual EvtSpinDensity rotateToHelicityBasis(double alpha, | |
347 | double beta, | |
348 | double gamma) const=0; | |
349 | ||
350 | /** | |
351 | * Get forward spin density matrix. | |
352 | */ | |
353 | EvtSpinDensity getSpinDensityForward(){return _rhoForward;} | |
354 | ||
355 | /** | |
356 | * Set backward spin density matrix. | |
357 | */ | |
358 | void setSpinDensityBackward(const EvtSpinDensity& rho){_rhoBackward=rho;} | |
359 | ||
360 | /** | |
361 | * Get backward spin density matrix. | |
362 | */ | |
363 | EvtSpinDensity getSpinDensityBackward(){return _rhoBackward;} | |
364 | ||
365 | //Hacks will be removed when better solutions are thought of! | |
366 | //This is used to suppress use of random numbers when doing initialization | |
367 | //of some models. | |
368 | void noLifeTime() { _genlifetime=0; } | |
369 | ||
370 | //lange - April 29, 2002 | |
371 | void setId(EvtId id) { _id=id;} | |
372 | void initDecay(bool useMinMass=false); | |
373 | void generateMassTree(); | |
374 | ||
375 | double compMassProb(); | |
376 | ||
377 | //setMass will blow away any existing 4vector | |
378 | void setMass(double m) { _p=EvtVector4R(m,0.0,0.0,0.0);} | |
379 | ||
380 | //void setMixed() {_mix=true;} | |
381 | //void setUnMixed() {_mix=false;} | |
382 | //bool getMixed() {return _mix;} | |
383 | ||
384 | //void takeCConj() {report(INFO,"EvtGen") << "should take conj\n";} | |
385 | ||
386 | //this means that the particle has gone through initDecay | |
387 | // and thus has a mass | |
388 | bool isInitialized() {return _isInit;} | |
389 | bool hasValidP4() {return _validP4;} | |
390 | bool isDecayed() {return _isDecayed;} | |
391 | ||
392 | ||
393 | // decay prob - only relevent if already decayed | |
394 | // and is a scalar particle | |
395 | // returned is a double* that should be prob/probMax | |
396 | double* decayProb() {return _decayProb;} | |
397 | void setDecayProb( double p); | |
398 | ||
399 | ||
400 | protected: | |
401 | ||
402 | void setp( double e, double px, double py, double pz) { | |
403 | _p.set(e,px,py,pz); | |
404 | _pBeforeFSR=_p; | |
405 | } | |
406 | ||
407 | void setp( const EvtVector4R& p4 ) { | |
408 | _p =p4; | |
409 | _pBeforeFSR=_p; | |
410 | } | |
411 | ||
412 | void setpart_num(EvtId particle_number ) { | |
413 | assert(_channel==-10|| | |
414 | _id.getId()==particle_number.getId()|| | |
415 | _id.getId()==-1); | |
416 | _id = particle_number; | |
417 | } | |
418 | bool _validP4; | |
419 | ||
420 | private: | |
421 | ||
422 | EvtParticle* _daug[MAX_DAUG]; | |
423 | size_t _ndaug; | |
424 | EvtParticle* _parent; | |
425 | int _channel; | |
426 | int _first; | |
427 | EvtId _id; | |
428 | EvtVector4R _p; | |
429 | EvtVector4R _pBeforeFSR; | |
430 | double _t; | |
431 | bool _isInit; | |
432 | bool _isDecayed; | |
433 | ||
434 | //bool _mix; | |
435 | ||
436 | EvtSpinDensity _rhoForward; | |
437 | EvtSpinDensity _rhoBackward; | |
438 | ||
439 | void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep, | |
440 | EvtSecondary& secondary,EvtId *stable_parent_ihep); | |
441 | void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep); | |
442 | ||
443 | ||
444 | //This is a hack until things gets straightened out. (Ryd) | |
445 | int _genlifetime; | |
446 | ||
447 | //should never be used, therefor is private. | |
448 | //these does _not_ have an implementation | |
449 | EvtParticle& operator=(const EvtParticle& p); | |
450 | EvtParticle(const EvtParticle& p); | |
451 | ||
452 | double *_decayProb; | |
453 | ||
454 | }; | |
455 | ||
456 | #endif | |
457 |