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
Functions
JThetaMCS.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH2D.h"
#include "JPhysics/JPhysicsSupportkit.hh"
#include "JPhysics/JGeane.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file JThetaMCS.cc.

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
then usage E
Definition: JMuonPostfit.sh:35
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
#define FATAL(A)
Definition: JMessage.hh:67