PDF types.
PDF types.
   35{
   38 
   39  string        fileDescriptor;
   41  string        option;
   42  double        E;
   43  double        cd;
   45  double        TMax_ns;
   47 
   48  try { 
   49 
   51 
   54    zap[
'O'] = 
make_field(option)           = 
"KM3NeT", 
"Antares";
 
   55    zap[
'E'] = 
make_field(E,         
"muon/shower energy [GeV]");
 
   56    zap[
'c'] = 
make_field(cd,        
"cosine emission angle");
 
   57    zap[
'D'] = 
make_field(dir,       
"(theta, phi) of PMT [rad]");
 
   58    zap[
'T'] = 
make_field(TMax_ns,   
"L1 coincidence time window [ns]")  = 20.0;
 
   60 
   62 
   63    zap(argc, argv);
   64  }
   65  catch(const exception &error) {
   66    FATAL(error.what() << endl);
 
   67  }
   68 
   69 
   72 
   73 
   74  
   75 
   77 
   78  if        (option == "KM3NeT") {
   79 
  111 
  112  } else if (option == "Antares") {
  113 
  117 
  118  } else {
  119 
  120    FATAL(
"Fatal error at detector option " << option << endl);
 
  121  };
  122 
  123    
  124  
  125 
  127 
  130  }
  131 
  132 
  134 
  135 
  136  TH1D h0m("L0m", NULL, 300, 1.0, 151.0);
  137  TH1D h1m("L1m", NULL, 300, 1.0, 151.0);
  138 
  139  TH1D h0s("L0s", NULL, 300, 1.0, 151.0);
  140  TH1D h1s("L1s", NULL, 300, 1.0, 151.0);
  141 
  142 
  143  {
  149 
  150
  151
  152
  153    const JPDFType_t type[] = { DIRECT_LIGHT_FROM_MUON,
 
  154                                SCATTERED_LIGHT_FROM_MUON,
  155                                DIRECT_LIGHT_FROM_EMSHOWERS,
  156                                SCATTERED_LIGHT_FROM_EMSHOWERS,
  157                                DIRECT_LIGHT_FROM_DELTARAYS,
  158                                SCATTERED_LIGHT_FROM_DELTARAYS };
  159 
  160    const double TTS            = 2.0;        
  162    const double epsilon        = 1.0e-10;
 
  163 
  164    const int  NUMBER_OF_PDFS = sizeof(type)/sizeof(type[0]);
  165 
  166    JPDF_t pdf[NUMBER_OF_PDFS];               
  167 
  168    const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
 
  169 
  170    for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  171    
  172      try {
  173      
  174        const string file_name = getFilename(fileDescriptor, type[i]);
  175      
  176        NOTICE(
"loading PDF from file " << file_name << 
"... " << flush);
 
  177      
  178        pdf[i].load(file_name.c_str());
  179      
  181      
  182        pdf[i].setExceptionHandler(supervisor);      
  184      }
  187      }
  188    }
  189 
  190    const double Tmin =  -15.0;    
  191    const double Tmax = +250.0;    
  192    const double dt   =    1.0;    
  193    
  194    for (int ix = 1; ix <= h0m.GetNbinsX(); ++ix) {
  195 
  196      const double R = h0m.GetBinCenter(ix);
  197 
  198      double V = 0.0;
  199 
  200      for (vector<JAngle3D>::const_iterator pmt = 
PMT.begin(); pmt != 
PMT.end(); ++pmt) {
 
  201 
  202        const double theta = pi.constrain(pmt->getTheta());
  203        const double phi   = pi.constrain(fabs(pmt->getPhi()));
  204 
  205        for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  206 
  207          double yi = pdf[i](R, theta, phi, Tmax).V;
  208 
  210            yi *= E;
  213          }
  214        
  215          V += yi;
  216        }
  217 
  218        h0m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
  219      }
  220    }
  221 
  222    const int NUMBER_OF_PMTS = 
