00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EVTPARTICLE_HH
00022 #define EVTPARTICLE_HH
00023
00024
00025 #include <assert.h>
00026 #include "EvtGenBase/EvtVector4R.hh"
00027 #include "EvtGenBase/EvtSpinDensity.hh"
00028 #include "EvtGenBase/EvtId.hh"
00029 #include "EvtGenBase/EvtSpinType.hh"
00030 #include <string>
00031 #include "EvtGenModels/EvtGlobalSet.hh"
00032 class EvtDiracSpinor;
00033 class EvtVector4C;
00034 class EvtTensor4C;
00035 class EvtStdHep;
00036 class EvtSecondary;
00037
00038 const int MAX_DAUG =100;
00039 const int MAX_LEVEL=10;
00040 const int MAX_TRIES=10000;
00041
00042 class EvtParticle{
00043
00044 public:
00045
00049 EvtParticle();
00050
00054 virtual ~EvtParticle();
00055
00059 virtual EvtVector4C epsParent(int i) const;
00060
00064 virtual EvtVector4C eps(int i) const;
00065
00066
00070 virtual EvtVector4C epsParentPhoton(int i);
00071
00075 virtual EvtVector4C epsPhoton(int i);
00076
00077
00081 virtual EvtDiracSpinor spParent(int) const;
00082
00086 virtual EvtDiracSpinor sp(int) const;
00087
00088
00089
00093 virtual EvtDiracSpinor spParentNeutrino() const;
00094
00099 virtual EvtDiracSpinor spNeutrino() const;
00100
00101
00105 virtual EvtTensor4C epsTensorParent(int i) const;
00106
00110 virtual EvtTensor4C epsTensor(int i) const;
00111
00115 virtual void init(EvtId part_n,const EvtVector4R& p4)=0;
00116
00120 void addDaug(EvtParticle *node);
00121
00125 void decay();
00126
00130 void deleteTree();
00131 void deleteDaughters(bool keepChannel=false);
00132
00136 void setChannel( int i );
00137
00141 void setGeneratorFlag(int flag){_generatorFlag = flag;}
00142
00146 int getGeneratorFlag(){ return _generatorFlag ;}
00147
00151 void setIntFlag(std::vector<int> vi){
00152 _intFlag=vi;
00153 }
00154
00158 std::vector<int> getIntFlag(){
00159 return _intFlag;
00160 }
00161
00167 void makeDaughters(int ndaug,EvtId *id);
00168
00174 double initializePhaseSpace(int numdaughter,EvtId *daughters,
00175 double poleSize=-1., int whichTwo1=0,
00176 int whichTwo2=1);
00177
00181 EvtParticle *getDaug(int i);
00182
00186 EvtParticle *nextIter(EvtParticle *rootOfTree=0);
00187
00191 void makeStdHep(EvtStdHep& stdhep,
00192 EvtSecondary& secondary,EvtId *stable_parent_ihep);
00193 void makeStdHep(EvtStdHep& stdhep);
00194
00199 EvtVector4R getP4Lab();
00200
00205 EvtVector4R getP4Restframe();
00206
00210 EvtVector4R get4Pos();
00211
00215 EvtParticle *getParent();
00216
00220 void insertDaugPtr(int idaug,EvtParticle* partptr){ _daug[idaug]=partptr;
00221 partptr->_parent=this; }
00225 double mass() const;
00226
00230 int firstornot() const;
00231 void setFirstOrNot();
00232 void resetFirstOrNot();
00233
00237 EvtId getId() const;
00238
00243 EvtSpinType::spintype getSpinType() const;
00244
00248 int getSpinStates() const;
00249
00253 const EvtVector4R& getP4() const;
00254
00258 void setP4(const EvtVector4R& p4){_p=p4;}
00259
00263 int getChannel() const;
00264
00268 int getNDaug() const;
00269 void resetNDaug() {_ndaug=0; return;}
00270
00276 void printTree() const;
00277
00278 void printTreeRec(int level) const;
00279 std::string writeTreeRec(std::string ) const;
00280
00281 void dumpTree( ) const;
00282 void dumpTreeRec(int level,int dj) const;
00283
00284 std::string treeStr() const;
00285 std::string treeStrRec(int level) const;
00286
00290 void printParticle() const;
00291
00295 void setLifetime(double tau);
00296
00300 void setLifetime();
00301
00305 double getLifetime();
00306
00310 void setDiagonalSpinDensity();
00311
00315 void setVectorSpinDensity();
00316
00317 void setPolarizedSpinDensity(double r00,double r11,double r22);
00321 void setSpinDensityForward(const EvtSpinDensity& rho){_rhoForward=rho;}
00322
00327 void setSpinDensityForwardHelicityBasis(const EvtSpinDensity& rho);
00328 void setSpinDensityForwardHelicityBasis(const EvtSpinDensity& rho,
00329 double alpha,
00330 double beta,
00331 double gamma);
00332
00339 virtual EvtSpinDensity rotateToHelicityBasis() const=0;
00340 virtual EvtSpinDensity rotateToHelicityBasis(double alpha,
00341 double beta,
00342 double gamma) const=0;
00343
00347 EvtSpinDensity getSpinDensityForward(){return _rhoForward;}
00348
00352 void setSpinDensityBackward(const EvtSpinDensity& rho){_rhoBackward=rho;}
00353
00357 EvtSpinDensity getSpinDensityBackward(){return _rhoBackward;}
00358
00359
00360
00361
00362 void noLifeTime() { _genlifetime=0; }
00363
00364
00365 void setId(EvtId id) { _id=id;}
00366 void initDecay(bool useMinMass=false);
00367 void generateMassTree();
00368
00369 double compMassProb();
00370
00371
00372 void setMass(double m) { _p=EvtVector4R(m,0.0,0.0,0.0);}
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 bool isInitialized() {return _isInit;}
00383 bool hasValidP4() {return _validP4;}
00384 bool isDecayed() {return _isDecayed;}
00385
00386
00387
00388
00389
00390 double* decayProb() {return _decayProb;}
00391 void setDecayProb( double p);
00392
00393 void setInclusiveMode(int im){_inclusiveMode=im ;}
00394 int getInclusiveMode(){return _inclusiveMode;}
00395
00396 protected:
00397
00398 void setp( double e, double px, double py, double pz) { _p.set(e,px,py,pz); }
00399 void setp( const EvtVector4R& p4 ) { _p =p4; }
00400 void setpart_num(EvtId particle_number )
00401 {
00402 assert(_channel==-10||
00403 _id.getId()==particle_number.getId()||
00404 _id.getId()==-1);
00405 _id = particle_number;
00406 }
00407 bool _validP4;
00408
00409 private:
00410
00411 EvtParticle* _daug[MAX_DAUG];
00412 int _ndaug;
00413 EvtParticle* _parent;
00414 int _channel;
00415 int _first;
00416 EvtId _id;
00417 EvtVector4R _p;
00418 double _t;
00419 bool _isInit;
00420 bool _isDecayed;
00421 int _generatorFlag;
00422
00423
00424 EvtSpinDensity _rhoForward;
00425 EvtSpinDensity _rhoBackward;
00426
00427 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep,
00428 EvtSecondary& secondary,EvtId *stable_parent_ihep);
00429 void makeStdHepRec(int firstparent,int lastparent,EvtStdHep& stdhep);
00430
00431
00432
00433 int _genlifetime;
00434
00435
00436
00437 EvtParticle& operator=(const EvtParticle& p);
00438 EvtParticle(const EvtParticle& p);
00439
00440 double *_decayProb;
00441
00442
00443 int _inclusiveMode;
00444
00445 std::vector<int> _intFlag;
00446
00447
00448 };
00449
00450 std::string IntToStr( int a);
00451 #endif
00452