24 double fspx,fspy,fspz,fse,fsrap,fspt,fsmass,p1x,p1y,p1z,p1e,p1prap;
25 double p2x,p2y,p2z,p2e,p2prap,p1pt,p2pt;
26 double targx, targy, targz, targE;
27 double sx, sy, sz, sE;
30 double kphoton,kperp,qsquared,xbj,ttransfer;
35 TNtuple *esNTuple =
new TNtuple(
"esNT",
"eslightNtuple",
"fspt:fspz:fsrap:fsmass:p1pt:p1z:p1prap:p2pt:p2z:p2prap:kg:qsq:xbj");
40 cout <<
" Opening slight.out"<< endl;
43 cout <<
"FileName=" << slightname << endl;
44 inFile.open( slightname.Data());
45 cout <<
"slight.out open"<<endl;
53 stringstream lineStream;
57 int eventNmb,nmbTracks, pcode;
58 int nev,ntr,stopv,pdgpid1,pdgpid2;
62 double gamma_e,gamma_ion,junk1;
64 if (!
getline(inFile,line)) {cout <<
" Error reading CONFIG_OPT line"<<endl;}
66 lineStream=stringstream(line);
70 if (!
getline(inFile,line)) {cout <<
" Error reading BEAM_1 line"<<endl;}
72 lineStream=stringstream(line);
73 lineStream>>label>>i1>>i2>>gamma_e;
74 cout<<
"Electron Lorentz boost is "<<gamma_e<<endl;
76 if (!
getline(inFile,line)) {cout <<
" Error reading BEAM_2 line"<<endl;}
78 lineStream=stringstream(line);
79 lineStream>>label>>i1>>i2>>gamma_ion;
80 cout <<
"Check... " << label <<
" " << i1 <<
" " << i2 <<
" " << gamma_ion << endl;
82 cout<<
"Ion Lorentz boost is "<<gamma_ion<<endl;
84 if (!
getline(inFile,line)) {cout <<
" Error reading PHOTON line"<<endl;}
86 lineStream=stringstream(line);
95 if (!
getline(inFile,line)) {
break;}
97 lineStream=stringstream(line);
98 lineStream>>label>>eventNmb>>nmbTracks;
99 if (!(label ==
"EVENT:"))
continue;
100 if (eventNmb < 5) {cout <<
"Reached Event "<<eventNmb<<endl;}
103 if (!
getline(inFile,line)) {
break;}
106 lineStream=stringstream(line);
109 if (!
getline(inFile,line)) {
break;}
110 lineStream=stringstream(line);
111 lineStream>>label>>kphoton>>qsquared;
113 if (!
getline(inFile,line)) {
break;}
114 lineStream=stringstream(line);
115 lineStream>>label>>ttransfer;
117 if (!
getline(inFile,line)) {
break;}
118 lineStream=stringstream(line);
119 lineStream>>label >> targx >> targy >> targz >> targE;
121 if (!
getline(inFile,line)) {
break;}
122 lineStream=stringstream(line);
123 lineStream>>label >> sx >> sy >> sz >> sE;
126 if (!
getline(inFile,line)) {
break;}
129 lineStream=stringstream(line);
130 lineStream>>label>>pcode>>p1x>>p1y>>p1z>>i1>>i2>>i3>>pdgpid1;
132 if (!
getline(inFile,line)) {
break;}
134 lineStream=stringstream(line);
136 lineStream>>label>>pcode>>p2x>>p2y>>p2z>>i1>>i2>>i3>>pdgpid2;
139 if (pdgpid1 != -pdgpid2)
140 { cout<<
"Error pdgpid codes don't match"<<pdgpid1<<
" "<<pdgpid2<<endl;
144 double pdgabs=
abs(pdgpid1);
146 if (pdgabs == 211) mfinal=0.139;
147 if (pdgabs == 11) mfinal=0.000511;
148 if (pdgabs == 13) mfinal=0.105;
149 if (pdgabs == 321) mfinal=0.494;
151 {cout<<
" Error final mass=0. pdgabs="<<pdgabs<<endl;
156 double p1=sqrt(p1x*p1x+p1y*p1y+p1z*p1z);
157 double e1=sqrt(p1*p1+mfinal*mfinal);
158 p1prap=0.5*log((p1+p1z)/(p1-p1z));
159 p1pt=sqrt(p1x*p1x+p1y*p1y);
161 double p2=sqrt(p2x*p2x+p2y*p2y+p2z*p2z);
162 double e2=sqrt(p2*p2+mfinal*mfinal);
163 p2prap=0.5*log((p2+p2z)/(p2-p2z));
164 p2pt=sqrt(p2x*p2x+p2y*p2y);
166 eTheta = TMath::ATan(TMath::Sqrt(sx*sx+sy*sy)/sz);
175 fspt=sqrt(fspx*fspx+fspy*fspy);
176 fsmass=sqrt(fse*fse-(fspx*fspx+fspy*fspy+fspz*fspz));
177 fsrap= 0.5*log((fse+fspz)/(fse-fspz));
181 double kphotontargetframe=kphoton*gamma_ion;
182 double mass = sqrt(fsmass*fsmass+qsquared*qsquared);
183 double xbjorken=mass/(2.*gamma_ion*0.939)*exp(fsrap);
186 esNTuple->Fill(fspt,fspz,fsrap,fsmass,p1pt,p1z,p1prap,p2pt,p2z,p2prap,kphoton,qsquared,xbjorken);
190 cout<<fspx<<fspy<<fspz<<fse<<fsrap<<fspt<<fsmass<<fsrap<<endl;
191 cout<<p1x<<p1y<<p1z<<p1prap<<
" "<<p1<<
" pt1="<<p1pt<<endl;
192 cout<<p2x<<p2y<<p2z<<p2prap<<
" "<<p2<<
" pt2="<<p2pt<<endl;
198 TString baseName = slightname.ReplaceAll(
".out",
".root");
199 TFile *NTfile =
new TFile(TString::Format(
"ntuple_%s",baseName.Data()),
"recreate");