57{
   60 
   62  JLimit_t&   numberOfEvents = inputFile.getLimit();
 
   64  string      detectorFile;
   65  bool        hadronicMode;
   67 
   68  try {
   69 
   70    JParser<> zap(
"Program to histogram event-by-event data of shower light for making PDFs.");
 
   71 
   78 
   79    zap(argc, argv);
   80  }
   81  catch(const exception &error) {
   82    FATAL(error.what() << endl);
 
   83  }
   84 
   85  if(hadronicMode) {
   86    NOTICE(
"Plotting hadronic showers." << endl);
 
   87  } else {
   88    NOTICE(
"Plotting EM showers." << endl);
 
   89  }
   90 
   91 
   93 
   94  try {
   96  }
   99  }
  100 
  102 
  104 
  105  NOTICE(
"Apply detector offset " << offset << endl);
 
  106 
  108 
  110 
  112 
  113  const double P_atm = NAMESPACE::getAmbientPressure();
  116 
  118 
  119  const double ng[] = { dispersion.getIndexOfRefractionGroup(wmax),
  120                        dispersion.getIndexOfRefractionGroup(wmin) };
  121 
  123 
  129 
  131 
  132  JMultiHistogram_t h0;   
  133  JMultiHistogram_t h1;   
  134 
  135  h1.transformer.reset(
new JFunction4DTransformer_t(21.5, 2, ng[0], 0.0,   
JGeant(
JGeanx(1.00, -2.2)), 1e-2, NAMESPACE::getAngularAcceptance, 0.05));
 
  136 
  138 
  140 
  142    C.insert(i->getX());
  143  }
  144 
  145  C.insert(-1.01);
  146  C.insert(-1.00);
  147  C.insert( 1.00);
  148  C.insert( 1.01);
  149 
  150  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};
  151  const double Dmax_m = 80.0;
  152 
  153  for (int i = 0; i != sizeof(R)/sizeof(R[0]); ++i) {
  154 
  155    const double R_m = R[i];
  156    
  158 
  159      const double cd = *c;
  160 
  161      const double grid  = 10.0 +  0.0 * R_m/100.0;                         
  162      const double alpha = 2.0 * sqrt(1.0 - cos(grid * PI / 180.0));        
  163    
  164      const int    number_of_theta_points = max(2, (int) (180.0/(1.4 * grid)));
  165      const double theta_step             = PI / (number_of_theta_points + 1);
  166 
  167      for (double theta = -0.5*theta_step; theta < PI + theta_step; theta += theta_step) {
  168        
  169        const int    number_of_phi_points = max(2, (int) (PI * sin(theta) / alpha));
  170        const double phi_step             = PI / (number_of_phi_points + 1);
  171        
  172        for (double phi = -0.5*phi_step; phi < PI + phi_step; phi += phi_step) {
  173    
  174          for (JMultiHistogram_t* p : { &h0, &h1 }) {
  175            (*p)[R_m][cd][theta][phi];
  176          }
  177        }
  178      }
  179    }
  180  }
  181 
  182  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 };
  183 
  184  for (JMultiHistogram_t::super_iterator i1 = h1.super_begin(); i1 != h1.super_end(); ++i1) {
  185    for (
int j = 0; 
j != 
sizeof(buffer)/
sizeof(buffer[0]); ++
j) {
 
  186      i1.getValue()[buffer[
j]];
 
  187    }
  188  }
  189 
  191 
  193 
  194    const Evt* 
