33{
36
37 string inputFile;
38 string fileDescriptor;
40
41 try {
42
43 JParser<> zap(
"Program to convert multi-dimensional histograms of muon light to multi-dimensional PDFs.");
44
46 zap[
'o'] =
make_field(fileDescriptor) =
"J%p.dat";
48
49 zap(argc, argv);
50 }
51 catch(const exception &error) {
52 FATAL(error.what() << endl);
53 }
54
55
57 FATAL(
"error file descriptor " << fileDescriptor << endl);
58 }
59
61
66
68
69 JMultiHistogram_t h0;
70 JMultiHistogram_t h1;
71 JMultiHistogram_t h2;
72
73 h1.transformer.reset(new JFunction3DTransformer_t());
74 h2.transformer.reset(new JFunction3DTransformer_t());
75
76
77
78
80
81 for (JMultiHistogram_t* p : { &h0, &h1, &h2 }) {
82 in.load(*p);
83 }
84
85 in.close();
86
87
88
89
90 for (JMultiHistogram_t::super_iterator
91 i0 = h0.super_begin(),
92 i1 = h1.super_begin(),
93 i2 = h2.super_begin(); i0 != h0.super_end(); ++i0, ++i1, ++i2) {
94
95 const double W = i0.getValue().getIntegral();
96
97 if (W != 0.0) {
98
101
102 int number_of_bins = (int) (2 + u.getDot(v));
103
106 p->div(W);
107 }
108 }
109 }
110
111
112
113
114 struct tuple {
116 const JMultiHistogram_t& value;
117 };
118
119 tuple ntuple[] = {
120 { SCATTERED_LIGHT_FROM_MUON, h1 },
121 { SCATTERED_LIGHT_FROM_EMSHOWERS, h2 }
122 };
123
124
129
130 for (int i = 0; i != sizeof(ntuple)/sizeof(ntuple[0]); ++i) {
131
132 const string file_name = getFilename(fileDescriptor, ntuple[i].type);
133
134 try {
135
136 NOTICE(
"storing output to file " << file_name <<
"... " << flush);
137
138 const JPDF_t pdf(ntuple[i].value);
139
140 pdf.store(file_name.c_str());
141
143 }
146 }
147 }
148}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for angles in three dimensions.
Data structure for direction in three dimensions.
Binary buffered file input.
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Multi-dimensional PDF table for arrival time of Cherenkov light.
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
double getCosThetaC()
Get average cosine of Cherenkov angle of water corresponding to group velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).