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);
98 NOTICE(
"Apply detector offset " << center << endl);
110 const double ng[] = { dispersion.getIndexOfRefractionGroup(wmax),
111 dispersion.getIndexOfRefractionGroup(wmin) };
123 JMultiHistogram_t h0;
124 JMultiHistogram_t
h1;
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* p : { &h0, &
h1 }) {
166 (*p)[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 };
175 for (JMultiHistogram_t::super_iterator i1 =
h1.super_begin(); i1 !=
h1.super_end(); ++i1) {
176 for (
int j = 0;
j !=
sizeof(buffer)/
sizeof(buffer[0]); ++
j) {
177 i1.getValue()[buffer[
j]];
181 while (inputFile.hasNext()) {
183 NOTICE(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
STATUS(endl);
185 const Evt*
event = inputFile.next();
195 WARNING(
"No electron/hadrons found. Perhaps you meant to run this program in hadronic mode." << endl);
212 JAxis3D axis = pmtRouter.getPMT(hit->pmt_id);
220 const double cd = axis.
getZ()/D_m;
221 const double theta = axis.
getTheta();
222 const double phi = fabs(axis.
getPhi());
223 const double dt =
getTime(*hit) - t1;
224 const double npe =
getNPE (*hit);
227 h1.fill(D_m, cd, theta, phi, dt, npe/E);
231 catch(
const exception& error) {
232 FATAL(error.what() << endl);
236 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
246 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
258 for (JMultiHistogram_t::super_iterator i = h0.super_begin(); i != h0.super_end(); ++i) {
259 integral+=i.getValue().getIntegral();
261 DEBUG(
"Integral:\t" << integral << endl);
267 NOTICE(
"Storing, " << flush);
269 for (
const JMultiHistogram_t* p : { &h0, &
h1 }) {
Router for direct addressing of PMT data in detector data structure.
int count_electrons(const Evt &evt)
Count the number of electrons in a given event.
Utility class to parse command line options.
Data structure for direction in three dimensions.
double t
track time [ns] (when the particle is at pos )
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
Implementation of dispersion for water in deep sea.
then for HISTOGRAM in h0 h1
double getMinimalWavelength()
Get minimal wavelength for PDF evaluations.
double getTime(const Hit &hit)
Get true time of hit.
double getPhi() const
Get phi angle.
double E
Energy [GeV] (either MC truth or reconstructed)
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
static const double C
Physics constants.
Auxiliary class for defining the range of iterations of objects.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
JDirection3D getDirection(const Vec &dir)
Get direction.
Trk get_hadronic_cascade(const Evt &evt)
Auxiliary function to get average direction and total energy of a hadronic cascade.
const Trk & get_electron(const Evt &evt)
Get first electron from the event tracklist.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getTheta() const
Get theta angle.
JPosition3D getPosition(const Vec &pos)
Get position.
double getAmbientPressure()
Get ambient pressure.
static const double PI
Mathematical constants.
double getLength() const
Get length.
then usage $script[distance] fi case set_variable R
bool from_hadron(const Hit &hit)
Test whether given hit was produced by a hadronic shower.
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getNPE(const Hit &hit)
Get true charge of hit.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
Function object for the probability density function of photon emission from EM-shower as a function ...
do set_variable DETECTOR_TXT $WORKDIR detector
bool from_electron(const Hit &hit)
Test whether given hit was produced by an electron.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Binary buffered file output.
double getZ() const
Get z position.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
then usage $script[input file[working directory[option]]] nWhere option can be E
int count_hadrons(const Evt &evt)
Count the number of hadrons in a given event (not including neutral pions)
#define DEBUG(A)
Message macros.
double getAngularAcceptance(const double x)
Angular acceptence of PMT.