Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JLight.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 "TH1D.h"
8 
9 #include "JPhysics/Antares.hh"
10 #include "JPhysics/KM3NeT.hh"
11 #include "JPhysics/JDispersion.hh"
12 
13 #include "Jeep/JParser.hh"
14 #include "Jeep/JMessage.hh"
15 
16 
17 /**
18  * \file
19  * Auxiliary program histogram plot absorption and scattering lengths as well as dispersion.
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25 
26  string outputFile;
27  int debug;
28 
29  try {
30 
31  JParser<> zap("Auxiliary program histogram plot absorption and scattering lengths as well as dispersion.");
32 
33  zap['o'] = make_field(outputFile) = "light.root";
34  zap['d'] = make_field(debug) = 1;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42 
43  using namespace JPP;
44 
45  TFile out(outputFile.c_str(), "recreate");
46 
47  TH1D h0("abs[Antares]", NULL, 400, 280.0, 680.0);
48  TH1D h1("abs[KM3NeT]", NULL, 400, 280.0, 680.0);
49  TH1D h2("scat[Antares]", NULL, 400, 280.0, 680.0);
50  TH1D h3("scat[KM3NeT]", NULL, 400, 280.0, 680.0);
51 
52  TH1D h4("vp[Antares]", NULL, 400, 280.0, 680.0);
53  TH1D h5("vp[KM3NeT]", NULL, 400, 280.0, 680.0);
54  TH1D h6("vg[Antares]", NULL, 400, 280.0, 680.0);
55  TH1D h7("vg[KM3NeT]", NULL, 400, 280.0, 680.0);
56 
57  TH1D h8("Ps[Antares]", NULL, 5000, -1.0, +1.0);
58  TH1D h9("Ps[KM3NeT]", NULL, 5000, -1.0, +1.0);
59  TH1D ha("f4", NULL, 5000, -1.0, +1.0);
60  TH1D hb("p00075", NULL, 5000, -1.0, +1.0);
61  TH1D hc("petzhold", NULL, 5000, -1.0, +1.0);
62 
63  JDispersion antares(250.0); // P [bar]
64  JDispersion km3net (350.0); // P [bar]
65 
66  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
67 
68  const double x = h0.GetBinCenter (i);
69 
70  h0.SetBinContent(i, ANTARES::getAbsorptionLength(x));
71  h1.SetBinContent(i, KM3NET ::getAbsorptionLength(x));
72  h2.SetBinContent(i, ANTARES::getScatteringLength(x));
73  h3.SetBinContent(i, KM3NET ::getScatteringLength(x));
74 
75  h4.SetBinContent(i, antares.getIndexOfRefractionPhase(x));
76  h5.SetBinContent(i, km3net .getIndexOfRefractionPhase(x));
77  h6.SetBinContent(i, antares.getIndexOfRefractionGroup(x));
78  h7.SetBinContent(i, km3net .getIndexOfRefractionGroup(x));
79  }
80 
81  double W[] = { 0.0, 0.0, 0.0 };
82 
83  for (int i = 1; i <= h8.GetNbinsX(); ++i) {
84 
85  const double x = h8.GetBinCenter (i);
86  const double dx = h8.GetBinWidth (i);
87 
88  h8.SetBinContent(i, ANTARES::getScatteringProbability(x));
89  h9.SetBinContent(i, KM3NET ::getScatteringProbability(x));
90  ha.SetBinContent(i, KM3NET ::f4 (x));
91  hb.SetBinContent(i, KM3NET ::p00075 (x));
92  hc.SetBinContent(i, KM3NET ::petzhold(x));
93 
94  W[0] += KM3NET ::f4 (x) * dx;
95  W[1] += KM3NET ::p00075 (x) * dx;
96  W[2] += KM3NET ::petzhold(x) * dx;
97  }
98 
99  for (int i = 0; i != sizeof(W)/sizeof(W[0]); ++i) {
100  DEBUG("W[" << i << "] = " << W[i] << endl);
101  }
102 
103  out.Write();
104  out.Close();
105 }
double getIndexOfRefractionPhase()
Get average index of refraction of water.
Definition: JConstants.hh:122
Utility class to parse command line options.
Definition: JParser.hh:1493
double getScatteringLength(const double lambda)
Scattering length.
Definition: KM3NeT.hh:104
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: KM3NeT.hh:290
Optical properties of Antares deep-sea site.
double getAbsorptionLength(const double lambda)
Absorption length.
Definition: KM3NeT.hh:58
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: Antares.hh:292
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:69
string outputFile
double petzhold(const double x)
Measurement of light scattering in water.
Definition: KM3NeT.hh:207
Optical properties of KM3NeT deep-sea site.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
double p00075(const double x)
Model specific function to describe light scattering in water (p00075)
Definition: KM3NeT.hh:190
int debug
debug level
Definition: JSirene.cc:61
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
double getAbsorptionLength(const double lambda)
Absoption length.
Definition: Antares.hh:53
Utility class to parse command line options.
double getScatteringLength(const double lambda)
Scattering length.
Definition: Antares.hh:138
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
double f4(const double x)
Model specific function to describe light scattering in water (f4)
Definition: KM3NeT.hh:174
int main(int argc, char *argv[])
Definition: Main.cpp:15