Jpp  17.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JThetaMCS.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "TROOT.h"
6 #include "TFile.h"
7 #include "TH2D.h"
8 
10 #include "JPhysics/JGeane.hh"
11 
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 
16 /**
17  */
18 int main(int argc, char **argv)
19 {
20  using namespace std;
21  using namespace JPP;
22 
23  string outputFile;
24  int debug;
25 
26  try {
27 
28  JParser<> zap;
29 
30  zap['o'] = make_field(outputFile) = "music.root";
31  zap['d'] = make_field(debug) = 0;
32 
33  zap(argc, argv);
34  }
35  catch(const exception &error) {
36  FATAL(error.what() << endl);
37  }
38 
39 
40  TFile out(outputFile.c_str(), "recreate");
41 
42  TH2D h2("h2", NULL, 1000, 0.0, 8.0, 1000, 0.0, 1000.0);
43 
44  for (int ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
45  for (int iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
46 
47  const double x = h2.GetXaxis()->GetBinCenter(ix);
48  const double y = h2.GetYaxis()->GetBinCenter(iy);
49 
50  const double E = pow(10.0, x);
51 
52  if (y <= gWater(E)) {
53 
54  const double z = getThetaMCS(E, y);
55 
56  h2.SetBinContent(ix, iy, z);
57  }
58  }
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
then usage E
Definition: JMuonPostfit.sh:35
Energy loss of muon.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition: JGeane.hh:381
string outputFile
double getThetaMCS(const double E, const double x, const double X0, const double M, const double Q)
Get multiple Coulomb scattering angle.
#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:66
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.