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 }
size_t i(0)
const char * kLabel[kNSamples]
Definition: nuint09_coh1.C:16
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
const double emin
const double e
const double emax
const int kNSamples
Definition: nuint09_coh1.C:14
void nuint09_coh1(int isample)
Definition: nuint09_coh1.C:23