11 #include "HepMCInterface.h"
15 #include "HepMCEvent.H"
24 using namespace Pythia8;
25 using namespace Photospp;
38 double px=0.0,py=0.0,
pz=0.0,e=0.0;
40 for ( HepMC::GenEvent::particle_const_iterator
p = evt->particles_begin();
41 p != evt->particles_end(); ++
p )
43 if( (*p)->status() == 1 )
45 HepMC::FourVector
m = (*p)->momentum();
54 cout.setf(ios_base::floatfield);
55 cout<<endl<<
"Vector Sum: "<<px<<
" "<<py<<
" "<<
pz<<
" "<<e<<endl;
62 for(HepMC::GenEvent::particle_const_iterator
p=evt->particles_begin();
p!=evt->particles_end();
p++)
65 HepMC::GenParticle *
pt = *
p;
66 int id=(* pt->production_vertex()->particles_in_const_begin() )->pdg_id();
67 if(
id!=21 &&
id!=11 &&
id>5)
continue;
70 HepMC::GenParticle *
X = (* pt->production_vertex()->particles_in_const_begin());
71 HepMC::GenParticle *
Y = (* ++(pt->production_vertex()->particles_in_const_begin()) );
72 HepMC::FourVector
fX = X->momentum();
73 HepMC::FourVector
fY = Y->momentum();
74 HepMC::FourVector fXY(fX.px()+fY.px(),fX.py()+fY.py(),fX.pz()+fY.pz(),fX.e()+fY.e());
81 (* Y->production_vertex()->particles_in_const_begin())->set_status(1);
82 pt->production_vertex()->remove_particle(Y);
87 int main(
int argc,
char **argv)
93 cout<<endl<<
"Usage: "<<argv[0]<<
" <pythia_conf> <pythia_mode> <no_events> [ <special_mode> ]"<<endl;
94 cout<<endl<<
" eg. "<<argv[0]<<
" pythia_W.conf 0 10000 4 0"<<endl;
99 HepMC::I_Pythia8 ToHepMC;
103 Event&
event = pythia.event;
105 pythia.readString(
"HadronLevel:Hadronize = off");
106 pythia.readString(
"SpaceShower:QEDshower = off");
107 pythia.readString(
"SpaceShower:QEDshowerByL = off");
108 pythia.readString(
"SpaceShower:QEDshowerByQ = off");
109 pythia.readString(
"PartonLevel:ISR = off");
110 pythia.readString(
"PartonLevel:FSR = off");
134 if(argc>1) pythia.readFile(argv[1]);
137 if(atoi(argv[2])==0) pythia.init( 11, -11, 200.);
138 else if(atoi(argv[2])==1) pythia.init( 11, -11, 91.187);
139 else pythia.init( -2212, -2212, 14000.0);
146 Photos::setInfraredCutOff(1.e-6);
147 Photos::maxWtInterference(3.0);
149 bool topDecays =
false;
155 if(atoi(argv[4])==1) topDecays=
true;
157 else if(atoi(argv[4])==2)
159 Photos::setMeCorrectionWtForW(
true);
160 Photos::setMeCorrectionWtForZ(
true);
166 if(argc>5 && atoi(argv[5])==1)
168 Photos::setDoubleBrem(
false);
169 Photos::setExponentiation(
false);
170 Photos::setInfraredCutOff(0.001);
171 Photos::maxWtInterference(2.0);
180 Log::SummaryAtExit();
181 cout.setf(ios::fixed);
186 if(iEvent%1000==0) Log::Info()<<
"Event: "<<iEvent<<
"\t("<<iEvent*(100./
NumberOfEvents)<<
"%)"<<endl;
187 if (!pythia.next())
continue;
189 HepMC::GenEvent * HepMCEvt =
new HepMC::GenEvent();
190 ToHepMC.fill_next_event(event, HepMCEvt);
195 cout<<
"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
212 HepMCEvent temp_event(*HepMCEvt,
false);
213 MC_Analyze(&temp_event);
void fixForMctester(HepMC::GenEvent *evt)
int main(int argc, char **argv)
TString pt(TString pts, TString exts="px py pz")
void checkMomentumConservationInEvent(PhotosHEPEVTEvent *evt)