Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JDrawPD0.cc File Reference

Auxiliary program to draw PDF of Cherenkov light from bright point. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JPhysics/JPDF.hh"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JTools/JSpline.hh"
#include "JTools/JQuantiles.hh"
#include "JTools/JAbstractHistogram.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

double getAbsorptionLength (const double lambda)
 
double getScatteringLength (const double lambda)
 
int main (int argc, char **argv)
 

Variables

double absorptionLengthFactor
 Scaling of absorption and scattering length.
 
double scatteringLengthFactor
 

Detailed Description

Auxiliary program to draw PDF of Cherenkov light from bright point.

Author
mdejong

Definition in file JDrawPD0.cc.

Function Documentation

◆ getAbsorptionLength()

double getAbsorptionLength ( const double lambda)
inline

Definition at line 27 of file JDrawPD0.cc.

28{
29 return absorptionLengthFactor * NAMESPACE::getAbsorptionLength(lambda);
30}
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition JDrawPD0.cc:24

◆ getScatteringLength()

double getScatteringLength ( const double lambda)
inline

Definition at line 33 of file JDrawPD0.cc.

34{
35 return scatteringLengthFactor * NAMESPACE::getScatteringLength(lambda);
36}
double scatteringLengthFactor
Definition JDrawPD0.cc:25

◆ main()

int main ( int argc,
char ** argv )

Definition at line 45 of file JDrawPD0.cc.

46{
47 using namespace std;
48 using namespace JPP;
49
51
52 string outputFile;
54 double epsilon;
55 double E;
56 double D;
57 double ct;
58 vector<int> function;
59 JHistogram_t histogram;
60 int debug;
61
62 try {
63
64 JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from bright point.");
65
66 zap['o'] = make_field(outputFile) = "pd0.root";
67 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
68 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
69 zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0;
70 zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0;
71 zap['E'] = make_field(E, "shower energy [GeV]");
72 zap['R'] = make_field(D, "distance [m]");
73 zap['c'] = make_field(ct, "cosine PMT angle");
74 zap['F'] = make_field(function, "PDF type");
75 zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
76 zap['d'] = make_field(debug) = 0;
77
78 zap(argc, argv);
79 }
80 catch(const exception &error) {
81 FATAL(error.what() << endl);
82 }
83
84
85 const JPDF_C
86 pdf(NAMESPACE::getPhotocathodeArea(),
87 NAMESPACE::getQE,
88 NAMESPACE::getAngularAcceptance,
91 NAMESPACE::getScatteringProbability,
92 NAMESPACE::getAmbientPressure(),
96 epsilon);
97
98
99 if (outputFile == "") {
100
101 cout << "enter time (^C to exit) > " << flush;
102
103 for (double dt; cin >> dt; ) {
104
105 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
106
107 cout << setw(2) << *F << ' '
108 << SCIENTIFIC(7,1) << E << ' '
109 << FIXED(5,1) << D << ' '
110 << FIXED(5,2) << ct << ' '
111 << FIXED(5,1) << dt << ' '
112 << SCIENTIFIC(9,3) << pdf.getLightFromBrightPoint(*F, D, ct, dt) * E << endl;
113 }
114 }
115
116 return 0;
117 }
118
119
120 TFile out(outputFile.c_str(), "recreate");
121
122 //const double t0 = D * getIndexOfRefraction() / C; // time [ns]
123 const double t0 = 0.0; // time [ns]
124
125 if (!histogram.is_valid()) {
126
127 if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_BRIGHT_POINT) {
128
129 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
130
131 histogram.setBinWidth(0.1);
132
133 } else {
134
135 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
136
137 histogram.setBinWidth(0.5);
138 }
139 }
140
141 TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
142
144
145 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
146
147 const double dt = h0.GetBinCenter(i) - t0;
148
149 double value = 0.0;
150
151 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
152 value += pdf.getLightFromBrightPoint(*F, D, ct, dt) * E;
153 }
154
155 h0.SetBinContent(i, value);
156
157 f1[dt] = value;
158 }
159
160 f1.compile();
161
162 try {
163
164 JQuantiles quantiles(f1);
165
166 DEBUG("int " << quantiles.getIntegral() << endl);
167 DEBUG("x " << quantiles.getX() << endl);
168 DEBUG("y " << quantiles.getY() << endl);
169 DEBUG("FWHM " << quantiles.getFWHM() << endl);
170 }
171 catch(const exception&) {}
172
173 out.Write();
174 out.Close();
175}
string outputFile
double getAbsorptionLength(const double lambda)
Definition JDrawPD0.cc:27
double getScatteringLength(const double lambda)
Definition JDrawPD0.cc:33
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse command line options.
Definition JParser.hh:1698
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2186
Quantile calculator for a given interpolating function.
Definition JQuantiles.hh:34
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Simple data structure for histogram binning.
void setBinWidth(const abscissa_type dx, int option=0)
Set bin width.
bool is_valid() const
Check validity of histogram binning.
int getNumberOfBins() const
Get number of bins.
Type definition of a spline interpolation method based on a JCollection with double result type.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488

Variable Documentation

◆ absorptionLengthFactor

double absorptionLengthFactor

Scaling of absorption and scattering length.

Definition at line 24 of file JDrawPD0.cc.

◆ scatteringLengthFactor

double scatteringLengthFactor

Definition at line 25 of file JDrawPD0.cc.