109 using namespace KM3NETDAQ;
126 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.");
130 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
131 zap[
'R'] =
make_field(wall,
"Addition margin around the volume in which the considered events must reside") = 0.0;
132 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
135 zap[
'a'] =
make_field(detectorFile,
"Detector file: if not provided, trigger fraction is not calculated") =
"";
139 catch(
const exception &error) {
140 FATAL(error.what() << endl);
158 if (detectorFile !=
"") {
172 const JHead buffer(head);
177 const JVolume volume(head, logx);
187 NOTICE(
"JVolume1D: Instrumented volume dimensions (zmin, zmax, r): " << instvol.getZmin() <<
" " << instvol.getZmax() <<
" " << instvol.getRadius() << endl );
195 TH1D hV(
"hV",
"effective volume in km^3" ,
numberOfBins, volume.getXmin(), volume.getXmax());
196 TH1D hF(
"hF",
"n_trig/n_gen in instrumented volume",
numberOfBins, volume.getXmin(), volume.getXmax());
204 NOTICE(
"JVolume1D: Scanning triggered events." << endl);
205 while (inputFile.hasNext()) {
207 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
211 const Evt*
event = ps;
216 const double E = neutrino.
E;
222 hV.Fill(volume.getX(E), test_event(canvol, *event) ? 1.0 : 0.0);
225 hF.Fill(volume.getX(E), test_event(instvol, *event) ? 1.0 : 0.0);
230 hV.Fill(volume.getX(E), volume.getW(hV.GetXaxis(),
E));
235 WARNING(
"JVolume1D: cannot find neutrino in triggered event " << inputFile.getCounter() );
248 TH1D* hNV = (TH1D*) hV.Clone(
"hNV");
252 TH1D* hNF = (TH1D*) hF.Clone(
"hNF");
255 NOTICE(
"JVolume1D: Scanning generated events." << endl);
259 while (
in.hasNext() ) {
261 STATUS(
"event: " << setw(10) <<
in.getCounter() <<
'\r');
DEBUG(endl);
263 const Evt*
event =
in.next();
268 const double E = neutrino.
E;
270 hNV->Fill(volume.getX(E), test_event(canvol, *event) ? 1.0 : 0.0);
271 hNF->Fill(volume.getX(E), test_event(instvol, *event) ? 1.0 : 0.0);
275 WARNING(
"JVolume1D: cannot find neutrino in generated event " << inputFile.getCounter() );
281 if (
in.getCounter() == 0 ) {
282 FATAL(
"JVolume1D: generated events not stored in the input file, JTriggerEfficiency should be run without option -O");
290 hV.Scale(canvol.getVolume()*1e-9);
Utility class to parse command line options.
bool is_gseagen(const JHead &header)
Check for generator.
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)...
double E
Energy [GeV] (either MC truth or reconstructed)
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Auxiliary class for histogramming of effective volume.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JPosition3D getPosition(const Vec &pos)
Get position.
void addMargin(const double D)
Add (safety) margin.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
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.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
const JLimit & getLimit() const
Get limit.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
General purpose class for multiple pointers.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
int numberOfBins
number of bins for average CDF integral of optical module
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.