// ------------------------------------------------------------------------- // ----- PndEvtGenDirect source file ----- // ----- ----- // ------------------------------------------------------------------------- #include #include "TClonesArray.h" #include "TFile.h" #include "TLorentzVector.h" #include "TTree.h" #include "TVector3.h" #include "TParticle.h" #include "PndEvtGenDirect.h" #include "FairPrimaryGenerator.h" #include "TRandom.h" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtStdHep.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtRandomEngine.hh" #include "EvtGenBase/EvtReport.hh" #include #include #include using namespace std; using std::endl; using std::ofstream; using std::cout; #include "TRandom3.h" //Define random number fcn used by Jetset extern "C" { extern float rlu_(); extern float begran_(int *); } float rlu_(){ return EvtRandom::Flat(); } float begran_(int *){ return EvtRandom::Flat(); } //define class for generating random nubers class EvtRootRandomEngine:public EvtRandomEngine{ public: EvtRootRandomEngine(int s=0) {seed=s;} double random(); int seed; }; double EvtRootRandomEngine::random(){ static TRandom3 randengine(seed); return randengine.Rndm(); } // ----- Default constructor ------------------------------------------ PndEvtGenDirect::PndEvtGenDirect() { fStoreTree=false; } // ------------------------------------------------------------------------ // ----- Standard constructor ----------------------------------------- PndEvtGenDirect::PndEvtGenDirect(TString particle,TString decfile,Double_t Mom, Long_t Seed) { cout << " PndEvtGenDirect"< Particle: "< decfile: "< pbar-Momentum: "< Rnd Seed: "<=0) myRandomEngine=new EvtRootRandomEngine(Seed); myGenerator=new EvtGen("DECAY.DEC","evt.pdl",myRandomEngine); //If I wanted a user decay file, I would read it in now. if(decfile!="") myGenerator->readUDecay(decfile.Data()); PART=EvtPDL::getId(std::string(particle.Data())); if (particle=="pbarpSystem" && Mom==0) { cout <<"\n****** FATAL ERROR: is 'pbarpSystem'; MUST give pbar momentum or cms energy!\n\n"<0) val=Mom; else val=-EvtPDL::getMass(PART); // val is the momentum of the pbar beam if (val>0){ fMomentum = val; fEnergy = mp+sqrt(fMomentum*fMomentum+mp*mp); } else //val is -E_cm { val=-val; fEnergy = val*val/(2*mp); fMomentum = sqrt(fEnergy*fEnergy-val*val); } cout <<"\n############# Generating with following conditions:\n\n"; cout <<"incident 4-mom : ("<setDiagonalSpinDensity(); // Generate the event myGenerator->generateDecay(parent); // Write out the results evtstdhep.init(); parent->makeStdHep(evtstdhep); Bool_t plotflag; plotflag=false; //print out some status info if (evtnr<10 || ((evtnr+1)%100)==0){ cout << "PndEvtGenDirect::ReadEvent "<printParticle(); report(INFO,"EvtGen") << "event Number\t"<< evtnr << evtstdhep << endl; cout << evtnr << "\t" << evtstdhep.getNPart(); cout < %f %f %f (%f) ID %d ##Daughters %d %d Mothers %d %d\n", fX, fY, fZ, fT,Px, Py, Pz, fE, Id, nFD, nLD,evtstdhep.getFirstMother(i),evtstdhep.getLastMother(i)); // if(fStoreTree){ // not yet supported! // primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ, evtstdhep.getFirstMother(i),(nFD==-1 && nLD==-1)); // }else{ primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ);// default -1, true // } } } if(plotflag) cout <<"==== compare end ==="<deleteTree(); evtnr++; return kTRUE; } // ------------------------------------------------------------------------ ClassImp(PndEvtGenDirect)