Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JNeutrino.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 
4 #include "TROOT.h"
5 #include "TFile.h"
6 #include "TH1D.h"
7 
8 #include "JPhysics/JNeutrino.hh"
9 
10 #include "Jeep/JParser.hh"
11 #include "Jeep/JMessage.hh"
12 
13 
14 /**
15  * \file
16  *
17  * Example program to histogram neutrino interaction cross sections.
18  * \author mdejong
19  */
20 int main(int argc, char* argv[])
21 {
22  using namespace std;
23 
24  string outputFile;
25  int debug;
26 
27  try {
28 
29  JParser<> zap("Example program to histogram neutrino interaction cross sections.");
30 
31  zap['o'] = make_field(outputFile) = "neutrino.root";
32  zap['d'] = make_field(debug) = 0;
33 
34  zap(argc, argv);
35  }
36  catch(const exception &error) {
37  FATAL(error.what() << endl);
38  }
39 
40  using namespace JPP;
41 
42 
43  TFile out(outputFile.c_str(), "recreate");
44 
45  TH1D h1("cc_nu", NULL, 1000, 2.0, 7.0);
46  TH1D h2("nc_nu", NULL, 1000, 2.0, 7.0);
47  TH1D h3("cc_nubar", NULL, 1000, 2.0, 7.0);
48  TH1D h4("nc_nubar", NULL, 1000, 2.0, 7.0);
49 
50  for(int i = 1; i <= h1.GetNbinsX(); ++i) {
51 
52  const double x = h1.GetBinCenter(i);
53  const double E = pow(10.0, x);
54 
55  h1.SetBinContent(i, cc_nu (E));
56  h2.SetBinContent(i, nc_nu (E));
57  h3.SetBinContent(i, cc_nubar(E));
58  h4.SetBinContent(i, nc_nubar(E));
59  }
60 
61  out.Write();
62  out.Close();
63 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
static const JNCnu nc_nu
Function object for neutral current neutrino cross section [cm^2] as a function of neutrino energy [G...
Definition: JNeutrino.hh:620
then usage E
Definition: JMuonPostfit.sh:35
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:71
string outputFile
static const JCCnubar cc_nubar
Function object for charged current anti-neutrino cross section [cm^2] as a function of neutrino ener...
Definition: JNeutrino.hh:621
static const JNCnubar nc_nubar
Function object for neutral current anti-neutrino cross section [cm^2] as a function of neutrino ener...
Definition: JNeutrino.hh:622
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:98
int debug
debug level
Definition: JSirene.cc:63
static const JCCnu cc_nu
Function object for charged current neutrino cross section [cm^2] as a function of neutrino energy [G...
Definition: JNeutrino.hh:618
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.