Jpp 21.0.0-rc.3
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 "JPhysics/JPDFSupportkit.hh"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JQuantiles.hh"
#include "JTools/JAbstractHistogram.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JPrint.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 to draw PDF of Cherenkov light from bright point.

Author
mdejong

Definition in file JDrawPD0.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 29 of file JDrawPD0.cc.

30{
31 using namespace std;
32 using namespace JPP;
33
35
36 string outputFile;
38 double epsilon;
39 PDF::configuration_type configuration;
40 double E;
41 double D;
42 double ct;
43 vector<int> function;
44 JHistogram_t histogram;
45 int debug;
46
47 try {
48
49 JProperties properties = configuration.getProperties();
50
51 JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from bright point.");
52
53 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
54 zap['o'] = make_field(outputFile) = "";
55 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
56 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
57 zap['E'] = make_field(E, "shower energy [GeV]");
58 zap['R'] = make_field(D, "distance [m]");
59 zap['c'] = make_field(ct, "cosine PMT angle");
60 zap['F'] = make_field(function, "PDF type");
61 zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t();
62 zap['d'] = make_field(debug) = 0;
63
64 zap(argc, argv);
65 }
66 catch(const exception &error) {
67 FATAL(error.what() << endl);
68 }
69
70
71 const JPDF_C
72 pdf(NAMESPACE::getPhotocathodeArea(),
73 PDF::getQE,
74 PDF::getAngularAcceptance,
75 PDF::getAbsorptionLength,
76 PDF::getScatteringLength,
77 PDF::getScatteringProbability,
78 NAMESPACE::getAmbientPressure(),
82 epsilon);
83
84
85 if (outputFile == "") {
86
87 cout << "enter time (^C to exit) > " << flush;
88
89 for (double dt; cin >> dt; ) {
90
91 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
92
93 cout << setw(2) << *F << ' '
94 << SCIENTIFIC(7,1) << E << ' '
95 << FIXED(5,1) << D << ' '
96 << FIXED(5,2) << ct << ' '
97 << FIXED(5,1) << dt << ' '
98 << SCIENTIFIC(9,3) << pdf.getLightFromBrightPoint(*F, D, ct, dt) * E << endl;
99 }
100 }
101
102 return 0;
103 }
104
105
106 TFile out(outputFile.c_str(), "recreate");
107
108 //const double t0 = D * getIndexOfRefraction() / C; // time [ns]
109 const double t0 = 0.0; // time [ns]
110
111 if (!histogram.is_valid()) {
112
113 if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_BRIGHT_POINT) {
114
115 histogram = JHistogram_t(t0 - 20.0, t0 + 50.0);
116
117 histogram.setBinWidth(0.1);
118
119 } else {
120
121 histogram = JHistogram_t(t0 - 20.0, t0 + 500.0);
122
123 histogram.setBinWidth(0.5);
124 }
125 }
126
127 TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit());
128
130
131 for (int i = 1; i <= h0.GetNbinsX(); ++i) {
132
133 const double dt = h0.GetBinCenter(i) - t0;
134
135 double value = 0.0;
136
137 for (vector<int>::const_iterator F = function.begin(); F != function.end(); ++F) {
138 value += pdf.getLightFromBrightPoint(*F, D, ct, dt) * E;
139 }
140
141 h0.SetBinContent(i, value);
142
143 f1[dt] = value;
144 }
145
146 f1.compile();
147
148 try {
149
150 JQuantiles quantiles(f1);
151
152 DEBUG("int " << quantiles.getIntegral() << endl);
153 DEBUG("x " << quantiles.getX() << endl);
154 DEBUG("y " << quantiles.getY() << endl);
155 DEBUG("FWHM " << quantiles.getFWHM() << endl);
156 }
157 catch(const exception&) {}
158
159 out.Write();
160 out.Close();
161}
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:2107
int numberOfPoints
Definition JResultPDF.cc:22
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1664
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2188
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
Template class for spline interpolation in 1D.
Definition JSpline.hh:734
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
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.
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.
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488