EvtGen Class Reference

#include <EvtGen.hh>

List of all members.

Public Member Functions

 EvtGen (const char *const decayName, const char *const pdtTableName, EvtRandomEngine *randomEngine=0, EvtAbsRadCorr *isrEngine=0)
 ~EvtGen ()
void readUDecay (const char *const udecay_name)
void generateDecay (int stdhepid, EvtVector4R P, EvtVector4R D, EvtStdHep *evtStdHep, EvtSpinDensity *spinDensity=0)
void generateDecay (EvtParticle *p)
void generateEvent (int stdhepid, HepLorentzVector P, HepLorentzVector D)
void generateEvent (EvtParticle *p, HepLorentzVector D)

Private Attributes

EvtPDL _pdl


Detailed Description

Definition at line 46 of file EvtGen.hh.


Constructor & Destructor Documentation

EvtGen::EvtGen ( const char *const   decayName,
const char *const   pdtTableName,
EvtRandomEngine randomEngine = 0,
EvtAbsRadCorr isrEngine = 0 
)

Definition at line 77 of file EvtGen.cc.

References _pdl, Bes_Common::INFO, EvtDecayTable::readDecayFile(), EvtPDL::readPDT(), report(), EvtRadCorr::setRadCorrEngine(), and EvtRandom::setRandomEngine().

00080                                         {
00081 
00082 
00083   report(INFO,"EvtGen") << "Initializing EvtGen"<<endl;
00084 
00085   report(INFO,"EvtGen") << "Storing known decay models"<<endl;
00086   EvtModelReg dummy;
00087 
00088   report(INFO,"EvtGen") << "Main decay file name  :"<<decayName<<endl;
00089   report(INFO,"EvtGen") << "PDT table file name   :"<<pdtTableName<<endl;
00090   
00091   report(INFO,"EvtGen") << "Initializing RadCorr=PHOTOS"<<endl;
00092   if (isrEngine==0){
00093     static EvtPHOTOS defaultRadCorrEngine;
00094     EvtRadCorr::setRadCorrEngine(&defaultRadCorrEngine);
00095     report(INFO,"EvtGen") <<"No RadCorr engine given in "
00096                           <<"EvtGen::EvtGen constructor, "
00097                           <<"will use default EvtPHOTOS."<<endl;
00098   }
00099   else{
00100     EvtRadCorr::setRadCorrEngine(isrEngine);    
00101   }
00102 
00103   _pdl.readPDT(pdtTableName);
00104 
00105 
00106   ifstream indec;
00107 
00108   EvtDecayTable::readDecayFile(decayName);
00109 
00110   if (randomEngine==0){
00111     static EvtRandomEngine defaultRandomEngine;
00112     EvtRandom::setRandomEngine(&defaultRandomEngine);
00113     report(INFO,"EvtGen") <<"No random engine given in "
00114                           <<"EvtGen::EvtGen constructor, "
00115                           <<"will use default EvtRandomEngine."<<endl;
00116   }
00117   else{
00118     EvtRandom::setRandomEngine(randomEngine);    
00119   }
00120 
00121   report(INFO,"EvtGen") << "Done initializing EvtGen"<<endl;
00122 
00123 }

EvtGen::~EvtGen (  ) 

Definition at line 64 of file EvtGen.cc.

References EvtDecayTable::printSummary().

00064                {
00065 
00066   //This is a bit uggly, should not do anything
00067   //in a destructor. This will fail if EvtGen is made a static
00068   //because then this destructor might be called _after_
00069   //the destructoin of objects that it depends on, e.g., EvtPDL.
00070 
00071   if (getenv("EVTINFO")){
00072     EvtDecayTable::printSummary();
00073   }
00074 
00075 }


Member Function Documentation

void EvtGen::generateDecay ( EvtParticle p  ) 

Definition at line 183 of file EvtGen.cc.

References EvtParticle::decay(), calibUtil::ERROR, EvtParticle::getDaug(), EvtParticle::getNDaug(), EvtStatus::getRejectFlag(), EvtStatus::initRejectFlag(), report(), EvtParticle::resetFirstOrNot(), EvtParticle::resetNDaug(), and subSeperate::temp.

