nuint09_qel6.C
Go to the documentation of this file.
1 //
2 // NuINT09 Conference, Benchmark Calculations (GENIE contribution)
3 //
4 // QEL.6:
5 // CCQE-like cross section (1 nucleon + 0 pions after FSI) at E_nu= 0.5, 1.0 and 1.5 GeV as a function of the nucleon kinetic 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 //
15 // consts
16 //
17 const int kNSamples = 3;
18 const int kNWCur = 1;
19 const int kNEnergies = 3;
20 const int kNRunsPerCase = 5;
21 const int kNEvtPerRun = 100000;
22 
23 const char * kLabel[kNSamples] =
24 {
25  // available samples
26  /* 0 */ "nu_mu_C12",
27  /* 1 */ "nu_mu_O16",
28  /* 2 */ "nu_mu_Fe56"
29 };
30 
32 {
33  /* indices : sample ; cc/nc ; energy */
34  {
35  /* 0,0,0 (nu_mu C12, CC, 0.5 GeV) */ { {900100, 900101, 900102, 900103, 900104},
36  /* 0,0,1 (nu_mu C12, CC, 1.0 GeV) */ {900200, 900201, 900202, 900203, 900204},
37  /* 0,0,2 (nu_mu C12, CC, 1.5 GeV) */ {900300, 900301, 900302, 900303, 900304} }
38  },
39  {
40  /* 1,0,0 (nu_mu O16, CC, 0.5 GeV) */ { {910100, 910101, 910102, 910103, 910104},
41  /* 1,0,1 (nu_mu O16, CC, 1.0 GeV) */ {910200, 910201, 910202, 910203, 910204},
42  /* 1,0,2 (nu_mu O16, CC, 1.5 GeV) */ {910300, 910301, 910302, 910303, 910304} }
43  },
44  {
45  /* 2,0,0 (nu_mu Fe56, CC, 0.5 GeV) */ { {920100, 920101, 920102, 920103, 920104},
46  /* 2,0,1 (nu_mu Fe56, CC, 1.0 GeV) */ {920200, 920201, 920202, 920203, 920204},
47  /* 2,0,2 (nu_mu Fe56, CC, 1.5 GeV) */ {920300, 920301, 920302, 920303, 920304} }
48  }
49 };
50 
51 int kA[kNSamples] =
52 {
53  // A for nuclear target at each sample
54  /* 0 */ 12,
55  /* 1 */ 16,
56  /* 2 */ 56
57 };
58 
59 void nuint09_qel6(int isample)
60 {
61  cout << " ***** running: QEL.6" << endl;
62 
63  if(isample<0 || isample >= kNSamples) return;
64 
65  const char * label = kLabel[isample];
66  int A = kA[isample];
67 
68  // get cross section graph
69 
70  TFile fsig("../sig/splines.root","read");
71  TDirectory * sig_dir = (TDirectory *) fsig.Get(label);
72 
73  TGraph * sig_totcc = (TGraph*) sig_dir->Get("tot_cc");
74 
75  // range & spacing
76 
77  const int nKEnuc = 100;
78  const double KEnucmin = 0.00;
79  const double KEnucmax = 1.30;
80 
81  // create output stream
82 
83  ostringstream out_filename;
84  out_filename << label << ".qel_6.dsigCCQElike_dKEp.data";
85 
86  ofstream out_stream(out_filename.str().c_str(), ios::out);
87 
88  // write out txt file
89 
90  out_stream << "# [" << label << "]" << endl;
91  out_stream << "# " << endl;
92  out_stream << "# [QEL.6]:" << endl;
93  out_stream << "# CCQE-like cross section (1 nucleon + 0 pions after FSI) at E_nu = 0.5, 1.0 and 1.5 GeV as a function of the nucleon kinetic energy" << endl;
94  out_stream << "# " << endl;
95  out_stream << "# Note:" << endl;
96  out_stream << "# - nucleon kinetic energy KE in GeV, linear spacing between KEmin = " << KEnucmin << " GeV, KEmax = " << KEnucmax << " GeV " << endl;
97  out_stream << "# - cross sections in 1E-38 cm^2 / GeV" << endl;
98  out_stream << "# - quoted cross section is nuclear cross section divided with number of nucleons A" << endl;
99  out_stream << "# Columns:" << endl;
100  out_stream << "# | KE(proton) | dsig(numu CCQE-like; Enu = 0.5 GeV) | dsig(numu CCQE-like; Enu = 1.0 GeV) | dsig(numu CCQE-like; Enu = 1.5 GeV) | " << endl;
101  out_stream << std::fixed << setprecision(6);
102 
103  //
104  // load event data
105  //
106 
107  TChain * chain = new TChain("gst");
108 
109  // loop over CC/NC cases
110  for(int iwkcur=0; iwkcur<kNWCur; iwkcur++) {
111  // loop over energies
112  for(int ie=0; ie<kNEnergies; ie++) {
113  // loop over runs for current case
114  for(int ir=0; ir<kNRunsPerCase; ir++) {
115  // build filename
116  ostringstream filename;
117  int run_number = kRunNuQEL6[isample][iwkcur][ie][ir];
118  filename << "../gst/gntp." << run_number << ".gst.root";
119  // add to chain
120  cout << "Adding " << filename.str() << " to event chain" << endl;
121  chain->Add(filename.str().c_str());
122  }
123  }
124  }
125 
126  //
127  // get CC cross sections at given energies for normalization purposes
128  //
129  double sig_totcc_0500MeV = sig_totcc -> Eval (0.5) / A;
130  double sig_totcc_1000MeV = sig_totcc -> Eval (1.0) / A;
131  double sig_totcc_1500MeV = sig_totcc -> Eval (1.5) / A;
132 
133  //
134  // book histograms
135  //
136  TH1D * hst_dsig_dKEnuc_0500MeV = new TH1D("hst_dsig_dKEnuc_0500MeV","dsig/dKEp, numu CCQE-like after FSI, Enu=0.5 GeV", nKEnuc, KEnucmin, KEnucmax);
137  TH1D * hst_dsig_dKEnuc_1000MeV = new TH1D("hst_dsig_dKEnuc_1000MeV","dsig/dKEp, numu CCQE-like after FSI, Enu=1.0 GeV", nKEnuc, KEnucmin, KEnucmax);
138  TH1D * hst_dsig_dKEnuc_1500MeV = new TH1D("hst_dsig_dKEnuc_1500MeV","dsig/dKEp, numu CCQE-like after FSI, Enu=1.5 GeV", nKEnuc, KEnucmin, KEnucmax);
139 
140  //
141  // fill histograms
142  //
143  chain->Draw("(Ef-0.938)>>hst_dsig_dKEnuc_0500MeV","cc&&Ev>0.49&&Ev<0.51&&nfp==1&&nfn==0&&nfpip==1&&nfpim==0&&nfpi0==0&&nfother==0","GOFF");
144  chain->Draw("(Ef-0.938)>>hst_dsig_dKEnuc_1000MeV","cc&&Ev>0.99&&Ev<1.01&&nfp==1&&nfn==0&&nfpip==1&&nfpim==0&&nfpi0==0&&nfother==0","GOFF");
145  chain->Draw("(Ef-0.938)>>hst_dsig_dKEnuc_1500MeV","cc&&Ev>1.49&&Ev<1.51&&nfp==1&&nfn==0&&nfpip==1&&nfpim==0&&nfpi0==0&&nfother==0","GOFF");
146 
147  //
148  // normalize
149  //
150  double norm_0500MeV = hst_dsig_dKEnuc_0500MeV -> Integral("width") / sig_totcc_0500MeV;
151  double norm_1000MeV = hst_dsig_dKEnuc_1000MeV -> Integral("width") / sig_totcc_1000MeV;
152  double norm_1500MeV = hst_dsig_dKEnuc_1500MeV -> Integral("width") / sig_totcc_1500MeV;
153 
154  if (norm_0500MeV > 0) hst_dsig_dKEnuc_0500MeV -> Scale(1./norm_0500MeV);
155  if (norm_1000MeV > 0) hst_dsig_dKEnuc_1000MeV -> Scale(1./norm_1000MeV);
156  if (norm_1500MeV > 0) hst_dsig_dKEnuc_1500MeV -> Scale(1./norm_1500MeV);
157 
158  //
159  // write-out
160  //
161  for(int i=1; i <= hst_dsig_dKEnuc_1000MeV->GetNbinsX(); i++) {
162 
163  double KEnuc = hst_dsig_dKEnuc_1000MeV -> GetBinCenter(i);
164 
165  double dsig_dKEnuc_0500MeV = hst_dsig_dKEnuc_0500MeV -> GetBinContent(i);
166  double dsig_dKEnuc_1000MeV = hst_dsig_dKEnuc_1000MeV -> GetBinContent(i);
167  double dsig_dKEnuc_1500MeV = hst_dsig_dKEnuc_1500MeV -> GetBinContent(i);
168 
169  dsig_dKEnuc_0500MeV = TMath::Max(0., dsig_dKEnuc_0500MeV);
170  dsig_dKEnuc_1000MeV = TMath::Max(0., dsig_dKEnuc_1000MeV);
171  dsig_dKEnuc_1500MeV = TMath::Max(0., dsig_dKEnuc_1500MeV);
172 
173  out_stream << setw(15) << KEnuc
174  << setw(15) << dsig_dKEnuc_0500MeV
175  << setw(15) << dsig_dKEnuc_1000MeV
176  << setw(15) << dsig_dKEnuc_1500MeV
177  << endl;
178  }
179 
180  out_stream.close();
181 
182  delete chain;
183  fsig.Close();
184 }
size_t i(0)
int kA[kNSamples]
Definition: nuint09_qel6.C:51
const int kNRunsPerCase
Definition: nuint09_qel6.C:20
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 int kNEvtPerRun
Definition: nuint09_qel6.C:21
const int kRunNuQEL6[kNSamples][kNWCur][kNEnergies][kNRunsPerCase]
Definition: nuint09_qel6.C:31
const int kNEnergies
Definition: nuint09_qel6.C:19
static const double A
Definition: Units.h:82
const int kNWCur
Definition: nuint09_qel6.C:18
const char * kLabel[kNSamples]
Definition: nuint09_qel6.C:23
var ie
Definition: slidy.js:14
void nuint09_qel6(int isample)
Definition: nuint09_qel6.C:59
const int kNSamples
Definition: nuint09_qel6.C:17