event = inputFile.
next();
 
  195 
  197      WARNING(
"Event " << inputFile.
getCounter() << 
" does not correspond to a neutrino interaction; skip.");
 
  198      continue;
  199    }
  200    
  202      WARNING(
"No electron/hadrons found; skip.");
 
  203      continue;
  204    }
  205 
  207 
  210 
  212    
  214    
  216 
  217    for (vector<Hit>::const_iterator hit = event->mc_hits.begin(); hit != event->mc_hits.end(); ++hit)  {
  218 
  219      try {
  220 
  221        JAxis3D axis = pmtRouter.getPMT(hit->pmt_id);
 
  222 
  224 
  226      
  228      
  230          const double cd    = axis.
getZ() / D_m;
 
  231          const double theta = axis.
getTheta();
 
  232          const double phi   = fabs(axis.
getPhi());
 
  233          const double dt    = 
getTime(*hit) - t1;
 
  234          const double npe   = 
getNPE (*hit);
 
  235 
  236          if (D_m < Dmax_m) {
  237            h1.fill(D_m, cd, theta, phi, dt, npe/Evis);
  238          }
  239        }
  240      }
  241      catch(const exception& error) {
  242        FATAL(error.what() << endl);
 
  243      }
  244    }
  245 
  246    for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  247 
  249 
  251 
  253 
  255 
  256        for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
  257 
  259 
  261 
  263        }
  264      }
  265    }
  266  }
  267 
  268  double integral = 0;
  269  for (JMultiHistogram_t::super_iterator i = h0.super_begin(); i != h0.super_end(); ++i) {
  270    integral+=i.getValue().getIntegral();
  271  }
  272  DEBUG(
"Integral:\t" << integral << endl);
 
  273 
  274  
  275 
  277 
  278  NOTICE(
"Storing, " << flush);
 
  279 
  280  for (const JMultiHistogram_t* p : { &h0, &h1 }) {
  281    out.store(*p);
  282  }
  283 
  284  out.close();
  286}
#define DEBUG(A)
Message macros.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Router for direct addressing of PMT data in detector data structure.
 
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
 
Data structure for position in three dimensions.
 
JPosition3D & rotate(const JRotation3D &R)
Rotate.
 
const JPosition3D & getPosition() const
Get position.
 
double getLength() const
Get length.
 
double getZ() const
Get z position.
 
JVector3D & sub(const JVector3D &vector)
Subtract vector.
 
double getTheta() const
Get theta angle.
 
double getPhi() const
Get phi angle.
 
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
 
Binary buffered file output.
 
Utility class to parse command line options.
 
Implementation of dispersion for water in deep sea.
 
Function object for the probability density function of photon emission from EM-shower as a function ...
 
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
 
General purpose class for object reading from a list of file names.
 
virtual bool hasNext() override
Check availability of next element.
 
counter_type getCounter() const
Get counter.
 
virtual const pointer_type & next() override
Get next element.
 
JDirection3D getDirection(const Vec &dir)
Get direction.
 
bool from_hadron(const Hit &hit)
Test whether given hit was produced by a hadronic shower.
 
JVertex3D getVertex(const Trk &track)
Get vertex.
 
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
 
bool has_electron(const Evt &evt)
Test whether given event has an electron.
 
JPosition3D getPosition(const Vec &pos)
Get position.
 
bool from_electron(const Hit &hit)
Test whether given hit was produced by an electron.
 
double getNPE(const Hit &hit)
Get true charge of hit.
 
Vec getOffset(const JHead &header)
Get offset.
 
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
 
int count_hadrons(const Evt &evt)
Count the number of hadrons in a given event (not including neutral pions)
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
 
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
 
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
 
const double getInverseSpeedOfLight()
Get inverse speed of light.
 
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
 
static const double C
Physics constants.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
double getVisibleEnergy(const Trk &track, const JCylinder3D &can=getMaximumContainmentVolume())
Get the visible energy of a track.
 
Vec getVisibleEnergyVector(const Trk &track, const JCylinder3D &can=getMaximumContainmentVolume())
Get the visible energy vector of a track.
 
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
 
const char * getTime()
Get current local time conform ISO-8601 standard.
 
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
 
The cylinder used for photon tracking.
 
Auxiliary class for defining the range of iterations of objects.
 
static counter_type max()
Get maximum counter value.
 
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
 
The Vec class is a straightforward 3-d vector, which also works in pyroot.