00183                                         {
00184 
00185   int times=0;
00186   do{
00187     times+=1;
00188     EvtStatus::initRejectFlag();
00189     p->decay();
00190     //ok then finish.
00191     if ( EvtStatus::getRejectFlag()==0 ) { 
00192       times=0;
00193     }
00194     else{   
00195       
00196       int ii;
00197       for (ii=0;ii<p->getNDaug();ii++){
00198         EvtParticle *temp=p->getDaug(ii);
00199         temp->deleteTree();
00200       }
00201       p->resetFirstOrNot();
00202       p->resetNDaug();
00203       
00204     }
00205 
00206     if ( times==10000) {
00207       report(ERROR,"EvtGen") << "Your event has been rejected 10000 times!"<<endl;
00208       report(ERROR,"EvtGen") << "Will now abort."<<endl;
00209       ::abort();
00210       times=0;
00211     }
00212   } while (times);
00213 
00214 }

void EvtGen::generateDecay ( int  stdhepid,
EvtVector4R  P,
EvtVector4R  D,
EvtStdHep evtStdHep,
EvtSpinDensity spinDensity = 0 
)

Definition at line 152 of file EvtGen.cc.

References EvtParticle::deleteTree(), EvtPDL::evtIdFromStdHep(), EvtStdHep::init(), EvtParticle::makeStdHep(), P(), EvtParticleFactory::particleFactory(), and EvtStdHep::translate().

Referenced by EvtDecay::CalAmpsMax(), EvtDecay::callBesEvtGen(), EvtDecay::callEvtGen(), EvtDecay::FinalState_make(), EvtDecay::findPart(), generateEvent(), and EvtDecay::SuperBody3decay_make().

00156                                                         {
00157 
00158  
00159   EvtParticle *p;
00160 
00161   if(spinDensity==0){    
00162     p=EvtParticleFactory::particleFactory(EvtPDL::evtIdFromStdHep(stdhepid),P);
00163   }
00164   else{
00165     p=EvtParticleFactory::particleFactory(EvtPDL::evtIdFromStdHep(stdhepid),
00166                                           P,*spinDensity);
00167   }
00168 
00169   generateDecay(p);
00170   //  p->Decay();
00171 
00172   evtStdHep->init();
00173 
00174   p->makeStdHep(*evtStdHep);
00175   
00176   evtStdHep->translate(D);
00177   
00178   p->deleteTree();
00179 
00180 
00181 }

void EvtGen::generateEvent ( EvtParticle p,
HepLorentzVector  D 
)

Definition at line 240 of file EvtGen.cc.

References begevtgenstore_(), generateDecay(), EvtVector4R::get(), EvtStdHep::getFirstDaughter(), EvtStdHep::getFirstMother(), EvtStdHep::getIStat(), EvtStdHep::getLastDaughter(), EvtStdHep::getLastMother(), EvtStdHep::getNPart(), EvtStdHep::getP4(), EvtStdHep::getStdHepID(), EvtStdHep::getX4(), genRecEmupikp::i, EvtStdHep::init(), ganga-rec::j, EvtParticle::makeStdHep(), EvtVector4R::mass(), t(), and x.

