55int main(
int argc, 
char **argv)
 
   69    JParser<> zap(
"Program to create interpolation tables of the PDF of the arrival time of the Cherenkov light from a shower.");
 
   73    zap[
'e'] = 
make_field(epsilon,                
"precision for integration")  = 1.0e-10;
 
   77      SCATTERED_LIGHT_FROM_MUON_5D,
 
   78      DIRECT_LIGHT_FROM_EMSHOWER,
 
   79      SCATTERED_LIGHT_FROM_EMSHOWER;
 
   87  catch(
const exception &error) {
 
   88    FATAL(error.what() << endl);
 
   92  typedef double (
JPDF::*fcn)(
const double,
 
  101  const double P_atm = NAMESPACE::getAmbientPressure();
 
  102  const double wmin  = getMinimalWavelength();
 
  103  const double wmax  = getMaximalWavelength();
 
  107    pdf_c(NAMESPACE::getPhotocathodeArea(),
 
  109          NAMESPACE::getAngularAcceptance,
 
  112          NAMESPACE::getScatteringProbability,
 
  133  NOTICE(
"building multi-dimensional function object <" << function << 
">... " << flush);
 
  140  zmap[SCATTERED_LIGHT_FROM_MUON_5D]  = make_pair((fcn) &JPDF::getScatteredLightFromMuon,     JFunction4DTransformer_t(21.5, 2, ng[0], 0.0,   
JGeant(
JGeanx(0.33, -9.5)), 6e-4, NAMESPACE::getAngularAcceptance, 0.06));
 
  141  zmap[DIRECT_LIGHT_FROM_EMSHOWER]    = make_pair((fcn) &JPDF::getDirectLightFromEMshower,    JFunction4DTransformer_t(21.5, 2, ng[0], ng[1], 
JGeant(
JGeanx(0.35, -5.4)), 1e-5, NAMESPACE::getAngularAcceptance, 0.001));
 
  142  zmap[SCATTERED_LIGHT_FROM_EMSHOWER] = make_pair((fcn) &JPDF::getScatteredLightFromEMshower, JFunction4DTransformer_t(21.5, 2, ng[0], 0.0,   
JGeant(
JGeanx(0.55, -4.5)), 1e-2, NAMESPACE::getAngularAcceptance, 0.05));
 
  144  if (zmap.find(function) == zmap.end()) {
 
  145    FATAL(
"illegal function specifier" << endl);
 
  148  fcn                      f           = zmap[function].first;    
 
  149  JFunction4DTransformer_t transformer = zmap[function].second;   
 
  192  if (function == DIRECT_LIGHT_FROM_EMSHOWER) {
 
  194    for (
double buffer[] = { 0.0, 0.005, 0.01, 0.015, -1 }, *x = buffer; *x >= 0; ++x) {
 
  199    for (
double x = 0.02; x < 0.99; x += 0.01)
 
  274  const double grid  =  7.0;                                      
 
  276  const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0));  
 
  281    const double D_m = *d;
 
  285      const double cd  = *c;
 
  287      const unsigned int number_of_theta_points = max(2u, (
unsigned int) (180.0/(1.4 * grid)));
 
  289      for (
double theta = 0.0; theta <= PI + epsilon; theta += PI/number_of_theta_points) {
 
  291        const unsigned int number_of_phi_points = max(2u, (
unsigned int) (PI * sin(theta) / alpha));
 
  293        for (
double phi = 0.0; phi <= PI + epsilon; phi += PI/number_of_phi_points) {
 
  295          JFunction1D_t& f1 = pdf[D_m][cd][theta][phi];
 
  297          const JArray_t 
array(D_m, cd, theta, phi);
 
  299          double t_old = transformer.getXn(
array, *X.begin());
 
  304            const double t = transformer.getXn(
array, *x);
 
  305            const double y = (pdf_c.*f)(D_m, cd, theta, phi, t);
 
  310                WARNING(
"dt < 0 " << *x << 
' ' << D_m << 
' ' << t << 
' ' << y << endl);
 
  334  pdf.transform(transformer);
 
  348    FATAL(error.what() << endl);