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");
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);
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);
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);
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(2u, (
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(2u, (
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);
390 FATAL(error.what() << endl);
Various implementations of functional maps.
Photon emission profile EM-shower.
Longitudinal emission profile EM-shower.
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
Numbering scheme for PDF types.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary classes for numerical integration.
Auxiliary class for CPU timing and usage.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
Utility class to parse command line options.
double getLength(const double E, const double P, const double eps=1.0e-3) const
Get shower length for a given integrated probability.
Multi-dimensional PDF table for arrival time of Cherenkov light.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
static const JZero zero
Function object to assign zero value.
T pow(const T &x, const double y)
Power .
static const double PI
Mathematical constants.
static const JGeanx geanx(0.35, -5.40)
Function object for the number of photons from EM-shower as a function of emission angle.
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
@ SCATTERED_LIGHT_FROM_EMSHOWER
scattered light from EM shower
@ DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
const double getSpeedOfLight()
Get speed of light.
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
float getMemoryUsage(JShell &shell, const pid_t pid)
Get memory usage in percent of given process identifier.
Auxiliary data structure for floating point format specification.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...