//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtGen.cc // // Description: Main class to provide user interface to EvtGen. // // Modification history: // // RYD March 24, 1998 Module created // //------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include #include #include #include "EvtGenBase/EvtComplex.hh" #include #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtVector4R.hh" #include "EvtGenBase/EvtVectorParticle.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtScalarParticle.hh" #include "EvtGenBase/EvtDecayTable.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtStdHep.hh" #include "EvtGenBase/EvtSecondary.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtRandomEngine.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #include "EvtGenBase/EvtParticleFactory.hh" //#include "CLHEP/Vector/LorentzVector.h" #include "TLorentzVector.h" #include "EvtGenModels/EvtModelReg.hh" #include "EvtGenBase/EvtStatus.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtRadCorr.hh" #include "EvtGenModels/EvtPHOTOS.hh" using std::endl; using std::fstream; using std::ifstream; extern "C" void begevtgenstore_(int *,int *,int *,int *, int *,int *,int *,int *,int *, double *,double *,double *, double *,double *,double *, double *,double *,double *); extern "C" { extern void evtgen_(float svertex[3],float *e_cms,float *beta_zs, int *mode); } EvtGen::~EvtGen(){ //This is a bit uggly, should not do anything //in a destructor. This will fail if EvtGen is made a static //because then this destructor might be called _after_ //the destructoin of objects that it depends on, e.g., EvtPDL. if (getenv("EVTINFO")){ EvtDecayTable::printSummary(); } } EvtGen::EvtGen(const char* const decayName, const char* const pdtTableName, EvtRandomEngine* randomEngine, EvtAbsRadCorr* isrEngine, const std::list* extraModels){ report(INFO,"EvtGen") << "Initializing EvtGen"<Decay(); evtStdHep->init(); p->makeStdHep(*evtStdHep); evtStdHep->translate(D); p->deleteTree(); } void EvtGen::generateDecay(EvtParticle *p){ int times=0; do{ times+=1; EvtStatus::initRejectFlag(); p->decay(); //ok then finish. if ( EvtStatus::getRejectFlag()==0 ) { times=0; } else{ for (size_t ii=0;iigetNDaug();ii++){ EvtParticle *temp=p->getDaug(ii); temp->deleteTree(); } p->resetFirstOrNot(); p->resetNDaug(); } if ( times==10000) { report(ERROR,"EvtGen") << "Your event has been rejected 10000 times!"<init(EvtPDL::evtIdFromStdHep(stdhepid),p_init); root_part=(EvtParticle *)vector_part; root_part->setVectorSpinDensity(); generateEvent(root_part,D); root_part->deleteTree(); } //void EvtGen::generateEvent(EvtParticle *root_part,CLHEP::HepLorentzVector D){ void EvtGen::generateEvent(EvtParticle *root_part,TLorentzVector D){ int i; static int nevent=0; nevent++; static EvtStdHep evtstdhep; // static EvtSecondary evtsecondary; int j; int istat; int partnum; double px,py,pz,e,m; double x,y,z,t; EvtVector4R p4,x4; generateDecay(root_part); // root_part->Decay(); int npart=0; EvtId list_of_stable[10]; EvtParticle* stable_parent[10]; list_of_stable[0]=EvtId(-1,-1); stable_parent[0]=0; evtstdhep.init(); // evtsecondary.init(); // root_part->makeStdHep(evtstdhep,evtsecondary,list_of_stable); root_part->makeStdHep(evtstdhep); //report(INFO,"EvtGen") << evtstdhep; //report(INFO,"EvtGen") << evtsecondary; npart=evtstdhep.getNPart(); for(i=0;i