70 hit_remapping.push_back(i->id);
76 int main(
int argc,
char **argv)
91 JParser<> zap(
"Program to histogram event-by-event data of shower light for making PDFs.");
101 if (zap.
read(argc, argv) != 0)
104 catch(
const exception &error) {
105 FATAL(error.what() << endl);
111 sort(particles.begin(), particles.end());
112 string prefix_t =
"";
114 prefix_t +=
to_string((
long long int)*ptype) +
"_";
116 prefix_t.erase(prefix_t.size() - 1);
117 string::size_type pos_1 =
outputFile.find(
'%');
130 NOTICE(
"Apply detector offset " << center << endl);
156 JMultiHistogram_t h0;
157 JMultiHistogram_t
h1;
165 for (JQuadrature::const_iterator i = qeant.begin(); i != qeant.end(); ++i) {
174 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};
176 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};
177 const double Dmax_m =
R[
sizeof(
R)/
sizeof(
R[0]) - 1];
179 for (
int iE = 0; iE !=
sizeof(E_b)/
sizeof(E_b[0]); ++iE) {
181 const double E_m = E_b[iE];
183 for (
int i = 0; i !=
sizeof(
R)/
sizeof(
R[0]); ++i) {
185 const double R_m =
R[i];
189 const double cd = *c;
191 const double grid = 10.0 + 0.0 * R_m/100.0;
192 const double alpha = 2.0 * sqrt(1.0 - cos(grid *
PI / 180.0));
194 const int number_of_theta_points = (max(2, (
int) (180.0/(1.4 * grid))));
195 const double theta_step =
PI / (number_of_theta_points + 1);
197 for (
double theta = -0.5*theta_step; theta <
PI + theta_step; theta += theta_step) {
198 const int number_of_phi_points = (max(2, (
int) (
PI * sin(theta) / alpha)));
199 const double phi_step =
PI / (number_of_phi_points + 1);
201 for (
double phi = -0.5*phi_step; phi <
PI + phi_step; phi += phi_step) {
203 for (JMultiHistogram_t* p : { &h0, &
h1 }) {
204 (*p)[E_m][R_m][cd][theta][phi];
212 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 };
213 for (JMultiHistogram_t::super_iterator
214 i1 =
h1.super_begin(); i1 !=
h1.super_end(); ++i1) {
215 for (
int j = 0;
j !=
sizeof(buffer)/
sizeof(buffer[0]); ++
j) {
216 i1.getValue()[buffer[
j]];
221 long long int h0_fillcount = 0;
222 long long int h1_fillcount = 0;
224 while (inputFile.hasNext()) {
229 const Evt*
event = inputFile.next();
239 hit_remap.push_back(i->id);
241 }
else if(fix_bug == 1){
243 }
else if(fix_bug == 2){
244 bool skipevent =
false;
250 hit_remap.push_back(i->id);
252 if(skipevent)
continue;
256 double t0 = (*mc_tracks)[1].t;
262 if(hit->origin >= (
int)(*mc_tracks).size()){
263 std::out_of_range err(
"Hit origin not in tracklist. Avoided segfault");
267 Int_t corr_origin = hit_remap[hit->origin];
268 Trk curr_track = (*mc_tracks)[corr_origin];
274 const double E = curr_track.
E;
277 const double cd = axis.
getZ()/D_m;
278 const double theta = axis.
getTheta();
279 const double phi = fabs(axis.
getPhi());
280 const double dt =
getTime(*hit) - t1;
281 const double npe =
getNPE (*hit);
284 h1.fill(E, D_m, cd, theta, phi, dt, npe);
288 catch(
const exception& error) {
289 std::cout <<
"Fatal error for event: " << inputFile.getCounter() << std::endl;
290 FATAL(error.what() << endl);
297 if(find(particles.begin(), particles.end(), tr->type) == particles.end()){
307 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
317 for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
329 if(h1_fillcount > h0_fillcount){
330 std::cout <<
"WARNING: recorded hits in normalization histogram that were not recorded in normalization histogram. This should not happen." << std::endl;
331 std::cout <<
"h1_fillcount: " << h1_fillcount <<
", h0_fillcount: " << h0_fillcount << std::endl;
336 for (JMultiHistogram_t::super_iterator i = h0.super_begin(); i != h0.super_end(); ++i) {
337 integral+=i.getValue().getIntegral();
339 DEBUG(
"Integral:\t" << integral << endl);
347 for (
const JMultiHistogram_t* p : { &h0, &
h1 }) {
352 NOTICE(
"JHistHDE done. " << endl);
Router for direct addressing of PMT data in detector data structure.
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
Data structure for direction in three dimensions.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
Implementation of dispersion for water in deep sea.
Optical properties of Antares deep-sea site.
then for HISTOGRAM in h0 h1
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT.
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)
Data structure for detector geometry and calibration.
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Various implementations of functional maps.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
static const double C
Physics constants.
std::vector< Int_t > getHitRemapping(const std::vector< Trk > *tracklist)
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Optical properties of KM3NeT deep-sea site.
double getMaximalWavelength()
Get maximal wavelength for PDF evaluations.
JDirection3D getDirection(const Vec &dir)
Get direction.
#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.
Direct access to PMT in detector data structure.
double getLength() const
Get length.
General purpose messaging.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR set_variable NORTH set_variable EAST set_variable SOUTH set_variable WEST set_variable WORKDIR tmp set_variable R set_variable CT set_variable YMAX set_variable YMIN if do_usage *then usage $script[distance] fi case set_variable R
Probability density function of photon emission from EM-shower as a function of cosine of the emissio...
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
int read(const int argc, const char *const argv[])
Parse the program's command line options.
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.
Utility class to parse command line options.
const double getInverseSpeedOfLight()
Get inverse speed of light.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
std::string to_string(const T &value)
Convert value to string.
Definition of particle types.
double getNPE(const Hit &hit)
Get true charge of hit.
Data structure for position in three dimensions.
Function object for the probability density function of photon emission from EM-shower as a function ...
do set_variable DETECTOR_TXT $WORKDIR detector
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
double getAngularAcceptance(const double x)
Angular acceptence of PMT.