// // Sample test program for running EvtGen // // Created 17/10/2006 by Stefano Spataro // #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtPatches.hh" #include #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtStdHep.hh" #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" #include #include #include #include using std::endl; using std::ofstream; using std::cout; //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(); } int main(int argc, char* argv[]){ EvtStdHep evtstdhep; EvtParticle *parent; if (argc<3) { cout << "\nUSAGE: simpleEvtGen <# events> \n" << endl; cout << " = particle type to decay, e.g. 'eta_c', 'pbarpSystem' etc."< = EvtGen decay file (.DEC) to use; see directory 'test' for examples"< = number of events to produce; default value = 10"< = (>0) momentum of the pbar beam; (<0) negativ cms energy; default value = mass of "< = pbarpSystem\n"<=4) number=atoi(argv[3]); if (std::string(argv[1])=="pbarpSystem" && argc<5) { cout <<"\n****** FATAL ERROR: is 'pbarpSystem'; MUST give pbar momentum or cms energy!\n\n"<=5) // { // cout <<"\n****** WARNING: overriding given momentum, setting cms energy to mass of "<=5) val=atof(argv[4]); else val=-EvtPDL::getMass(PART); // val is the momentum of the pbar beam if (val>0){ P = val; E = mp+sqrt(P*P+mp*mp); } else //val is -E_cm { val=-val; E = val*val/(2*mp); P = sqrt(E*E-val*val); } cout <<"\n\n############# Generating with following conditions:\n\n"; cout <<"particle : '"<setDiagonalSpinDensity(); // Generate the event myGenerator.generateDecay(parent); // Write out the results evtstdhep.init(); parent->makeStdHep(evtstdhep); //print out some status info if (i<10) report(INFO,"EvtGen") << "event Number\t"<< i << evtstdhep << endl; if (!((i+1)%100)) report(INFO,"EvtGen") << "event Number\t"<deleteTree(); } out.close(); return 1; }