Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JMakePD0.cc File Reference

Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a bright point. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <set>
#include <map>
#include <cmath>
#include "JTools/JFunction1D_t.hh"
#include "JTools/JFunctionalMap_t.hh"
#include "JTools/JQuadrature.hh"
#include "JPhysics/JPDF.hh"
#include "JPhysics/JPDFTable.hh"
#include "JPhysics/Antares.hh"
#include "JPhysics/KM3NeT.hh"
#include "JPhysics/JPDFSupportkit.hh"
#include "Jeep/JProperties.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

Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a bright point.

The PDFs are tabulated as a function of (D, cos(theta), t), where:

  • D is the distance between the bright point and the PMT;
  • cos(theta) the cosine of the PMT angle;
  • t the arrival time of the light with respect to the Cherenkov hypothesis.

The orientation of the PMT is defined in the coordinate system in which the position of the bright point and that of the PMT are along the x-axis and the PMT is oriented in the x-y plane.

Author
mdejong

Definition in file JMakePD0.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 38 of file JMakePD0.cc.

39{
40 using namespace std;
41 using namespace JPP;
42
43 string outputFile;
45 double epsilon;
46 PDF::configuration_type configuration;
47 int function;
48 set<double> D; // distance [m]
49 int debug;
50
51 try {
52
53 JProperties properties = configuration.getProperties();
54
55 JParser<> zap("Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a bright point.");
56
57 zap['@'] = make_field(properties, PDF::help() << configuration) = JPARSER::initialised();
58 zap['o'] = make_field(outputFile);
59 zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
60 zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
61 zap['F'] = make_field(function, "PDF type") =
62 DIRECT_LIGHT_FROM_BRIGHT_POINT,
63 SCATTERED_LIGHT_FROM_BRIGHT_POINT;
64 zap['D'] = make_field(D, "distance [m]") = JPARSER::initialised();
65 zap['d'] = make_field(debug) = 0;
66
67 zap['F'] = JPARSER::not_initialised();
68
69 zap(argc, argv);
70 }
71 catch(const exception &error) {
72 FATAL(error.what() << endl);
73 }
74
75
76 typedef double (JPDF::*fcn)(const double,
77 const double,
78 const double) const;
79
80
81 // set global parameters
82
83 const double P_atm = NAMESPACE::getAmbientPressure();
84 const double wmin = getMinimalWavelength();
85 const double wmax = getMaximalWavelength();
86
87
88 const JPDF_C
89 pdf_c(NAMESPACE::getPhotocathodeArea(),
90 PDF::getQE,
91 PDF::getAngularAcceptance,
92 PDF::getAbsorptionLength,
93 PDF::getScatteringLength,
94 PDF::getScatteringProbability,
95 P_atm,
96 wmin,
97 wmax,
99 epsilon);
100
101
102 typedef JSplineFunction1D_t JFunction1D_t;
104 JPolint1FunctionalGridMap>::maplist JMapList_t;
106
107 typedef JPDFTransformer<2, JFunction1D_t::argument_type> JFunction2DTransformer_t;
109
110 JPDF_t pdf;
111
112
113 NOTICE("building multi-dimensional function object <" << function << ">... " << flush);
114
115 const double ng[] = {
116 pdf_c.getIndexOfRefractionGroup(wmax),
117 pdf_c.getIndexOfRefractionGroup(wmin)
118 };
119
121
122 zmap[DIRECT_LIGHT_FROM_BRIGHT_POINT] = make_pair((fcn) &JPDF::getDirectLightFromBrightPoint, JFunction2DTransformer_t(21.5, 2, ng[0], ng[1]));
123 zmap[SCATTERED_LIGHT_FROM_BRIGHT_POINT] = make_pair((fcn) &JPDF::getScatteredLightFromBrightPoint, JFunction2DTransformer_t(21.5, 2, ng[0], 0.0));
124
125 if (zmap.find(function) == zmap.end()) {
126 FATAL("illegal function specifier" << endl);
127 }
128
129 fcn f = zmap[function].first; // PDF
130 JFunction2DTransformer_t transformer = zmap[function].second; // transformer
131
132
133 if (D.empty()) {
134 D.insert( 0.10);
135 D.insert( 0.50);
136 D.insert( 1.00);
137 D.insert( 5.00);
138 D.insert( 10.00);
139 D.insert( 20.00);
140 D.insert( 30.00);
141 D.insert( 40.00);
142 D.insert( 50.00);
143 D.insert( 60.00);
144 D.insert( 70.00);
145 D.insert( 80.00);
146 D.insert( 90.00);
147 D.insert(100.00);
148 }
149
150 set<double> X; // time [ns]
151
152 if (function == DIRECT_LIGHT_FROM_BRIGHT_POINT) {
153
154 for (double buffer[] = { 0.0, 0.005, 0.01, 0.015, -1 }, *x = buffer; *x >= 0; ++x) {
155 X.insert(0.0 + *x);
156 X.insert(1.0 - *x);
157 }
158
159 for (double x = 0.02; x < 0.99; x += 0.01)
160 X.insert(x);
161
162 } else {
163
164 X.insert( 0.00);
165 X.insert( 0.10);
166 X.insert( 0.20);
167 X.insert( 0.30);
168 X.insert( 0.40);
169 X.insert( 0.50);
170 X.insert( 0.60);
171 X.insert( 0.70);
172 X.insert( 0.80);
173 X.insert( 0.90);
174 X.insert( 1.00);
175 X.insert( 1.00);
176 X.insert( 1.10);
177 X.insert( 1.20);
178 X.insert( 1.30);
179 X.insert( 1.40);
180 X.insert( 1.50);
181 X.insert( 1.60);
182 X.insert( 1.70);
183 X.insert( 1.80);
184 X.insert( 1.90);
185 X.insert( 2.00);
186 X.insert( 2.20);
187 X.insert( 2.40);
188 X.insert( 2.60);
189 X.insert( 2.80);
190 X.insert( 3.00);
191 X.insert( 3.25);
192 X.insert( 3.50);
193 X.insert( 3.75);
194 X.insert( 4.00);
195 X.insert( 4.25);
196 X.insert( 4.50);
197 X.insert( 4.75);
198 X.insert( 5.0);
199 X.insert( 6.0);
200 X.insert( 7.0);
201 X.insert( 8.0);
202 X.insert( 9.0);
203 X.insert( 10.0);
204 X.insert( 15.0);
205 X.insert( 20.0);
206 X.insert( 25.0);
207 X.insert( 30.0);
208 X.insert( 40.0);
209 X.insert( 50.0);
210 X.insert( 60.0);
211 X.insert( 70.0);
212 X.insert( 80.0);
213 X.insert( 90.0);
214 X.insert(100.0);
215 X.insert(120.0);
216 X.insert(140.0);
217 X.insert(160.0);
218 X.insert(180.0);
219 X.insert(200.0);
220 }
221
222
223 for (set<double>::const_iterator d = D.begin(); d != D.end(); ++d) {
224
225 const double D_m = *d;
226
227 for (double dc = 0.1, ct = -1.0; ct < +1.0 + 0.5*dc; ct += dc) {
228
229 JFunction1D_t& f1 = pdf[D_m][ct];
230
231 const JArray_t array(D_m, ct);
232
233 double t_old = transformer.getXn(array, *X.begin());
234 double y_old = 0.0;
235
236 for (set<double>::const_iterator x = X.begin(); x != X.end(); ++x) {
237
238 const double t = transformer.getXn(array, *x);
239 const double y = (pdf_c.*f)(D_m, ct, t);
240
241 if (y != 0.0) {
242
243 if (*x < 0.0) {
244 WARNING("dt < 0 " << *x << ' ' << D_m << ' ' << t << ' ' << y << endl);
245 }
246
247 if (y_old == 0.0) {
248 f1[t_old] = y_old;
249 }
250
251 f1[t] = y;
252
253 } else {
254
255 if (y_old != 0.0) {
256 f1[t] = y;
257 }
258 }
259
260 t_old = t;
261 y_old = y;
262 }
263 }
264 }
265
266 pdf.transform(transformer);
267 pdf.compile();
268
269 NOTICE("OK" << endl);
270
271 try {
272
273 NOTICE("storing output to file " << outputFile << "... " << flush);
274
275 pdf.store(outputFile.c_str());
276
277 NOTICE("OK" << endl);
278 }
279 catch(const JException& error) {
280 FATAL(error.what() << endl);
281 }
282}
string outputFile
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define WARNING(A)
Definition JMessage.hh:65
#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.
General exception.
Definition JException.hh:25
virtual const char * what() const override
Get error message.
Definition JException.hh:65
Utility class to parse command line options.
Definition JParser.hh:1664
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
Template definition of transformer of the probability density function (PDF) of the time response of ...
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
Definition JPDF.hh:2188
Functional map with polynomial interpolation.
Definition JPolint.hh:1153
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).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition JParser.hh:72
Auxiliary data structure for muon PDF.
Definition JPDF_t.hh:26
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.
Wrapper data structure around std::array.
Definition JArray.hh:43
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109