Jpp  19.1.0
the software that should make you happy
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"
13 
14 #include "Jeep/JParser.hh"
15 #include "Jeep/JMessage.hh"
16 
17 
18 /**
19  * \file
20  * Auxiliary program histogram plot absorption and scattering lengths as well as dispersion.
21  * \author mdejong
22  */
23 int main(int argc, char **argv)
24 {
25  using namespace std;
26  using namespace JPP;
27 
28  string outputFile;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Auxiliary program histogram plot absorption and scattering lengths as well as dispersion.");
34 
35  zap['o'] = make_field(outputFile) = "light.root";
36  zap['d'] = make_field(debug) = 1;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
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  TH1D hp("pure", NULL, 400, 280.0, 680.0);
52 
53  TH1D h4("vp[Antares]", NULL, 400, 280.0, 680.0);
54  TH1D h5("vp[KM3NeT]", NULL, 400, 280.0, 680.0);
55  TH1D h6("vg[Antares]", NULL, 400, 280.0, 680.0);
56  TH1D h7("vg[KM3NeT]", NULL, 400, 280.0, 680.0);
57 
58  TH1D h8("Ps[Antares]", NULL, 5000, -1.0, +1.0);
59  TH1D h9("Ps[KM3NeT]", NULL, 5000, -1.0, +1.0);
60  TH1D ha("f4", NULL, 5000, -1.0, +1.0);
61  TH1D hb("p00075", NULL, 5000, -1.0, +1.0);
62  TH1D hc("petzhold", NULL, 5000, -1.0, +1.0);
63 
64  JDispersion antares(250.0); // P [bar]
65  JDispersion km3net (350.0); // P [bar]
66 
67  for (int i = 1; i <= h0.GetNbinsX(); ++i) {
68 
69  const double x = h0.GetBinCenter (i);
70 
71  h0.SetBinContent(i, ANTARES::getAbsorptionLength(x));
72  h1.SetBinContent(i, KM3NET ::getAbsorptionLength(x));
73  h2.SetBinContent(i, ANTARES::getScatteringLength(x));
74  h3.SetBinContent(i, KM3NET ::getScatteringLength(x));
75  hp.SetBinContent(i, getAbsorptionLengthOfPureWater(x));
76 
77  h4.SetBinContent(i, antares.getIndexOfRefractionPhase(x));
78  h5.SetBinContent(i, km3net .getIndexOfRefractionPhase(x));
79  h6.SetBinContent(i, antares.getIndexOfRefractionGroup(x));
80  h7.SetBinContent(i, km3net .getIndexOfRefractionGroup(x));
81  }
82 
83  double W[] = { 0.0, 0.0, 0.0 };
84 
85  for (int i = 1; i <= h8.GetNbinsX(); ++i) {
86 
87  const double x = h8.GetBinCenter (i);
88  const double dx = h8.GetBinWidth (i);
89 
90  h8.SetBinContent(i, ANTARES ::getScatteringProbability(x));
91  h9.SetBinContent(i, KM3NET ::getScatteringProbability(x));
92  ha.SetBinContent(i, JPHYSICS::f4 (x));
93  hb.SetBinContent(i, JPHYSICS::p00075 (x));
94  hc.SetBinContent(i, JPHYSICS::petzhold(x));
95 
96  W[0] += JPHYSICS::f4 (x) * dx;
97  W[1] += JPHYSICS::p00075 (x) * dx;
98  W[2] += JPHYSICS::petzhold(x) * dx;
99  }
100 
101  for (int i = 0; i != sizeof(W)/sizeof(W[0]); ++i) {
102  DEBUG("W[" << i << "] = " << W[i] << endl);
103  }
104 
105  out.Write();
106  out.Close();
107 }
Properties of Antares PMT and deep-sea water.
string outputFile
int main(int argc, char **argv)
Definition: JLight.cc:23
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#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:2142
Properties of KM3NeT PMT and deep-sea water.
Utility class to parse command line options.
Definition: JParser.hh:1698
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
Implementation of dispersion for water in deep sea.
Definition: JDispersion.hh:28
virtual double getIndexOfRefractionPhase(const double lambda) const
Index of refraction (phase velocity).
Definition: JDispersion.hh:51
double getScatteringLength(const double lambda)
Get scattering length.
Definition: Antares.hh:148
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: Antares.hh:210
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
double p00075(const double x)
Model specific function to describe light scattering in water (p00075).
static const JAbsorptionLengthOfPureWater getAbsorptionLengthOfPureWater
Function object for absorption length of pure water.
double f4(const double x)
Model specific function to describe light scattering in water (f4).
static const JPetzhold petzhold
Function object for measurement of light scattering in water.
double getIndexOfRefractionPhase()
Get average index of refraction of water corresponding to phase velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14