51 int main(
int argc, 
char **argv)
 
   56   JMultipleFileScanner<Evt> inputFile;
 
   65     JParser<> zap(
"Program to histogram event-by-event data of shower light for making PDFs.");
 
   69     zap[
'n'] = 
make_field(numberOfEvents)         = JLimit::max();
 
   76   catch(
const exception &error) {
 
   77     FATAL(error.what() << endl);
 
   81     NOTICE(
"Plotting hadronic showers." << endl);
 
   83     NOTICE(
"Plotting EM showers." << endl);
 
   90     load(detectorFile, detector);
 
   92   catch(
const JException& error) {
 
   96   const JPosition3D center = get<JPosition3D>(
getHeader(inputFile));
 
   98   NOTICE(
"Apply detector offset " << center << endl);
 
  102   const JPMTRouter pmtRouter(detector);
 
  108   const JDispersion dispersion(P_atm);
 
  110   const double ng[] = { dispersion.getIndexOfRefractionGroup(wmax),
 
  111                         dispersion.getIndexOfRefractionGroup(wmin) };
 
  116                                        JMAPLIST<JHistogramMap_t,
 
  119                                                 JHistogramGridMap_t>::maplist> JMultiHistogram_t;
 
  121   typedef JPDFTransformer<4, abscissa_type>                         JFunction4DTransformer_t;
 
  123   JMultiHistogram_t h0;   
 
  124   JMultiHistogram_t h1;   
 
  130   JQuadrature qeant(-1.0, 1.0, 20, JGeanx(1.00, -2.2));
 
  132   for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i) {
 
  141   const double R[] = {0.0, 2.5, 5.0, 7.5, 10.0, 12.5, 15.0, 17.5, 20.0, 25.0, 30.0, 35.0, 40.0, 50.0, 60.0, 70.0, 80.0};
 
  142   const double Dmax_m = 80.0;
 
  144   for (
int i = 0; i != 
sizeof(R)/
sizeof(R[0]); ++i) {
 
  146     const double R_m = R[i];
 
  150       const double cd = *c;
 
  152       const double grid  = 10.0 +  0.0 * R_m/100.0;                         
 
  153       const double alpha = 2.0 * sqrt(1.0 - cos(grid * 
PI / 180.0));        
 
  155       const int    number_of_theta_points = max(2, (
int) (180.0/(1.4 * grid)));
 
  156       const double theta_step             = 
PI / (number_of_theta_points + 1);
 
  158       for (
double theta = -0.5*theta_step; theta < 
PI + theta_step; theta += theta_step) {
 
  160         const int    number_of_phi_points = max(2, (
int) (
PI * sin(theta) / alpha));
 
  161         const double phi_step             = 
PI / (number_of_phi_points + 1);
 
  163         for (
double phi = -0.5*phi_step; phi < 
PI + phi_step; phi += phi_step) {
 
  165           for (JMultiHistogram_t* buffer[] = { &h0, &h1, NULL }, **histogram = buffer; *histogram != NULL; ++histogram) {
 
  166             (**histogram)[R_m][cd][theta][phi];
 
  173   double buffer[] = { 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.5, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 85.0, 100.0 };
 
  174   for (JMultiHistogram_t::super_iterator 
 
  175          i1 = h1.super_begin(); i1 != h1.super_end(); ++i1) {
 
  177     for (
int j = 0; 
j != 
sizeof(buffer)/
sizeof(buffer[0]); ++
j) {
 
  178       i1.getValue()[buffer[
j]];
 
  182   while (inputFile.hasNext()) {
 
  184     NOTICE(
"event: " << setw(10) << inputFile.getCounter() << 
'\r'); 
STATUS(endl);
 
  186     const Evt* 
event = inputFile.next();
 
  196       WARNING(
"No electron/hadrons found. Perhaps you meant to run this program in hadronic mode." << endl);
 
  205     const JRotation3D R(dir);
 
  213         JAxis3D axis = pmtRouter.getPMT(hit->pmt_id);
 
  214         axis.transform(R, pos);
 
  220           const double D_m   = axis.getLength();
 
  221           const double cd    = axis.getZ()/D_m;
 
  222           const double theta = axis.getTheta();
 
  223           const double phi   = fabs(axis.getPhi());
 
  224           const double dt    = 
getTime(*hit) - t1;
 
  225           const double npe   = 
getNPE(*hit);
 
  228             h1.fill(D_m, cd, theta, phi, dt, npe/E);
 
  232       catch(
const exception& error) {
 
  233         FATAL(error.what() << endl);
 
  237     for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
 
  239       JPosition3D P = module->getPosition();
 
  245       if (P.getLength() < h0.getXmax()) {
 
  247         for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  250           axis.transform(R, pos);
 
  252           h0.fill(axis.getLength(), axis.getZ()/axis.getLength(), axis.getTheta(), fabs(axis.getPhi()), 0.0, 1.0);
 
  259   for (JMultiHistogram_t::super_iterator i = h0.super_begin(); i != h0.super_end(); ++i) {
 
  260     integral+=i.getValue().getIntegral();
 
  262   DEBUG(
"Integral:\t" << integral << endl);
 
  268   NOTICE(
"Storing, " << flush);
 
  270   for (
const JMultiHistogram_t* buffer[] = { &h0, &h1, NULL }, **i = buffer; *i != NULL; ++i) {