PMT.size();
 
  223 
  224    double Vi[NUMBER_OF_PMTS];     
  225 
  226    for (int ix = 1; ix <= h1m.GetNbinsX(); ++ix) {
  227 
  228      const double R = h1m.GetBinCenter(ix);
  229 
  230      double Y = 0.0;
  231      
  232      for (
double x = Tmin; 
x <= Tmax; 
x += dt) {
 
  233 
  234        double V = 0.0;
  235      
  236        for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
  237 
  238          Vi[pmt] = 0.0;
  239 
  240          const double theta = pi.constrain(
PMT[pmt].getTheta());
 
  241          const double phi   = pi.constrain(fabs(
PMT[pmt].getPhi()));
 
  242 
  243          for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  244            
  245            double yi[] = {
  246              pdf[i](R, theta, phi, 
x).v,
 
  247              pdf[i](R, theta, phi, x + TMax_ns).v
  248            };
  249 
  251              yi[0] *= E;
  252              yi[1] *= E;
  256            }
  257 
  258            Vi[pmt] += yi[1] - yi[0];
  259          }
  260        
  261          V += Vi[pmt];
  262        }
  263      
  264        for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
  265 
  266          const double theta = pi.constrain(
PMT[pmt].getTheta());
 
  267          const double phi   = pi.constrain(fabs(
PMT[pmt].getPhi()));
 
  268 
  270 
  271          for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  272 
  273            double yi = pdf[i](R, theta, phi, 
x).f;
 
  274 
  276              yi *= E;
  279            }
  280        
  282          }
  283        
  284          if (y > 0.0) {
  285            Y += 
y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
 
  286          }
  287        }  
  288      }
  289    
  290      h1m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
  291    }
  292  }
  293 
  294 
  295  {
  302 
  303
  304
  305
  306    const JPDFType_t type[] = { DIRECT_LIGHT_FROM_EMSHOWER,
 
  307                                SCATTERED_LIGHT_FROM_EMSHOWER };
  308 
  309    const double TTS            = 2.0;        
  311    const double epsilon        = 1.0e-10;
 
  312 
  313    const int  NUMBER_OF_PDFS = sizeof(type)/sizeof(type[0]);
  314 
  315    JPDF_t pdf[NUMBER_OF_PDFS];               
  316 
  317    const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
 
  318 
  319    for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  320    
  321      try {
  322      
  323        const string file_name = getFilename(fileDescriptor, type[i]);
  324      
  325        NOTICE(
"loading PDF from file " << file_name << 
"... " << flush);
 
  326      
  327        pdf[i].load(file_name.c_str());
  328      
  330      
  331        pdf[i].setExceptionHandler(supervisor);      
  333      }
  336      }
  337    }
  338 
  339    const double Tmin =  -15.0;    
  340    const double Tmax = +250.0;    
  341    const double dt   =    1.0;    
  342 
  343    for (int ix = 1; ix <= h0s.GetNbinsX(); ++ix) {
  344 
  345      const double D = h0s.GetBinCenter(ix);
  346 
  347      double V = 0.0;
  348 
  349      for (vector<JAngle3D>::const_iterator pmt = 
PMT.begin(); pmt != 
PMT.end(); ++pmt) {
 
  350 
  351        const double theta = pi.constrain(pmt->getTheta());
  352        const double phi   = pi.constrain(fabs(pmt->getPhi()));
  353        
  354        for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  355 
  356          double yi = pdf[i](D, cd, theta, phi, Tmax).V;
  357 
  358          yi *= E;
  359        
  360          V += yi;
  361        }
  362      }
  363 
  364      h0s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
  365    }
  366 
  367 
  368    const int NUMBER_OF_PMTS = 
PMT.size();
 
  369 
  370    double Vi[NUMBER_OF_PMTS];     
  371 
  372    for (int ix = 1; ix <= h1s.GetNbinsX(); ++ix) {
  373 
  374      const double D = h1s.GetBinCenter(ix);
  375 
  376      double Y = 0.0;
  377      
  378      for (
double x = Tmin; 
x <= Tmax; 
x += dt) {
 
  379 
  380        double V = 0.0;
  381          
  382        for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
  383 
  384          Vi[pmt] = 0.0;
  385 
  386          const double theta = pi.constrain(
PMT[pmt].getTheta());
 
  387          const double phi   = pi.constrain(fabs(
PMT[pmt].getPhi()));
 
  388 
  389          for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  390            
  391            double yi[] = {
  392              pdf[i](D, cd, theta, phi, 
x).v,
 
  393              pdf[i](D, cd, theta, phi, x + TMax_ns).v
  394            };
  395 
  396            yi[0] *= E;
  397            yi[1] *= E;
  398          
  399            Vi[pmt] += yi[1] - yi[0];
  400          }
  401        
  402          V += Vi[pmt];
  403        }
  404      
  405        for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
  406 
  407          const double theta = pi.constrain(
PMT[pmt].getTheta());
 
  408          const double phi   = pi.constrain(fabs(
PMT[pmt].getPhi()));
 
  409 
  411 
  412          for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
  413 
  414            double yi = pdf[i](D, cd, theta, phi, 
x).f;
 
  415 
  416            yi *= E;
  417 
  419          }
  420            
  421          if (y > 0.0) {
  422            Y += 
y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
 
  423          }
  424        }  
  425      }
  426    
  427      h1s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
  428    }
  429  }
  430 
  431 
  432  out.Write();
  433  out.Close();
  434}
JDAQPMTIdentifier PMT
Command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Data structure for angles in three dimensions.
 
Data structure for direction in three dimensions.
 
JDirection3D & rotate(const JRotation3D &R)
Rotate.
 
virtual const char * what() const override
Get error message.
 
Utility class to parse command line options.
 
Multi-dimensional PDF table for arrival time of Cherenkov light.
 
static const JZero zero
Function object to assign zero value.
 
double getDeltaRaysFromMuon(const double E, const JRange< double > T_GeV=JRange< double >(DELTARAY_TMIN, DELTARAY_TMAX))
Equivalent EM-shower energy due to delta-rays per unit muon track length.
 
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
 
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Empty structure for specification of parser element that is not initialised (i.e. does require input)...