39{
42
45 double epsilon;
47 int function;
50
51 try {
52
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
60 zap[
'e'] =
make_field(epsilon,
"precision for integration") = 1.0e-10;
62 DIRECT_LIGHT_FROM_BRIGHT_POINT,
63 SCATTERED_LIGHT_FROM_BRIGHT_POINT;
66
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
82
83 const double P_atm = NAMESPACE::getAmbientPressure();
86
87
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
106
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;
130 JFunction2DTransformer_t transformer = zmap[function].second;
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
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
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
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
252
253 } else {
254
255 if (y_old != 0.0) {
257 }
258 }
259
260 t_old = t;
262 }
263 }
264 }
265
266 pdf.transform(transformer);
267 pdf.compile();
268
270
271 try {
272
274
276
278 }
281 }
282}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse parameter values.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Multi-dimensional PDF table for arrival time of Cherenkov light.
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
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)...
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Auxiliary data structure for muon PDF.
Auxiliary data structure for complete configuration.
JProperties getProperties()
Get properties.
Manipulator for help output.