59   vector<Int_t> hit_remapping;
 
   60   for (vector<Trk>::const_iterator i = tracklist->begin(); i != tracklist->end(); ++i) {
 
   63     hit_remapping.push_back(i->id);
 
   68 int main(
int argc, 
char **argv)
 
   83     JParser<> zap(
"Program to histogram event-by-event data of shower light for making PDFs.");
 
   93     if (zap.
read(argc, argv) != 0)
 
   96   catch(
const exception &error) {
 
   97     FATAL(error.what() << endl);
 
  103     sort(particles.begin(), particles.end());
 
  104     string prefix_t = 
"";
 
  105     for(vector<int>::iterator ptype = particles.begin(); ptype != particles.end(); ptype++){
 
  106       prefix_t += 
to_string((
long long int)*ptype) + 
"_";
 
  108     prefix_t.erase(prefix_t.size() - 1);
 
  109     string::size_type pos_1 = 
outputFile.find(
'%');
 
  122   NOTICE(
"Apply detector offset " << center << endl);
 
  132   const JDispersion dispersion(P_atm);
 
  134   const double ng[] = { dispersion.getIndexOfRefractionGroup(wmax),
 
  135                         dispersion.getIndexOfRefractionGroup(wmin) };
 
  140                                JMAPLIST<JHistogramMap_t,
 
  144                                     JHistogramGridMap_t>::maplist> JMultiHistogram_t;
 
  146   typedef JPDFTransformer<5, abscissa_type>  JFunction5DTransformer_t;
 
  148   JMultiHistogram_t h0;   
 
  149   JMultiHistogram_t h1;   
 
  155   JQuadrature qeant(-1.0, 1.0, 30, JGeanx(1.00, -2.2));
 
  157   for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i) {
 
  166   const double E_b[] = {0.01, 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 40.0, 55.0, 70.0, 85.0, 100.0};
 
  168   const double R[]   = {0.0, 1.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, 65.0, 80.0};
 
  169   const double Dmax_m = R[
sizeof(R)/
sizeof(R[0]) - 1]; 
 
  171   for (
int iE = 0; iE != 
sizeof(E_b)/
sizeof(E_b[0]); ++iE) {
 
  173     const double E_m = E_b[iE];
 
  175     for (
int i = 0; i != 
sizeof(R)/
sizeof(R[0]); ++i) {
 
  177       const double R_m = R[i];
 
  181         const double cd = *c;
 
  183         const double grid  = 10.0 +  0.0 * R_m/100.0;                    
 
  184         const double alpha = 2.0 * sqrt(1.0 - cos(grid * 
PI / 180.0));   
 
  186         const int    number_of_theta_points = (max(2, (
int) (180.0/(1.4 * grid))));
 
  187         const double theta_step             = 
PI / (number_of_theta_points + 1);
 
  189         for (
double theta = -0.5*theta_step; theta < 
PI + theta_step; theta += theta_step) {      
 
  190           const int    number_of_phi_points = (max(2, (
int) (
PI * sin(theta) / alpha)));
 
  191           const double phi_step             = 
PI / (number_of_phi_points + 1);
 
  193           for (
double phi = -0.5*phi_step; phi < 
PI + phi_step; phi += phi_step) {
 
  195             for (JMultiHistogram_t* buffer[] = { &h0, &h1, NULL }, **histogram = buffer; *histogram != NULL; ++histogram) {
 
  196               (**histogram)[E_m][R_m][cd][theta][phi];
 
  204   double buffer[] = {-15.0,-10.0,-7.5,-5,-4,-3,-2,-1.5,-1.0,-0.5,-0.1, 0.0,0.1, 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 };
 
  205   for (JMultiHistogram_t::super_iterator
 
  206          i1 = h1.super_begin(); i1 != h1.super_end(); ++i1) {
 
  207     for (
int j = 0; 
j != 
sizeof(buffer)/
sizeof(buffer[0]); ++
j) {
 
  208       i1.getValue()[buffer[
j]];
 
  213   long long int h0_fillcount = 0;
 
  214   long long int h1_fillcount = 0;
 
  221     const Evt* 
event = inputFile.
next();
 
  222     const vector<Trk>* mc_tracks = &(
event->mc_trks);
 
  232       for (vector<Trk>::const_iterator i = mc_tracks->begin(); i != mc_tracks->end(); ++i) {
 
  233         hit_remap.push_back(i->id);
 
  237     double t0 = (*mc_tracks)[1].t;
 
  239     for (vector<Hit>::const_iterator hit = event->mc_hits.begin(); hit != 
event->mc_hits.end(); ++hit)  {
 
  243         if(hit->origin >= (
int)(*mc_tracks).size()){
 
  244           std::out_of_range err(
"Hit origin not in tracklist. Avoided segfault");
 
  248         Int_t corr_origin  = hit_remap[hit->origin];
 
  249         Trk curr_track     = (*mc_tracks)[corr_origin]; 
 
  255         const double E     = curr_track.E;
 
  258         const double cd    = axis.
getZ()/D_m;
 
  259         const double theta = axis.
getTheta();
 
  260         const double phi   = fabs(axis.
getPhi());
 
  261         const double dt    = 
getTime(*hit) - t1;
 
  262         const double npe   = 
getNPE(*hit);
 
  265           h1.fill(E, D_m, cd, theta, phi, dt, npe);
 
  269       catch(
const exception& error) {
 
  270         std::cout << 
"Fatal error for event: " << inputFile.
getCounter() << std::endl;
 
  271         FATAL(error.what() << endl);
 
  276     for (vector<Trk>::const_iterator tr = event->mc_trks.begin() + 1; tr != 
event->mc_trks.end(); ++tr) {
 
  278       if(find(particles.begin(), particles.end(), tr->type) == particles.end()){
 
  288       for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  298           for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  310     if(h1_fillcount > h0_fillcount){
 
  311       std::cout << 
"WARNING: recorded hits in normalization histogram that were not recorded in normalization histogram. This should not happen." << std::endl;
 
  312       std::cout << 
"h1_fillcount: " << h1_fillcount << 
", h0_fillcount: " << h0_fillcount << std::endl;
 
  317   for (JMultiHistogram_t::super_iterator i = h0.super_begin(); i != h0.super_end(); ++i) {
 
  318     integral+=i.getValue().getIntegral();
 
  320   DEBUG(
"Integral:\t" << integral << endl);
 
  328   for (
const JMultiHistogram_t* buffer[] = { &h0, &h1, NULL }, **i = buffer; *i != NULL; ++i) {
 
  333   NOTICE(
"JHistHDE done. " << endl);