00240                                                                    {
00241   int i;  
00242   static int nevent=0;
00243   nevent++;  
00244 
00245   static EvtStdHep evtstdhep;
00246   //  static EvtSecondary evtsecondary;
00247 
00248   int j;
00249   int istat;
00250   int partnum;
00251   double px,py,pz,e,m;
00252   double x,y,z,t;
00253 
00254   EvtVector4R p4,x4;
00255   generateDecay(root_part);
00256   //  root_part->Decay();
00257   int          npart=0;
00258   EvtId        list_of_stable[10];
00259   EvtParticle* stable_parent[10];
00260     
00261     
00262   list_of_stable[0]=EvtId(-1,-1);
00263   stable_parent[0]=0;
00264 
00265   evtstdhep.init();
00266   //  evtsecondary.init();
00267   // root_part->makeStdHep(evtstdhep,evtsecondary,list_of_stable);
00268   root_part->makeStdHep(evtstdhep);
00269 
00270   //report(INFO,"EvtGen") << evtstdhep;
00271   //report(INFO,"EvtGen") << evtsecondary;
00272   
00273   npart=evtstdhep.getNPart();
00274   for(i=0;i<evtstdhep.getNPart();i++){
00275 
00276     j=i+1;
00277 
00278     int jmotherfirst=evtstdhep.getFirstMother(i)+1;
00279     int jmotherlast=evtstdhep.getLastMother(i)+1;
00280     int jdaugfirst=evtstdhep.getFirstDaughter(i)+1;
00281     int jdauglast=evtstdhep.getLastDaughter(i)+1;
00282 
00283     partnum=evtstdhep.getStdHepID(i);
00284 
00285     istat=evtstdhep.getIStat(i);
00286 
00287     p4=evtstdhep.getP4(i);
00288     x4=evtstdhep.getX4(i);
00289     px=p4.get(1);
00290     py=p4.get(2);
00291     pz=p4.get(3);
00292     e=p4.get(0);
00293           
00294     x=x4.get(1)+D.x();
00295     y=x4.get(2)+D.y();
00296     z=x4.get(3)+D.z();
00297     t=x4.get(0)+D.t();
00298       
00299     m=p4.mass();
00300 
00301     begevtgenstore_(&j,&nevent,&npart,&istat,
00302                     &partnum,&jmotherfirst,&jmotherlast,
00303                     &jdaugfirst,&jdauglast,
00304                     &px,&py,&pz,&e,
00305                     &m,&x,&y,&z,&t);
00306   }
00307 
00308 }

void EvtGen::generateEvent ( int  stdhepid,
HepLorentzVector  P,
HepLorentzVector  D 
)

Definition at line 218 of file EvtGen.cc.

References EvtParticle::deleteTree(), EvtPDL::evtIdFromStdHep(), EvtVectorParticle::init(), EvtVector4R::set(), and EvtParticle::setVectorSpinDensity().

00218                                                                             {
00219 
00220   EvtParticle *root_part;
00221   EvtVectorParticle *vector_part;
00222   
00223   vector_part=new EvtVectorParticle;
00224   EvtVector4R p_init;
00225 
00226   p_init.set(P.t(),P.x(),P.y(),P.z());
00227 
00228   vector_part->init(EvtPDL::evtIdFromStdHep(stdhepid),p_init);
00229   
00230   root_part=(EvtParticle *)vector_part;
00231   
00232   root_part->setVectorSpinDensity();      
00233 
00234   generateEvent(root_part,D);
00235 
00236   root_part->deleteTree();  
00237 
00238 }

void EvtGen::readUDecay ( const char *const   udecay_name  ) 

Definition at line 126 of file EvtGen.cc.

References Bes_Common::INFO, EvtDecayTable::readDecayFile(), and report().

Referenced by EvtDecay::initialize().

00126                                                    {
00127 
00128   ifstream indec;
00129 
00130   if ( uDecayName[0] == 0) {
00131     report(INFO,"EvtGen") << "Is not reading a user decay file!"<<endl;
00132   }
00133   else{  
00134     indec.open(uDecayName);
00135     if (indec) {
00136       EvtDecayTable::readDecayFile(uDecayName);
00137       
00138       report(INFO,"EvtGen") << "Reading "<<uDecayName
00139                             <<" to override decay table."<<endl;
00140     }    
00141     else{
00142       
00143       report(INFO,"EvtGen") << "Can not find UDECAY file '"
00144                             <<uDecayName<<"'.  Stopping"<<endl;
00145       ::abort();
00146     }
00147   }
00148   
00149 }


Member Data Documentation

EvtPDL EvtGen::_pdl [private]

Definition at line 69 of file EvtGen.hh.

Referenced by EvtGen().


Generated on Tue Nov 29 23:19:00 2016 for BOSS_7.0.2 by  doxygen 1.4.7