49 ,_writeFullPythia(
false)
50 ,_writeFullHepMC3(
false)
72 _hepmc3writer->initWriter(_p);
74 std::cout <<
"***HepMC3 file format not written --- eStarlight not compiled with HepMC3 Enabled***" << std::endl;
86 _fileStream<<
"============================================"<<std::endl;
87 _fileStream<<
"I, ievent, genevent, subprocess, nucleon, targetparton, xtargparton, beamparton, xbeamparton, thetabeamprtn, truey, trueQ2, truex, trueW2, trueNu, leptonphi, s_hat, t_hat, u_hat, pt2_hat, Q2_hat, F2, F1, R, sigma_rad, SigRadCor, EBrems, photonflux, t-diff, nrTracks"<<std::endl;
88 _fileStream<<
"============================================"<<std::endl;
89 _fileStream<<
"I K(I,1) K(I,2) K(I,3) K(I,4) K(I,5) P(I,1) P(I,2) P(I,3) P(I,4) P(I,5) V(I,1) V(I,2) V(I,3)"<<std::endl;
90 _fileStream<<
"============================================"<<std::endl;
93 double p_mass = 0.93827;
94 double e_mass = 0.000511;
99 double _electronBeam_pz = -1.0*sqrt(_electronBeam_E*_electronBeam_E - e_mass*e_mass);
100 double _targetBeam_pz = sqrt(_targetBeam_E*_targetBeam_E - p_mass*p_mass);
116 int numberoftracks = 0;
119 numberoftracks =
event.getParticles()->size();
123 for(
unsigned int i = 0; i<
event.getParticles()->size(); ++i)
125 if(event.
getParticles()->at(i).getStatus() >= 0) numberoftracks++;
134 _fileStream <<
"EVENT: " << eventnumber <<
" " << numberoftracks <<
" " << 1 << std::endl;
136 _fileStream <<
"VERTEX: "<<0.<<
" "<<0.<<
" "<<0.<<
" "<<0.<<
" "<<1<<
" "<<0<<
" "<<0<<
" "<<numberoftracks<<std::endl;
138 for( uint igam = 0 ; igam <
event.getGammaEnergies()->size(); ++igam){
139 _fileStream <<
"GAMMA: "<<
event.getGammaEnergies()->at(igam)<<
" "<<
event.getGammaMasses()->at(igam)<<std::endl;
144 for( uint itarget = 0 ; itarget <
event.getTarget()->size(); ++itarget){
146 _fileStream <<
"t: "<<
event.getVertext()->at(itarget)<<std::endl;
149 for( uint iel = 0 ; iel <
event.getSources()->size(); ++iel){
155 std::vector<starlightParticle>::const_iterator
part = (
event.getParticles())->begin();
157 for (part = event.
getParticles()->begin(); part !=
event.getParticles()->end(); part++, ipart++)
161 if((*part).getStatus() < 0)
continue;
164 <<
" "<< (*part).GetPz() <<
" " << eventnumber <<
" " << ipart <<
" " << 0 <<
" "
165 << (*part).getPdgCode();
171 _fileStream <<
" " << (*part).getFirstParent() <<
" " << (*part).getLastParent() <<
" " << (*part).getFirstDaughter() <<
" " << (*part).getLastDaughter() <<
" " << (*part).getStatus();
180 _hepmc3writer->writeEvent(event,eventnumber);
191 _fileStream <<
"0 "<<eventnumber<<
" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"<<std::endl;
192 _fileStream<<
"============================================"<<std::endl;
195 uint lineNumberOfFirstElectronDaughter=3;
196 uint lineNumberOfLastElectronDaughter=4;
197 uint lineNumberOfFirstIonDaughter=6;
198 uint lineNumberOfLastIonDaughter=lineNumberOfFirstIonDaughter+
event.getParticles()->size();
199 uint numberOfElectrons =
event.getSources()->size();
200 uint numberOfIons =
event.getTarget()->size();
201 uint numberOfGammas =
event.getGammaEnergies()->size();
203 auto sp0 = std::setw(8);
204 auto sp1 = std::setw(14);
207 _fileStream <<particleIndex << sp0 <<21 << sp0 <<
_electronBeam_pdg_id_<<
" "<<0<<
" "<<lineNumberOfFirstElectronDaughter<<
" "<<lineNumberOfLastElectronDaughter<<
" " << std::setprecision(6) << sp1 <<_electronBeam_four_vector_[0]<<
" " << sp1 <<_electronBeam_four_vector_[1]<<
" " << sp1 <<_electronBeam_four_vector_[2]<<
" " <<sp1<<_electronBeam_four_vector_[3]<<
" "<<sp1<<electronmass<<
" 0 0 0"<<std::endl;
211 _fileStream <<particleIndex <<sp0<<21 << sp0 <<
_targetBeam_pdg_id_<<
" "<<0<<
" "<<lineNumberOfFirstIonDaughter<<
" "<<lineNumberOfLastIonDaughter<<
" " << sp1 <<_targetBeam_four_vector_[0]<<
" " <<sp1<<_targetBeam_four_vector_[1]<<
" " <<sp1<<_targetBeam_four_vector_[2]<<
" " <<sp1<<_targetBeam_four_vector_[3]<<
" "<<sp1<<ionmass<<
" 0 0 0"<<std::endl;
215 for( uint iel = 0 ; iel < numberOfElectrons; ++iel){
217 _fileStream <<particleIndex<<sp0<<21 <<sp0<<11<<
" "<<1<<
" "<<0<<
" "<<0<<
" " <<sp1<<el.
GetPx()<<
" " <<sp1<<el.
GetPy()<<
" " <<sp1<<el.
GetPz()<<
" " <<sp1<<el.
GetE()<<
" "<<sp1<<electronmass<<
" 0 0 0"<<std::endl;
221 for( uint igam = 0 ; igam < numberOfGammas; ++igam){
223 _fileStream <<particleIndex <<sp0<<21 <<sp0<<22<<
" "<<1<<
" "<<0<<
" "<<0<<
" " <<sp1<<gam.
GetPx()<<
" " <<sp1<<gam.
GetPy()<<
" " <<sp1<<gam.
GetPz()<<
" " <<sp1<<
event.getGammaEnergies()->at(igam)<<
" "<<sp1<<
event.getGammaMasses()->at(igam)<<
" 0 0 0"<<std::endl;
229 for( uint iel = 0 ; iel < numberOfElectrons; ++iel){
231 _fileStream <<particleIndex<<sp0<<1 <<sp0<<11<<
" "<<3<<
" "<<0<<
" "<<0<<
" " <<sp1<<el.
GetPx()<<
" " <<sp1<<el.
GetPy()<<
" " <<sp1<<el.
GetPz()<<
" " <<sp1<<el.
GetE()<<
" "<<sp1<<electronmass<<
" 0 0 0"<<std::endl;
236 for( uint itarget = 0 ; itarget < numberOfIons; ++itarget){
238 _fileStream <<particleIndex <<sp0<<1 <<sp0<<2212<<
" "<<2<<
" "<<lineNumberOfFirstIonDaughter<<
" "<<lineNumberOfLastIonDaughter<<
" " <<sp1<<target.
GetPx()<<
" " <<sp1<<target.
GetPy()<<
" " <<sp1<<target.
GetPz()<<
" " <<sp1<<target.
GetE()<<
" "<<sp1<<ionmass<<
" 0 0 0"<<std::endl;
244 std::vector<starlightParticle>::const_iterator
part = (
event.getParticles())->begin();
246 for (part = event.
getParticles()->begin(); part !=
event.getParticles()->end(); part++, ipart++)
248 _fileStream <<particleIndex <<sp0<<1 <<sp0<<(*part).getPdgCode()<<
" "<<2<<
" "<<0<<
" "<<0<<
" " <<sp1<<(*part).GetPx()<<
" " <<sp1<<(*part).GetPy()<<
" " <<sp1<<(*part).GetPz()<<
" " <<sp1<<(*part).GetE()<<
" "<<sp1<<(*part).M()<<
" 0 0 0"<<std::endl;
253 _fileStream<<
"=============== Event finished ==============="<<std::endl;
263 _hepmc3writer->close();
271 catch (
const ios::failure & error)
273 cerr <<
"I/O exception: " << error.what() << endl;