47 string fileDescriptor;
50 size_t elong_sample_count;
51 size_t cosine_angle_count;
61 JParser<> zap(
"Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
63 zap[
'F'] =
make_field(fileDescriptor,
"file name descriptor for PDF tables");
69 zap[
'C'] =
make_field(cosine_angle_count,
"points for cosine angle") = 60;
70 zap[
'N'] =
make_field(elong_sample_count,
"points for elongation") = 20;
71 zap[
'T'] =
make_field(TTS,
"sigma of time bluring [ns]") = 2.0;
72 zap[
'O'] =
make_field(option,
"optional transformation");
77 catch(
const exception &error) {
78 FATAL(error.what() << endl);
82 if (cosine_angle_count == 0) {
83 FATAL(
"Invalid option -C <" << cosine_angle_count <<
">" << endl);
86 typedef JPolint1Function1D_t JFunction1D_t;
88 typedef JMAPLIST<JPolint1FunctionalMap,
89 JPolint1FunctionalMap,
90 JPolint1FunctionalGridMap,
91 JPolint1FunctionalGridMap>::maplist J4DMapList_t;
93 typedef JMAPLIST<JPolint1FunctionalMap,
94 JPolint1FunctionalMap,
95 JPolint1FunctionalMap,
96 JPolint1FunctionalGridMap,
97 JPolint1FunctionalGridMap>::maplist J5DMapList_t;
99 typedef JPDFTable<JFunction1D_t, J4DMapList_t> JPDF4d_t;
100 typedef JPDFTable<JFunction1D_t, J5DMapList_t> JPDF5d_t;
102 typedef JPDFTransformer<4, JFunction1D_t::argument_type> JFunction4DTransformer_t;
103 typedef JPDFTransformer<5, JFunction1D_t::argument_type> JFunction5DTransformer_t;
104 typedef JArray<5, JFunction1D_t::argument_type> JArray_t;
112 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
114 i_pdf.load(file_name.c_str());
124 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
126 pdf.load(file_name.c_str());
131 pdf.setExceptionHandler(
new JPDF4d_t::JDefaultResult(
JMATH::zero));
133 NOTICE(
"Add PDF... " << flush);
144 timer.print(cout,
unit_t);
151 i_pdf.setExceptionHandler(
new JPDF4d_t::JDefaultResult(
JMATH::zero));
155 NOTICE(
"Smearing combined table with sigma [ns] = " << TTS <<
" ..." << flush);
164 const JFunction4DTransformer_t* i_transformer =
dynamic_cast<JFunction4DTransformer_t*
>(i_pdf.transformer->clone());
165 const JFunction5DTransformer_t* o_transformer = (i_transformer != NULL ?
new JFunction5DTransformer_t(*i_transformer) : NULL);
168 o_transformer->print(cout);
220 JQuadrature qeant(-1.0, +1.0, cosine_angle_count,
geanx);
222 for (JQuadrature::const_iterator
i = qeant.begin();
i != qeant.end(); ++
i) {
269 const double grid = 7.0;
270 const double alpha = 2.0 * sqrt(1.0 - cos(grid *
PI / 180.0));
272 NOTICE(
"building multi-dimensional function object" << endl);
274 for (
const double E : Es) {
276 DEBUG(
"E: " <<
E << endl);
280 for (
size_t i = 0;
i != elong_sample_count ; ++
i ){
282 const double fraction = (double) (
i + 0.5) / (double) elong_sample_count;
285 DEBUG(
"fraction: " << fraction <<
", length [m]: "<< len << endl);
287 elong_lengths.push_back(len);
290 if (elong_lengths.empty()) {
291 elong_lengths.push_back(0.0);
295 for (
const double D_m : Ds) {
297 DEBUG(
"D_m: " << D_m << endl);
299 for (
const double cd :
C) {
303 const unsigned int number_of_theta_points = max(2
u, (
unsigned int) (180.0/(1.4 * grid)));
305 for (
double theta = 0.0; theta <=
PI +
epsilon; theta +=
PI/number_of_theta_points) {
307 const unsigned int number_of_phi_points = max(2
u, (
unsigned int) (
PI *
sin(theta) / alpha));
309 for (
double phi = 0.0; phi <=
PI +
epsilon; phi +=
PI/number_of_phi_points) {
311 JFunction1D_t&
f1 = o_pdf[
E][D_m][cd][theta][phi];
313 f1.reserve(
X.size());
315 const JArray_t array(
E, D_m, cd, theta, phi);
317 double t_old = (o_transformer != NULL ? o_transformer->getXn(array, *
X.begin()) : *
X.begin());
322 const double t = (o_transformer != NULL ? o_transformer->getXn(array, *
x) : *
x);
326 for (
const double Z : elong_lengths) {
328 const double Z0 = cd * D_m;
329 const double Z1 = Z0 -
Z;
331 const double D_m_prime = sqrt(D_m * D_m + Z1 * Z1 - Z0 * Z0);
332 const double cd_prime = Z1 / D_m_prime;
335 y += i_pdf(D_m_prime, cd_prime, theta, phi, t_prime);
338 y /= (double) elong_lengths.size();
343 WARNING(
"dt < 0 " << *
x <<
' ' << D_m <<
' ' << t <<
' ' << y << endl);
372 if (o_transformer != NULL && option) {
374 NOTICE(
"transform... " << flush);
376 o_pdf.transform(*o_transformer);
389 catch(
const JException& error) {
390 FATAL(error.what() << endl);
Utility class to parse command line options.
float getMemoryUsage(JShell &shell, const pid_t pid)
Get memory usage in percent of given process identifier.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
scattered light from EM shower
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
static const JZero zero
Function object to assign zero value.
Auxiliary data structure for floating point format specification.
static const double C
Physics constants.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
T pow(const T &x, const double y)
Power .
direct light from EM shower
static const double PI
Mathematical constants.
const double getSpeedOfLight()
Get speed of light.
static const JGeanx geanx(0.35,-5.40)
Function object for the number of photons from EM-shower as a function of emission angle...
no fit printf nominal n $STRING awk v X
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
double getLength(const double E, const double P, const double eps=1.0e-3) const
Get shower length for a given integrated probability.
#define DEBUG(A)
Message macros.