Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JMakeHDE.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <fstream>
4#include <iomanip>
5
8
10
16
20
21#include "Jeep/JParser.hh"
22#include "Jeep/JMessage.hh"
23
25
26
27/**
28 * \file
29 *
30 * Program to convert 5-dimensional histograms of shower light to multi-dimensional PDFs.
31 * \author jseneca
32 */
33int main(int argc, char **argv)
34{
35 using namespace std;
36 using namespace JPP;
37
38 string inputFile;
39 string outputFile;
40 int debug;
41 try {
42
43 JParser<> zap("Program to convert multi-dimensional histograms of shower light to multi-dimensional PDFs.");
44
45 zap['f'] = make_field(inputFile);
46 zap['o'] = make_field(outputFile);
47 zap['d'] = make_field(debug) = 1;
48
49 zap(argc, argv);
50 }
51 catch(const exception &error) {
52 FATAL(error.what() << endl);
53 }
54
55
56 typedef JHistogram1D_t::abscissa_type abscissa_type;
57
63 JHistogramGridMap_t>::maplist> JMultiHistogram_t;
64
65 typedef JPDFTransformer<5, abscissa_type> JFunction5DTransformer_t;
66
67 JMultiHistogram_t h0; // occurrence rate of PMT (used for normalisation)
68 JMultiHistogram_t h1; // light from cascade
69
70 h1.transformer.reset(new JFunction5DTransformer_t());
71
72 // input
73
74 NOTICE("Loading in input, " << flush);
75
76 JFileStreamReader in(inputFile.c_str());
77
78 for (JMultiHistogram_t* p : { &h0, &h1 }) {
79 in.load(*p);
80 }
81
82 in.close();
83
84 NOTICE("done." << endl);
85
86 // rebin histograms according angle of incidence on PMT and normalise contents to PMT occurrence rate
87
88 for (JMultiHistogram_t::super_iterator
89 i0 = h0.super_begin(),
90 i1 = h1.super_begin(); i1 != h1.super_end(); ++i0, ++i1) {
91
92 const double W = i0.getValue().getIntegral();
93
94 if (W != 0.0) {
95
96 const JDirection3D u(JAngle3D(i0->second->second->first, i0->second->second->second->first));
97 const JDirection3D v(getSinThetaC(), 0.0, getCosThetaC());
98
99 int number_of_bins = (int) (2 + u.getDot(v));
100
101 i1.getValue().rebin(JHistogram1D_t::JRebin(number_of_bins));
102 i1.getValue().div(W);
103 }
104 }
105
106 // output
107
108 struct tuple {
109 const JPDFType_t type;
110 const JMultiHistogram_t& value;
111 };
112
118 JPolint1FunctionalGridMap>::maplist> JPDF_t;
119
120 try {
121 NOTICE("Storing output to file " << outputFile << "... " << flush);
122
123 const JPDF_t pdf(h1);
124
125 pdf.store(outputFile.c_str());
126
127 NOTICE("OK" << endl);
128 }
129 catch(const JException& error) {
130 FATAL(error.what() << endl);
131 }
132 NOTICE("JMakeHDE done." << endl);
133}
string outputFile
Various implementations of functional maps.
int main(int argc, char **argv)
Definition JMakeHDE.cc:33
General purpose messaging.
#define NOTICE(A)
Definition JMessage.hh:64
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Numbering scheme for PDF types.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Physics constants.
Data structure for angles in three dimensions.
Definition JAngle3D.hh:35
Data structure for direction in three dimensions.
double getDot(const JAngle3D &angle) const
Get dot product.
Binary buffered file input.
JReader & load(JSerialisable &object)
Read object.
General exception.
Definition JException.hh:24
Utility class to parse command line options.
Definition JParser.hh:1698
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
Template definition of transformer of the probability density function (PDF) of the time response of ...
Histogram in 1D.
collection_type::abscissa_type abscissa_type
Transformable multidimensional histogram.
JPDFType_t
PDF types.
Definition JPDFTypes.hh:24
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Type definition of a JHistogramMap based on JGridMap implementation.
Type definition of a JHistogramMap based on JMap implementation.
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109
Type definition of a 1st degree polynomial interpolation with result type double.
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Auxiliary class for merging of fixed number of consecutive bins.