StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EvtParticle.hh
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 #include <vector>
32 #include <map>
33 
34 class EvtDiracSpinor;
35 class EvtVector4C;
36 class EvtTensor4C;
37 class EvtStdHep;
38 class EvtSecondary;
39 class EvtRaritaSchwinger;
40 
41 const int MAX_DAUG =100;
42 const int MAX_LEVEL=10;
43 const int MAX_TRIES=10000;
44 
46 
47 public:
48 
52  EvtParticle();
53 
57  virtual ~EvtParticle();
58 
62  virtual EvtVector4C epsParent(int i) const;
63 
67  virtual EvtVector4C eps(int i) const;
68 
69 
73  virtual EvtVector4C epsParentPhoton(int i);
74 
78  virtual EvtVector4C epsPhoton(int i);
79 
80 
84  virtual EvtDiracSpinor spParent(int) const;
85 
89  virtual EvtDiracSpinor sp(int) const;
90 
91 
92 
96  virtual EvtDiracSpinor spParentNeutrino() const;
97 
102  virtual EvtDiracSpinor spNeutrino() const;
103 
104 
108  virtual EvtTensor4C epsTensorParent(int i) const;
109 
113  virtual EvtTensor4C epsTensor(int i) const;
114 
119  virtual EvtRaritaSchwinger spRSParent(int) const;
120 
125  virtual EvtRaritaSchwinger spRS(int) const;
126 
127 
128 
132  virtual void init(EvtId part_n,const EvtVector4R& p4)=0;
133 
137  void addDaug(EvtParticle *node);
138 
142  void decay();
143 
147  void deleteTree();
148  void deleteDaughters(bool keepChannel=false);
149 
153  void setChannel( int i );
154 
160  void makeDaughters(unsigned int ndaug,EvtId *id);
161 
167  void makeDaughters(unsigned int ndaug, std::vector<EvtId> idVector);
168 
174  double initializePhaseSpace(unsigned int numdaughter,EvtId *daughters,
175  bool forceResetMasses=false,
176  double poleSize=-1., int whichTwo1=0,
177  int whichTwo2=1);
178 
182  EvtParticle *getDaug(int i);
183 
187  EvtParticle *nextIter(EvtParticle *rootOfTree=0);
188 
192  void makeStdHep(EvtStdHep& stdhep,
193  EvtSecondary& secondary,EvtId *stable_parent_ihep);
194  void makeStdHep(EvtStdHep& stdhep);
195 
200  EvtVector4R getP4Lab() const;
201 
202 
209 
214  EvtVector4R getP4Restframe() const;
215 
219  EvtVector4R get4Pos() const;
220 
224  EvtParticle *getParent() const;
225 
229  void insertDaugPtr(int idaug,EvtParticle* partptr){ _daug[idaug]=partptr;
230  partptr->_parent=this; }
234  double mass() const;
235 
239  int firstornot() const;
240  void setFirstOrNot();
241  void resetFirstOrNot();
242 
246  EvtId getId() const;
247 
252  int getPDGId() const;
253 
258  EvtSpinType::spintype getSpinType() const;
259 
263  int getSpinStates() const;
264 
268  const EvtVector4R& getP4() const;
269 
273  void setP4(const EvtVector4R& p4){
274  _p=p4;
275  _pBeforeFSR=p4;
276  }
277 
278  void setP4WithFSR(const EvtVector4R& p4){
279  _p=p4;
280  }
281 
282  void setFSRP4toZero(){
283  _pBeforeFSR.set(0.0,0.0,0.0,0.0);
284  }
285 
289  int getChannel() const;
290 
294  size_t getNDaug() const;
295  void resetNDaug() {_ndaug=0; return;}
296 
302  void printTree() const;
303 
304  void printTreeRec(unsigned int level) const;
305 
306  std::string treeStr() const;
307  std::string treeStrRec(unsigned int level) const;
308 
312  void printParticle() const;
313 
317  void setLifetime(double tau);
318 
322  void setLifetime();
323 
327  double getLifetime();
328 
332  void setDiagonalSpinDensity();
333 
337  void setVectorSpinDensity();
338 
342  void setSpinDensityForward(const EvtSpinDensity& rho){_rhoForward=rho;}
343 
350  double alpha,
351  double beta,
352  double gamma);
353 
360  virtual EvtSpinDensity rotateToHelicityBasis() const=0;
361  virtual EvtSpinDensity rotateToHelicityBasis(double alpha,
362  double beta,
363  double gamma) const=0;
364 
368  EvtSpinDensity getSpinDensityForward(){return _rhoForward;}
369 
373  void setSpinDensityBackward(const EvtSpinDensity& rho){_rhoBackward=rho;}
374 
378  EvtSpinDensity getSpinDensityBackward(){return _rhoBackward;}
379 
380  //Hacks will be removed when better solutions are thought of!
381  //This is used to suppress use of random numbers when doing initialization
382  //of some models.
383  void noLifeTime() { _genlifetime=0; }
384 
385  //lange - April 29, 2002
386  void setId(EvtId id) { _id=id;}
387  void initDecay(bool useMinMass=false);
388  bool generateMassTree();
389 
390  double compMassProb();
391 
392  //setMass will blow away any existing 4vector
393  void setMass(double m) { _p=EvtVector4R(m,0.0,0.0,0.0);}
394 
395  //void setMixed() {_mix=true;}
396  //void setUnMixed() {_mix=false;}
397  //bool getMixed() {return _mix;}
398 
399  //void takeCConj() {EvtGenReport(EVTGEN_INFO,"EvtGen") << "should take conj\n";}
400 
401  //this means that the particle has gone through initDecay
402  // and thus has a mass
403  bool isInitialized() {return _isInit;}
404  bool hasValidP4() {return _validP4;}
405  bool isDecayed() {return _isDecayed;}
406 
407 
408  // decay prob - only relevent if already decayed
409  // and is a scalar particle
410  // returned is a double* that should be prob/probMax
411  double* decayProb() {return _decayProb;}
412  void setDecayProb( double p);
413 
414  // Return the name of the particle (from the EvtId number)
415  std::string getName();
416 
417  // Specify whether the particle has a special named attribute with
418  // a set value. By default, nothing is set, but derived classes
419  // can set this to mean something specific, e.g. if a photon is FSR
420  void setAttribute(std::string attName, int attValue) {
421  _attributes[attName] = attValue;
422  }
423 
424  // Retrieve the integer value for the given attribute name
425  int getAttribute(std::string attName);
426 
427 protected:
428 
429  void setp( double e, double px, double py, double pz) {
430  _p.set(e,px,py,pz);
431  _pBeforeFSR=_p;
432  }
433 
434  void setp( const EvtVector4R& p4 ) {
435  _p =p4;
436  _pBeforeFSR=_p;
437  }
438 
439  void setpart_num(EvtId particle_number ) {
440  assert(_channel==-10||
441  _id.getId()==particle_number.getId()||
442  _id.getId()==-1);
443  _id = particle_number;
444  }
445  bool _validP4;
446 
447  // A typedef to define the attribute (name, integer) map
448  typedef std::map<std::string, int> EvtAttributeMap;
449 
450  EvtAttributeMap _attributes;
451 
452 private:
453 
454  EvtParticle* _daug[MAX_DAUG];
455  size_t _ndaug;
456  EvtParticle* _parent;
457  int _channel;
458  int _first;
459  EvtId _id;
460  EvtVector4R _p;
461  EvtVector4R _pBeforeFSR;
462  double _t;
463  bool _isInit;
464  bool _isDecayed;
465 
466  //bool _mix;
467 
468  EvtSpinDensity _rhoForward;
469  EvtSpinDensity _rhoBackward;
470 
471  void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep,
472  EvtSecondary& secondary,EvtId *stable_parent_ihep);
473  void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep);
474 
475 
476  //This is a hack until things gets straightened out. (Ryd)
477  int _genlifetime;
478 
479  //should never be used, therefor is private.
480  //these does _not_ have an implementation
481  EvtParticle& operator=(const EvtParticle& p);
482  EvtParticle(const EvtParticle& p);
483 
484  double *_decayProb;
485 
486 };
487 
488 #endif
489 
void setChannel(int i)
virtual EvtTensor4C epsTensorParent(int i) const
EvtSpinDensity getSpinDensityForward()
Definition: EvtParticle.hh:368
void setSpinDensityForward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:342
virtual EvtDiracSpinor sp(int) const
void setSpinDensityBackward(const EvtSpinDensity &rho)
Definition: EvtParticle.hh:373
EvtVector4R getP4Restframe() const
double mass() const
virtual EvtRaritaSchwinger spRSParent(int) const
const EvtVector4R & getP4() const
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle * getDaug(int i)
int getChannel() const
virtual EvtDiracSpinor spParentNeutrino() const
EvtVector4R getP4Lab() const
void insertDaugPtr(int idaug, EvtParticle *partptr)
Definition: EvtParticle.hh:229
EvtSpinDensity getSpinDensityBackward()
Definition: EvtParticle.hh:378
virtual EvtVector4C epsParent(int i) const
void makeDaughters(unsigned int ndaug, EvtId *id)
virtual EvtVector4C epsPhoton(int i)
virtual EvtVector4C epsParentPhoton(int i)
virtual EvtDiracSpinor spNeutrino() const
size_t getNDaug() const
Definition: EvtId.hh:27
EvtVector4R getP4LabBeforeFSR()
EvtVector4R get4Pos() const
virtual EvtVector4C eps(int i) const
double initializePhaseSpace(unsigned int numdaughter, EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
EvtParticle * getParent() const
void deleteTree()
virtual EvtSpinDensity rotateToHelicityBasis() const =0
int getPDGId() const
void setLifetime()
void addDaug(EvtParticle *node)
void decay()
EvtSpinType::spintype getSpinType() const
void setP4(const EvtVector4R &p4)
Definition: EvtParticle.hh:273
void printParticle() const
EvtId getId() const
int firstornot() const
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
virtual EvtRaritaSchwinger spRS(int) const
int getSpinStates() const
double getLifetime()
void setDiagonalSpinDensity()
virtual ~EvtParticle()
void printTree() const
virtual EvtDiracSpinor spParent(int) const
void makeStdHep(EvtStdHep &stdhep, EvtSecondary &secondary, EvtId *stable_parent_ihep)
virtual EvtTensor4C epsTensor(int i) const
EvtParticle * nextIter(EvtParticle *rootOfTree=0)
void setVectorSpinDensity()