Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
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 "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. More...
 
double scatteringLengthFactor
 

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:

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

double getAbsorptionLength ( const double  lambda)
inline

Definition at line 28 of file JMakePD0.cc.

29 {
31 }
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition: JDrawPD0.cc:24
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
double getScatteringLength ( const double  lambda)
inline

Definition at line 34 of file JMakePD0.cc.

35 {
37 }
double getScatteringLength(const double lambda)
Get scattering length.
Definition: Antares.hh:148
double scatteringLengthFactor
Definition: JDrawPD0.cc:25
int main ( int  argc,
char **  argv 
)

Definition at line 54 of file JMakePD0.cc.

55 {
56  using namespace std;
57  using namespace JPP;
58 
59  string outputFile;
60  int numberOfPoints;
61  double epsilon;
62  int function;
63  set<double> D; // distance [m]
64  int debug;
65 
66  try {
67 
68  JParser<> zap("Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a bright point.");
69 
70  zap['o'] = make_field(outputFile);
71  zap['n'] = make_field(numberOfPoints, "points for integration") = 25;
72  zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10;
73  zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0;
74  zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0;
75  zap['F'] = make_field(function, "PDF type") =
78  zap['D'] = make_field(D, "distance [m]") = JPARSER::initialised();
79  zap['d'] = make_field(debug) = 0;
80 
81  zap['F'] = JPARSER::not_initialised();
82 
83  zap(argc, argv);
84  }
85  catch(const exception &error) {
86  FATAL(error.what() << endl);
87  }
88 
89 
90 
91  typedef double (JPDF::*fcn)(const double,
92  const double,
93  const double) const;
94 
95 
96  // set global parameters
97 
98  const double P_atm = NAMESPACE::getAmbientPressure();
99  const double wmin = getMinimalWavelength();
100  const double wmax = getMaximalWavelength();
101 
102 
103  const JPDF_C
110  P_atm,
111  wmin,
112  wmax,
114  epsilon);
115 
116 
117  typedef JSplineFunction1D_t JFunction1D_t;
118  typedef JMAPLIST<JPolint1FunctionalMap,
119  JPolint1FunctionalGridMap>::maplist JMapList_t;
120  typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
121 
122  typedef JPDFTransformer<2, JFunction1D_t::argument_type> JFunction2DTransformer_t;
123  typedef JArray<2, JFunction1D_t::argument_type> JArray_t;
124 
125  JPDF_t pdf;
126 
127 
128  NOTICE("building multi-dimensional function object <" << function << ">... " << flush);
129 
130  const double ng[] = { pdf_c.getIndexOfRefractionGroup(wmax),
131  pdf_c.getIndexOfRefractionGroup(wmin) };
132 
134 
135  zmap[DIRECT_LIGHT_FROM_BRIGHT_POINT] = make_pair((fcn) &JPDF::getDirectLightFromBrightPoint, JFunction2DTransformer_t(21.5, 2, ng[0], ng[1]));
136  zmap[SCATTERED_LIGHT_FROM_BRIGHT_POINT] = make_pair((fcn) &JPDF::getScatteredLightFromBrightPoint, JFunction2DTransformer_t(21.5, 2, ng[0], 0.0));
137 
138  if (zmap.find(function) == zmap.end()) {
139  FATAL("illegal function specifier" << endl);
140  }
141 
142  fcn f = zmap[function].first; // PDF
143  JFunction2DTransformer_t transformer = zmap[function].second; // transformer
144 
145 
146  if (D.empty()) {
147  D.insert( 0.10);
148  D.insert( 0.50);
149  D.insert( 1.00);
150  D.insert( 5.00);
151  D.insert( 10.00);
152  D.insert( 20.00);
153  D.insert( 30.00);
154  D.insert( 40.00);
155  D.insert( 50.00);
156  D.insert( 60.00);
157  D.insert( 70.00);
158  D.insert( 80.00);
159  D.insert( 90.00);
160  D.insert(100.00);
161  }
162 
163  set<double> X; // time [ns]
164 
165  if (function == DIRECT_LIGHT_FROM_BRIGHT_POINT) {
166 
167  for (double buffer[] = { 0.0, 0.005, 0.01, 0.015, -1 }, *x = buffer; *x >= 0; ++x) {
168  X.insert(0.0 + *x);
169  X.insert(1.0 - *x);
170  }
171 
172  for (double x = 0.02; x < 0.99; x += 0.01)
173  X.insert(x);
174 
175  } else {
176 
177  X.insert( 0.00);
178  X.insert( 0.10);
179  X.insert( 0.20);
180  X.insert( 0.30);
181  X.insert( 0.40);
182  X.insert( 0.50);
183  X.insert( 0.60);
184  X.insert( 0.70);
185  X.insert( 0.80);
186  X.insert( 0.90);
187  X.insert( 1.00);
188  X.insert( 1.00);
189  X.insert( 1.10);
190  X.insert( 1.20);
191  X.insert( 1.30);
192  X.insert( 1.40);
193  X.insert( 1.50);
194  X.insert( 1.60);
195  X.insert( 1.70);
196  X.insert( 1.80);
197  X.insert( 1.90);
198  X.insert( 2.00);
199  X.insert( 2.20);
200  X.insert( 2.40);
201  X.insert( 2.60);
202  X.insert( 2.80);
203  X.insert( 3.00);
204  X.insert( 3.25);
205  X.insert( 3.50);
206  X.insert( 3.75);
207  X.insert( 4.00);
208  X.insert( 4.25);
209  X.insert( 4.50);
210  X.insert( 4.75);
211  X.insert( 5.0);
212  X.insert( 6.0);
213  X.insert( 7.0);
214  X.insert( 8.0);
215  X.insert( 9.0);
216  X.insert( 10.0);
217  X.insert( 15.0);
218  X.insert( 20.0);
219  X.insert( 25.0);
220  X.insert( 30.0);
221  X.insert( 40.0);
222  X.insert( 50.0);
223  X.insert( 60.0);
224  X.insert( 70.0);
225  X.insert( 80.0);
226  X.insert( 90.0);
227  X.insert(100.0);
228  X.insert(120.0);
229  X.insert(140.0);
230  X.insert(160.0);
231  X.insert(180.0);
232  X.insert(200.0);
233  }
234 
235 
236  for (set<double>::const_iterator d = D.begin(); d != D.end(); ++d) {
237 
238  const double D_m = *d;
239 
240  for (double dc = 0.1, ct = -1.0; ct < +1.0 + 0.5*dc; ct += dc) {
241 
242  JFunction1D_t& f1 = pdf[D_m][ct];
243 
244  const JArray_t array(D_m, ct);
245 
246  double t_old = transformer.getXn(array, *X.begin());
247  double y_old = 0.0;
248 
249  for (set<double>::const_iterator x = X.begin(); x != X.end(); ++x) {
250 
251  const double t = transformer.getXn(array, *x);
252  const double y = (pdf_c.*f)(D_m, ct, t);
253 
254  if (y != 0.0) {
255 
256  if (*x < 0.0) {
257  WARNING("dt < 0 " << *x << ' ' << D_m << ' ' << t << ' ' << y << endl);
258  }
259 
260  if (y_old == 0.0) {
261  f1[t_old] = y_old;
262  }
263 
264  f1[t] = y;
265 
266  } else {
267 
268  if (y_old != 0.0) {
269  f1[t] = y;
270  }
271  }
272 
273  t_old = t;
274  y_old = y;
275  }
276  }
277  }
278 
279  pdf.transform(transformer);
280  pdf.compile();
281 
282  NOTICE("OK" << endl);
283 
284  try {
285 
286  NOTICE("storing output to file " << outputFile << "... " << flush);
287 
288  pdf.store(outputFile.c_str());
289 
290  NOTICE("OK" << endl);
291  }
292  catch(const JException& error) {
293  FATAL(error.what() << endl);
294  }
295 }
Utility class to parse command line options.
Definition: JParser.hh:1517
#define WARNING(A)
Definition: JMessage.hh:65
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
double absorptionLengthFactor
Scaling of absorption and scattering length.
Definition: JDrawPD0.cc:24
double getScatteringProbability(const double x)
Function to describe light scattering in water.
Definition: Antares.hh:210
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:26
direct light from bright point
Definition: JPDFTypes.hh:42
string outputFile
const JPolynome f1(1.0, 2.0, 3.0)
Function.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
Definition: JPDFToolkit.hh:37
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons...
double getAmbientPressure()
Get ambient pressure.
Definition: Antares.hh:40
#define NOTICE(A)
Definition: JMessage.hh:64
double getPhotocathodeArea()
Get photo-cathode area of PMT.
Definition: Antares.hh:51
scattered light from bright point
Definition: JPDFTypes.hh:43
#define FATAL(A)
Definition: JMessage.hh:67
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition: JParser.hh:89
double getAbsorptionLength(const double lambda)
Get absorption length.
Definition: Antares.hh:63
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
double getScatteringLength(const double lambda)
Get scattering length.
Definition: Antares.hh:148
int numberOfPoints
Definition: JResultPDF.cc:22
double scatteringLengthFactor
Definition: JDrawPD0.cc:25
no fit printf nominal n $STRING awk v X
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
const double epsilon
Definition: JQuadrature.cc:21
int debug
debug level
double getAngularAcceptance(const double x)
Angular acceptence of PMT.
Definition: JDrawLED.cc:68
Auxiliary data structure for muon PDF.
Definition: JPDF_t.hh:26

Variable Documentation

double absorptionLengthFactor

Scaling of absorption and scattering length.

Definition at line 24 of file JMakePD0.cc.

double scatteringLengthFactor

Definition at line 25 of file JMakePD0.cc.