nuint09_coh1.C
Go to the documentation of this file.
1 //
2 // NuINT09 Conference, Benchmark Calculations (GENIE contribution)
3 //
4 // COH.1:
5 // Total coherent cross section (NC and CC) as a function of neutrino energy
6 //
7 // Inputs:
8 // - sample id: 0 (nu_mu+C12), 1 (nu_mu+O16), 2 (nu_mu+Fe56)
9 //
10 // Costas Andreopoulos, STFC / Rutherford Appleton Laboratory
11 //
12 #include <iomanip>
13 
14 const int kNSamples = 3;
15 
16 const char * kLabel[kNSamples] =
17 {
18  /* 0 */ "nu_mu_C12",
19  /* 1 */ "nu_mu_O16",
20  /* 2 */ "nu_mu_Fe56"
21 };
22 
23 void nuint09_coh1(int isample)
24 {
25  cout << " ***** running: COH.1" << endl;
26 
27  if(isample<0 || isample >= kNSamples) return;
28 
29  const char * label = kLabel[isample];
30 
31  // get cross section graphs
32 
33  TFile fsig("../sig/splines.root","read");
34  TDirectory * sig_dir = (TDirectory *) fsig.Get(label);
35 
36  TGraph * sig_graph_cohcc = (TGraph*) sig_dir->Get("coh_cc");
37  TGraph * sig_graph_cohnc = (TGraph*) sig_dir->Get("coh_nc");
38 
39  // range & spacing
40 
41  const int ne = 60;
42  const double emin = 0.05;
43  const double emax = 30.00;
44 
45  const double dloge = (TMath::Log10(emax) - TMath::Log10(emin)) / (ne-1);
46 
47  // create output stream
48 
49  ostringstream out_filename;
50  out_filename << label << ".coh_1.sig_vs_Enu.data";
51  ofstream out_stream(out_filename.str().c_str(), ios::out);
52 
53  // write out txt file
54 
55  out_stream << "# [" << label << "]" << endl;
56  out_stream << "# " << endl;
57  out_stream << "# [COH.1]:" << endl;
58  out_stream << "# Total coherent cross section (NC and CC) as a function of neutrino energy" << endl;
59  out_stream << "# " << endl;
60  out_stream << "# Note:" << endl;
61  out_stream << "# - neutrino energy E in GeV, log spacing between Emin = " << emin << " GeV, Emax = " << emax << " GeV " << endl;
62  out_stream << "# - cross sections in 1E-38 cm^2 " << endl;
63  out_stream << "# - for coherent scattering we quote _nuclear_ cross section " << endl;
64  out_stream << "# Columns:" << endl;
65  out_stream << "# | Energy | sig(coherent; CC) | sig(coherent; NC) |" << endl;
66 
67  out_stream << std::fixed << setprecision(6);
68 
69  for(int i=0; i < ne; i++) {
70 
71  double e = TMath::Power(10., TMath::Log10(emin) + i * dloge);
72 
73  double sig_cohcc = sig_graph_cohcc->Eval(e);
74  double sig_cohnc = sig_graph_cohnc->Eval(e);
75 
76  sig_cohcc = TMath::Max(0., sig_cohcc);
77  sig_cohnc = TMath::Max(0., sig_cohnc);
78 
79  out_stream << setw(15) << e << setw(15) << sig_cohcc << setw(15) << sig_cohnc << endl;
80  }
81 
82  out_stream.close();
83 
84  // visual inspection
85 
86  TCanvas * c1 = new TCanvas("c1","",20,20,500,500);
87  sig_graph_cohcc->Draw("alp");
88  sig_graph_cohnc->Draw("lp");
89  c1->Update();
90 }
const char * kLabel[kNSamples]
Definition: nuint09_coh1.C:16
const char * label
const double emin
const double emax
const int kNSamples
Definition: nuint09_coh1.C:14
OStream cout
Definition: OStream.cxx:6
void nuint09_coh1(int isample)
Definition: nuint09_coh1.C:23
c1
Definition: demo5.py:24
Float_t e
Definition: plot.C:35