Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JLight.cc File Reference

Auxiliary program histogram plot absorption and scattering lengths as well as dispersion. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JDispersion.hh"
#include "JPhysics/JPhysicsSupportkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program histogram plot absorption and scattering lengths as well as dispersion.

Author
mdejong

Definition in file JLight.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 23 of file JLight.cc.

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 TH1D hq("smith&baker", NULL, 400, 280.0, 680.0);
53
54 TH1D h4("vp[Antares]", NULL, 400, 280.0, 680.0);
55 TH1D h5("vp[KM3NeT]", NULL, 400, 280.0, 680.0);
56 TH1D h6("vg[Antares]", NULL, 400, 280.0, 680.0);
57 TH1D h7("vg[KM3NeT]", NULL, 400, 280.0, 680.0);
58
59 TH1D h8("Ps[Antares]", NULL, 5000, -1.0, +1.0);
60 TH1D h9("Ps[KM3NeT]", NULL, 5000, -1.0, +1.0);
61 TH1D ha("f4", NULL, 5000, -1.0, +1.0);
62 TH1D hb("p00075", NULL, 5000, -1.0, +1.0);
63 TH1D hc("petzhold", NULL, 5000, -1.0, +1.0);
64
65 JDispersion antares(250.0); // P [bar]
66 JDispersion km3net (350.0); // P [bar]
67
68 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
69
70 const double x = h0.GetBinCenter (i);
71
72 h0.SetBinContent(i, ANTARES::getAbsorptionLength(x));
73 h1.SetBinContent(i, KM3NET ::getAbsorptionLength(x));
74 h2.SetBinContent(i, ANTARES::getScatteringLength(x));
75 h3.SetBinContent(i, KM3NET ::getScatteringLength(x));
76 hp.SetBinContent(i, getAbsorptionLengthOfPureWater(x));
77 hq.SetBinContent(i, getAbsorptionLengthSmithAndBaker(x));
78
79 h4.SetBinContent(i, antares.getIndexOfRefractionPhase(x));
80 h5.SetBinContent(i, km3net .getIndexOfRefractionPhase(x));
81 h6.SetBinContent(i, antares.getIndexOfRefractionGroup(x));
82 h7.SetBinContent(i, km3net .getIndexOfRefractionGroup(x));
83 }
84
85 double W[] = { 0.0, 0.0, 0.0 };
86
87 for (int i = 1; i <= h8.GetNbinsX(); ++i) {
88
89 const double x = h8.GetBinCenter (i);
90 const double dx = h8.GetBinWidth (i);
91
92 h8.SetBinContent(i, ANTARES ::getScatteringProbability(x));
93 h9.SetBinContent(i, KM3NET ::getScatteringProbability(x));
94 ha.SetBinContent(i, JPHYSICS::f4 (x));
95 hb.SetBinContent(i, JPHYSICS::p00075 (x));
96 hc.SetBinContent(i, JPHYSICS::petzhold(x));
97
98 W[0] += JPHYSICS::f4 (x) * dx;
99 W[1] += JPHYSICS::p00075 (x) * dx;
100 W[2] += JPHYSICS::petzhold(x) * dx;
101 }
102
103 for (int i = 0; i != sizeof(W)/sizeof(W[0]); ++i) {
104 DEBUG("W[" << i << "] = " << W[i] << endl);
105 }
106
107 out.Write();
108 out.Close();
109}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
Implementation of dispersion for water in deep sea.
double p00075(const double x)
Model specific function to describe light scattering in water (p00075).
double petzhold(const double x)
Model specific function to describe light scattering in water (Petzhold).
double getAbsorptionLengthSmithAndBaker(const double lambda)
Absorption length of deep-sea water according Smith & Baker.
double f4(const double x)
Model specific function to describe light scattering in water (f4).
double getAbsorptionLengthOfPureWater(const double lambda)
Absorption length of pure 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).