77 int countfate [nfates];
78 double sigma [nfates];
79 double sigma_err [nfates];
80 string fatestr [nfates] =
" ";
93 for (
int k=0; k<nfates; k++) {
105 double kin_energy = 0.;
117 tree = dynamic_cast <TTree *> ( file.Get(
"gtree") );
118 ginuke = dynamic_cast <TTree *> ( file.Get(
"ginuke") );
130 tree->SetBranchAddress(
"gmcrec", &mcrec);
133 nev = (int) tree->GetEntries();
135 <<
"Processing " << nev <<
" events";
141 for(
int ievent = 0; ievent < nev; ievent++) {
144 tree->GetEntry(ievent);
152 probe_pdg =
event.Particle(0)->Pdg();
153 target_pdg =
event.Particle(1)->Pdg();
159 if(ievent<displayno) {
167 case 0: countfate[0]++;
break;
168 case 1: countfate[1]++;
break;
169 case 2: countfate[2]++;
break;
170 case 3: countfate[3]++;
break;
171 case 4: countfate[4]++;
break;
172 case 5: countfate[5]++;
break;
173 case 6: countfate[6]++;
break;
174 case 13: countfate[8]++;
break;
176 if (7<=fate && fate<=12) countfate[7]++;
179 <<
"Undefined fate from FindhAFate() : " << fate;
193 <<
"Found ginuke type file";
195 nev = (int) ginuke->GetEntries();
197 <<
"Processing " << nev <<
" events";
209 ginuke->SetBranchAddress(
"ke", &kin_energy);
210 ginuke->SetBranchAddress(
"probe",&probe_pdg );
211 ginuke->SetBranchAddress(
"tgt", &target_pdg);
212 ginuke->SetBranchAddress(
"nh", &numh );
213 ginuke->SetBranchAddress(
"npip", &numpip );
214 ginuke->SetBranchAddress(
"npi0", &numpi0 );
215 ginuke->SetBranchAddress(
"npim", &numpim );
216 ginuke->SetBranchAddress(
"pdgh", &pdg_had );
217 ginuke->SetBranchAddress(
"Eh", &E_had );
218 ginuke->SetBranchAddress(
"e", &energy );
221 for(
int ievent = 0; ievent < nev; ievent++) {
224 ginuke->GetEntry(ievent);
227 if (energy==E_had[0] && numh==1)
229 else if (energy!=E_had[0] && numh==1)
231 else if (
pdg::IsPion(probe_pdg) && numpip+numpi0+numpim==0)
233 else if ( (
pdg::IsNucleon(probe_pdg) && numpip+numpi0+numpim==0 && numh>2 )
234 || (probe_pdg==
kPdgGamma && energy!=E_had[0] && numpip+numpi0+numpim==0))
236 else if ( numpip+numpi0+numpim> (
pdg::IsPion(probe_pdg) ? 1 : 0) )
240 if ( (
pdg::IsPion(probe_pdg) && ( probe_pdg==pdg_had[0] || probe_pdg==pdg_had[1] ))
249 for (
int iter = 0; iter < numh; iter++)
251 if (probe_pdg==211 && pdg_had[iter]==-211) { index=8; undef=
false; }
252 else if (probe_pdg==-211 && pdg_had[iter]==211) { index=8; undef=
false; }
255 if (undef) { index=0; }
258 if (ievent<displayno) {
267 <<
"Could not read input file!";
276 const double dnev = (double) nev;
278 const double R0 = 1.4;
282 double nuclear_radius = NR * R0 * TMath::Power(A, 1./3.);
283 double area = TMath::Pi() * TMath::Power(nuclear_radius,2);
286 string probe_name = pdglib->
Find(probe_pdg)->GetName();
287 string target_name = pdglib->
Find(target_pdg)->GetName();
290 <<
" Probe = " << probe_name
291 <<
", KE = " << kin_energy <<
" GeV";
293 <<
" Target = " << target_name
294 <<
" (Z,A) = (" << Z <<
", " << A
295 <<
"), nuclear radius = " << nuclear_radius
296 <<
" fm, area = " << area <<
" fm**2 " <<
'\n';
299 int nullint = countfate[1];
301 double sigtoterr = 0;
302 double sigtotScat = 0;
303 double sigtotAbs = 0;
305 for(
int k=0; k<nfates; k++) {
307 cnttot += countfate[k];
308 double ratio = countfate[k]/dnev;
309 sigma[k] = fm2tomb * area * ratio;
310 sigma_err[k] = fm2tomb * area * TMath::Sqrt(ratio*(1-ratio)/dnev);
311 if(sigma_err[k]==0) {
312 sigma_err[k] = fm2tomb * area * TMath::Sqrt(countfate[k])/dnev;
316 <<
" --> " << setw(26) << fatestr[k]
317 <<
": " << setw(7) << countfate[k] <<
" events -> "
318 << setw(7) << sigma[k] <<
" +- " << sigma_err[k] <<
" (mb)" <<
'\n';
321 sigtotAbs += sigma[k];
325 sigtotScat += sigma[k];
330 sigtot = fm2tomb * area * cnttot/dnev;
331 sigtoterr = fm2tomb * area * TMath::Sqrt(cnttot)/dnev;
333 double sigtot_noelas = fm2tomb * area * (cnttot-countfate[3])/dnev;
334 double sigtoterr_noelas = fm2tomb * area * TMath::Sqrt(cnttot-countfate[3])/dnev;
336 double ratio_as = (sigtotScat==0) ? 0 : sigtotAbs/(
double)sigtotScat;
339 <<
"\n\n --------------------------------------------------- "
340 <<
"\n ==> " << setw(28) <<
" Total: " << setw(7) << cnttot
341 <<
" events -> " << setw(7) << sigtot <<
" +- " << sigtoterr <<
" (mb)"
342 <<
"\n (-> " << setw(28) <<
" Hadrons escaped nucleus: "
343 << setw(7) << nullint <<
" events)"
344 <<
"\n ==> " << setw(28) <<
" Ratio (abs/scat) = "
345 << setw(7) << ratio_as
346 <<
"\n ==> " << setw(28) <<
" avg. num of int. = "
347 << setw(7) << cnttot/dnev
348 <<
"\n ==> " << setw(28) <<
" no interaction = "
349 << setw(7) << (dnev-cnttot)/dnev
350 <<
"\n ------------------------------------------------------- \n";
355 bool file_exists=
false;
357 file_exists=test_file.is_open();
363 xsec_file <<
"#KE" <<
"\t" <<
"Undef" <<
"\t"
364 <<
"sig" <<
"\t" <<
"CEx" <<
"\t"
365 <<
"sig" <<
"\t" <<
"Elas" <<
"\t"
366 <<
"sig" <<
"\t" <<
"Inelas"<<
"\t"
367 <<
"sig" <<
"\t" <<
"Abs" <<
"\t"
368 <<
"sig" <<
"\t" <<
"KO" <<
"\t"
369 <<
"sig" <<
"\t" <<
"PiPro" <<
"\t"
370 <<
"sig" <<
"\t" <<
"DCEx" <<
"\t"
371 <<
"sig" <<
"\t" <<
"Reac" <<
"\t"
372 <<
"sig" <<
"\t" <<
"Tot" <<
"\t" <<
"sig" << endl;
374 xsec_file << kin_energy;
375 for(
int k=0; k<nfates; k++) {
377 xsec_file <<
"\t" << sigma[k] <<
"\t" << sigma_err[k];
379 xsec_file <<
"\t" << sigtot_noelas <<
"\t" << sigtoterr_noelas;
380 xsec_file <<
"\t" << sigtot <<
"\t" << sigtoterr << endl;
string gOptOutputFilename
virtual GHepParticle * Particle(int position) const
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object. Ntuples of this type are intended for feeding GENIE events into other applications (for example the GEANT4 based MC generation framework of an experiment) if no direct interface exists.
int IonPdgCodeToA(int pdgc)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
static constexpr double A
bool gOptWriteOutput
write out hadron cross sections
static constexpr double mb
static constexpr double fm2
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
double KinE(bool mass_from_pdg=false) const
Get kinetic energy.
Singleton class to load & serve a TDatabasePDG.
const char * AsString(Resonance_t res)
resonance id -> string
int IonPdgCodeToZ(int pdgc)
TParticlePDG * Find(int pdgc, bool must_exist=true)
void GetCommandLineArgs(int argc, char **argv)
void Clear(Option_t *opt="")
INukeFateHA_t FindhAFate(const GHepRecord *evrec)
GENIE's GHEP MC event record.
enum genie::EINukeFateHA_t INukeFateHA_t