111 using namespace KM3NETDAQ;
129 JParser<> zap(
"Example program to histogram neutrino effective volume for triggered events. For genie/gSeaGen events a histogram depicting the fraction of events that triggered the detector inside the instrumented volume is also shown.");
133 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
134 zap[
'R'] =
make_field(wall,
"Addition margin around the volume in which the considered events must reside") = 0.0;
135 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
136 zap[
'N'] =
make_field(numberOfBins,
"Number of bins in the energy range of the MC simulation") = 10;
138 zap[
'a'] =
make_field(detectorFile,
"Detector file: if not provided, trigger fraction is not calculated") =
"";
142 catch(
const exception &error) {
143 FATAL(error.what() << endl);
161 if (detectorFile !=
"") {
175 const JHead buffer(head);
177 const bool genie =
is_genie(buffer);
180 const JVolume volume(head, logx);
190 NOTICE(
"JVolume1D: Instrumented volume dimensions (zmin, zmax, r): " << instvol.getZmin() <<
" " << instvol.getZmax() <<
" " << instvol.getRadius() << endl );
198 TH1D hV(
"hV",
"effective volume in km^3" , numberOfBins, volume.getXmin(), volume.getXmax());
199 TH1D hF(
"hF",
"n_trig/n_gen in instrumented volume", numberOfBins, volume.getXmin(), volume.getXmax());
207 NOTICE(
"JVolume1D: Scanning triggered events." << endl);
208 while (inputFile.hasNext()) {
210 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
214 const Evt*
event = ps;
219 const double E = neutrino.E;
225 hV.Fill(volume.getX(E), test_event(canvol, *
event) ? 1.0 : 0.0);
228 hF.Fill(volume.getX(E), test_event(instvol, *
event) ? 1.0 : 0.0);
233 hV.Fill(volume.getX(E), volume.getW(hV.GetXaxis(), E));
238 WARNING(
"JVolume1D: cannot find neutrino in triggered event " << inputFile.getCounter() );
251 TH1D* hNV = (TH1D*) hV.Clone(
"hNV");
255 TH1D* hNF = (TH1D*) hF.Clone(
"hNF");
258 NOTICE(
"JVolume1D: Scanning generated events." << endl);
262 while ( in.hasNext() ) {
264 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
266 const Evt*
event = in.next();
271 const double E = neutrino.E;
273 hNV->Fill(volume.getX(E), test_event(canvol, *
event) ? 1.0 : 0.0);
274 hNF->Fill(volume.getX(E), test_event(instvol, *
event) ? 1.0 : 0.0);
278 WARNING(
"JVolume1D: cannot find neutrino in generated event " << inputFile.getCounter() );
284 if ( in.getCounter() == 0 ) {
285 FATAL(
"JVolume1D: generated events not stored in the input file, JTriggerEfficiency should be run without option -O");
293 hV.Scale(canvol.getVolume()*1e-9);
Utility class to parse command line options.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void addMargin(const double D)
Add (safety) margin.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
const JLimit & getLimit() const
Get limit.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
General purpose class for multiple pointers.
Auxiliary class for histogramming of effective volume.
bool is_genie(const JHead &header)
Check for generator.
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.