85{
89
93 double margin;
94 double epsilon;
95 bool logx;
98 std::string option;
99 JAbstractHistogram_t X;
101
102
103 try {
104
105 JParser<> zap(
"Example program to histogram neutrino effective mass and trigger effifiency for triggered events with offline files. Visible energy will be computed inside the user cylinder.");
106
110 = "Meff.root";
111 zap[
'm'] =
make_field(margin,
"Margin around the volume in which the considered events must reside")
112 = 0.0;
113 zap[
'e'] =
make_field(epsilon,
"Minimal amount of visible energy assigned to events") = 1e-8;
114 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
116 = JAbstractHistogram_t(100, 1.0, 100.0);
117 zap[
'C'] =
make_field(cylinder,
"User cylinder");
118 zap[
'O'] =
make_field(option,
"Result option")
119 = Mass_t, Volume_t;
121 = 2;
122
123 zap(argc, argv);
124 }
125 catch(const exception &error) {
126 FATAL(error.what() << endl);
127 }
128
129 try{
130
131
132
133
134
136
137 double Xmin = numeric_limits<double>::max();
138 double Xmax = numeric_limits<double>::lowest();
139
141
143 Xmin = X.getLowerLimit();
144 Xmax = X.getUpperLimit();
145
150
155
160
165
167 can.addMargin(margin);
168
169 NOTICE(
"Cylinder, including margin: " <<
can << endl);
170
171
172
173
175
177
178 NOTICE(
"Scanning file type " << scanner->getName() <<
": " << endl << header << endl);
179
180
181
183
184 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
185
186 Evt*
event = in.next();
187
189 WARNING(endl <<
"Could not find primary for the following event:" << endl << *event << endl);
190 continue;
191 }
192
194 track->clearusr();
195 }
196
199
200
201
205 0.0);
206 double EvisHad = Evis - EvisLL;
207
208 if (Evis == 0) Evis = epsilon;
209 if (EvisLL == 0) EvisLL = epsilon;
210 if (EvisHad == 0) EvisHad = epsilon;
211
213 const double x1 = logx ? log10(Evis) : Evis;
214 const double x2 = logx ? log10(EvisLL) : EvisLL;
215 const double x3 = logx ? log10(EvisHad) : EvisHad;
216
219
220 hnT0[interactionID0]->Fill(x0);
221 hnT1[interactionID0]->Fill(x1);
222 hnT2[interactionID0]->Fill(x2);
223 hnT3[interactionID0]->Fill(x3);
224
225 hnT0[interactionID1]->Fill(x0);
226 hnT1[interactionID1]->Fill(x1);
227 hnT2[interactionID1]->Fill(x2);
228 hnT3[interactionID1]->Fill(x3);
229
230 if (
can.is_inside(vertex)) {
231 hNM0[interactionID0]->Fill(x0);
232 hNM1[interactionID0]->Fill(x1);
233 hNM2[interactionID0]->Fill(x2);
234 hNM3[interactionID0]->Fill(x3);
235
236 hNM0[interactionID1]->Fill(x0);
237 hNM1[interactionID1]->Fill(x1);
238 hNM2[interactionID1]->Fill(x2);
239 hNM3[interactionID1]->Fill(x3);
240 }
242
245
246 hnT0[interactionID2]->Fill(x0);
247 hnT1[interactionID2]->Fill(x1);
248 hnT2[interactionID2]->Fill(x2);
249 hnT3[interactionID2]->Fill(x3);
250
251 hnT0[interactionID3]->Fill(x0);
252 hnT1[interactionID3]->Fill(x1);
253 hnT2[interactionID3]->Fill(x2);
254 hnT3[interactionID3]->Fill(x3);
255
256 if(
can.is_inside(vertex)){
257 hNM0[interactionID2]->Fill(x0);
258 hNM1[interactionID2]->Fill(x1);
259 hNM2[interactionID2]->Fill(x2);
260 hNM3[interactionID2]->Fill(x3);
261
262 hNM0[interactionID3]->Fill(x0);
263 hNM1[interactionID3]->Fill(x1);
264 hNM2[interactionID3]->Fill(x2);
265 hNM3[interactionID3]->Fill(x3);
266 }
267 }
268 }
270 }
271
272
273
274
275
277
279
281
282 NOTICE(
"Scanning file type " << scanner->getName() <<
": " << endl << header << endl);
283
285
286 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
287
288 Evt*
event = in.next();
289
291 WARNING(endl <<
"Could not find primary for the following event:" << endl << *event << endl);
292 continue;
293 }
294
296 track->clearusr();
297 }
298
300
304 0.0);
305 double EvisHad = Evis - EvisLL;
306
307 if (Evis == 0) Evis = epsilon;
308 if (EvisLL == 0) EvisLL = epsilon;
309 if (EvisHad == 0) EvisHad = epsilon;
310
312 const double x1 = logx ? log10(Evis) : Evis;
313 const double x2 = logx ? log10(EvisLL) : EvisLL;
314 const double x3 = logx ? log10(EvisHad) : EvisHad;
315
318
319 hM0[interactionID0]->Fill(x0);
320 hM1[interactionID0]->Fill(x1);
321 hM2[interactionID0]->Fill(x2);
322 hM3[interactionID0]->Fill(x3);
323
324 hM0[interactionID1]->Fill(x0);
325 hM1[interactionID1]->Fill(x1);
326 hM2[interactionID1]->Fill(x2);
327 hM3[interactionID1]->Fill(x3);
328
330
333
334 hM0[interactionID2]->Fill(x0);
335 hM1[interactionID2]->Fill(x1);
336 hM2[interactionID2]->Fill(x2);
337 hM3[interactionID2]->Fill(x3);
338
339 hM0[interactionID3]->Fill(x0);
340 hM1[interactionID3]->Fill(x1);
341 hM2[interactionID3]->Fill(x2);
342 hM3[interactionID3]->Fill(x3);
343 }
344 }
346 }
347
348
349
350
351
353
354 if (option == Mass_t) {
356 } else if (option == Volume_t) {
358 }
359
361
362 hT0.insert(make_pair(type, (TH1D*) divide(*hM0[type], *hnT0[type],
MAKE_STRING(
"hT0[" << type <<
"]"))));
363 hT1.insert(make_pair(type, (TH1D*) divide(*hM1[type], *hnT1[type],
MAKE_STRING(
"hT1[" << type <<
"]"))));
364 hT2.insert(make_pair(type, (TH1D*) divide(*hM2[type], *hnT2[type],
MAKE_STRING(
"hT2[" << type <<
"]"))));
365 hT3.insert(make_pair(type, (TH1D*) divide(*hM3[type], *hnT3[type],
MAKE_STRING(
"hT3[" << type <<
"]"))));
366
367
368 hM0[type]->Scale(
scale);
369 hM1[type]->Scale(
scale);
370 hM2[type]->Scale(
scale);
371 hM3[type]->Scale(
scale);
372
373 hM0[type]->Divide(hNM0[type]);
374 hM1[type]->Divide(hNM1[type]);
375 hM2[type]->Divide(hNM2[type]);
376 hM3[type]->Divide(hNM3[type]);
377
378 }
379
381
382 out << hM0 << hM1 << hM2 << hM3 << hT0 << hT1 << hT2 << hT3;
383
384 out.Close();
385 }
387 FATAL(error << endl);
388 }
389}
void scale(vector< double > &v, double c)
scale vector content
void setLongprint(std::ostream &out)
Set long print option.
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_STRING(A)
Make string.
int numberOfBins
number of bins for average CDF integral of optical module
const JHead & getHeader() const
Get header.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
bool has_primary(const Evt &evt)
Auxiliary function to check if an event contains a primary track.
JVertex3D getVertex(const Trk &track)
Get vertex.
bool has_leading_lepton(const Evt &event)
Auxiliary function to check if an event contains the leading lepton of a neutrino interaction.
const Trk & get_primary(const Evt &evt)
Auxiliary function to retrieve the primary track of an event.
int getInteractionID(const Evt &event, const bool useScatteringType=true, const bool useDecayType=true)
Retrieve interaction identifier.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
static const double DENSITY_SEA_WATER
Fixed environment values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getVisibleEnergyLeadingLepton(const Trk &, const JCylinder3D &)
double getVisibleEnergy(const Trk &, const JCylinder3D &)
Get the visible energy of a track.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
The cylinder used for photon tracking.
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Auxiliary base class for list of file names.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.