42 int main(
int argc,
char **argv)
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");
66 zap[
'e'] =
make_field(epsilon,
"precision for integration") = 1.0e-10;
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 transfomation");
77 catch(
const exception &error) {
78 FATAL(error.what() << endl);
81 typedef JPolint1Function1D_t JFunction1D_t;
83 typedef JMAPLIST<JPolint1FunctionalMap,
84 JPolint1FunctionalMap,
85 JPolint1FunctionalGridMap,
86 JPolint1FunctionalGridMap>::maplist J4DMapList_t;
88 typedef JMAPLIST<JPolint1FunctionalMap,
89 JPolint1FunctionalMap,
90 JPolint1FunctionalMap,
91 JPolint1FunctionalGridMap,
92 JPolint1FunctionalGridMap>::maplist J5DMapList_t;
94 typedef JPDFTable<JFunction1D_t, J4DMapList_t> JPDF4d_t;
95 typedef JPDFTable<JFunction1D_t, J5DMapList_t> JPDF5d_t;
97 typedef JPDFTransformer<4, JFunction1D_t::argument_type> JFunction4DTransformer_t;
98 typedef JPDFTransformer<5, JFunction1D_t::argument_type> JFunction5DTransformer_t;
99 typedef JArray<5, JFunction1D_t::argument_type> JArray_t;
107 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
109 i_pdf.load(file_name.c_str());
119 NOTICE(
"loading input from file " << file_name <<
"... " << flush);
121 pdf.load(file_name.c_str());
126 pdf.setExceptionHandler(
new JPDF4d_t::JDefaultResult(
JMATH::zero));
128 NOTICE(
"Add PDF... " << flush);
139 timer.print(cout,
unit_t);
146 i_pdf.setExceptionHandler(
new JPDF4d_t::JDefaultResult(
JMATH::zero));
149 NOTICE(
"Smearing combined table with sigma [ns] = " << TTS );
155 const JFunction4DTransformer_t* i_transformer =
dynamic_cast<JFunction4DTransformer_t*
>(i_pdf.transformer->clone());
156 const JFunction5DTransformer_t* o_transformer = (i_transformer != NULL ?
new JFunction5DTransformer_t(*i_transformer) : NULL);
159 o_transformer->print(cout);
162 NOTICE(
"building multi-dimensional function object" << flush);
DEBUG(endl);
214 JQuadrature qeant(-1.0, +1.0, cosine_angle_count,
geanx);
216 for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i) {
263 const double grid = 7.0;
264 const double alpha = 2.0 * sqrt(1.0 - cos(grid *
PI / 180.0));
266 for (
const double E : Es) {
268 DEBUG(
"E: " <<
E << endl);
272 for (
size_t i = 0; i != elong_sample_count ; ++i ){
274 const double fraction = (double) (i + 0.5) / (double) elong_sample_count;
277 DEBUG(
"fraction: " << fraction <<
", length [m]: "<< len << endl);
279 elong_lengths.push_back(len);
282 for (
const double D_m : Ds) {
284 DEBUG(
"D_m: " << D_m << endl);
286 for (
const double cd :
C) {
290 const unsigned int number_of_theta_points = max(2
u, (
unsigned int) (180.0/(1.4 * grid)));
292 for (
double theta = 0.0; theta <=
PI + epsilon; theta +=
PI/number_of_theta_points) {
294 const unsigned int number_of_phi_points = max(2
u, (
unsigned int) (
PI * sin(theta) / alpha));
296 for (
double phi = 0.0; phi <=
PI + epsilon; phi +=
PI/number_of_phi_points) {
298 JFunction1D_t& f1 = o_pdf[
E][D_m][cd][theta][phi];
300 const JArray_t array(
E, D_m, cd, theta, phi);
302 double t_old = (o_transformer != NULL ? o_transformer->getXn(array, *
X.begin()) : *
X.begin());
307 const double t = (o_transformer != NULL ? o_transformer->getXn(array, *
x) : *
x);
313 const double Z0 = cd * D_m;
314 const double Z1 = Z0 - *ilen;
316 const double D_m_prime = sqrt( D_m * D_m + Z1 * Z1 - Z0 * Z0 );
317 const double cd_prime = Z1 / D_m_prime;
320 y += i_pdf(D_m_prime, cd_prime, theta, phi, t_prime);
323 y /= (float) elong_sample_count;
328 WARNING(
"dt < 0 " << *
x <<
' ' << D_m <<
' ' << t <<
' ' << y << endl);
357 if (o_transformer != NULL && option) {
359 NOTICE(
"transform... " << flush);
361 o_pdf.transform(*o_transformer);
374 catch(
const JException& error) {
375 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.
int main(int argc, char *argv[])
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.
Various implementations of functional maps.
Numbering scheme for PDF types.
static const double C
Physics constants.
#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 .
then break fi done getCenter read X Y Z let X
direct light from EM shower
static const double PI
Mathematical constants.
General purpose messaging.
Photon emission profile EM-shower.
Auxiliary classes for numerical integration.
const double getSpeedOfLight()
Get speed of light.
Utility class to parse command line options.
static const JGeanx geanx(0.35,-5.40)
Function object for the number of photons from EM-shower as a function of emission angle...
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
Longitudinal emission profile EM-shower.
double getLength(const double E, const double P, const double eps=1.0e-3) const
Get shower length for a given integrated probability.