Jpp  19.1.0-rc.1
the software that should make you happy
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 }
string outputFile
Energy loss of muon.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
int main(int argc, char **argv)
Definition: JThetaMCS.cc:18
Utility class to parse command line options.
Definition: JParser.hh:1714
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
double getThetaMCS(const double E, const double x, const double X0, const double M, const double Q)
Get multiple Coulomb scattering angle.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Definition: JGeane.hh:381
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14