Go to the documentation of this file.
41 inline bool test_event(
const JCylinder3D& cylinder,
const Evt& event)
46 Bool_t accepted =
true;
68 inline Vec get_coord_origin(
const JHead &header)
79 cout <<
"JVolume1D::get_coord_origin() Coordinate origin (x, y, z) " <<
coord_origin <<
" read from header" << endl;
87 cout <<
"JVolume1D::get_coord_origin() Coordinate origin (x, y, z) " <<
coord_origin <<
" calculated from can dimensions (zmin, zmax, r) " << header.
can.
zmin <<
" " << header.
can.
zmax <<
" " << header.
can.
r << endl;
92 FATAL(
"JVolume1D::get_coord_origin() Error in determining the coordinate origin.");
108 int main(
int argc,
char **argv)
120 JLimit& numberOfEvents = inputFile.getLimit();
130 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.");
135 zap[
'R'] =
make_field(wall,
"Addition margin around the volume in which the considered events must reside") = 0.0;
136 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
137 zap[
'N'] =
make_field(numberOfBins,
"Number of bins in the energy range of the MC simulation") = 10;
139 zap[
'a'] =
make_field(detectorFile,
"Detector file: if not provided, trigger fraction is not calculated") =
"";
143 catch(
const exception &error) {
144 FATAL(error.what() << endl);
162 if (detectorFile !=
"") {
176 const JHead buffer(head);
178 const bool genie =
is_genie(buffer);
181 const JVolume volume(head, logx);
191 NOTICE(
"JVolume1D: Instrumented volume dimensions (zmin, zmax, r): " << instvol.getZmin() <<
" " << instvol.getZmax() <<
" " << instvol.getRadius() << endl );
199 TH1D hV(
"hV",
"effective volume in km^3" , numberOfBins, volume.
getXmin(), volume.
getXmax());
200 TH1D hF(
"hF",
"n_trig/n_gen in instrumented volume", numberOfBins, volume.
getXmin(), volume.
getXmax());
208 NOTICE(
"JVolume1D: Scanning triggered events." << endl);
215 const Evt*
event = ps;
220 const double E = neutrino.
E;
226 hV.Fill(volume.
getX(E), test_event(canvol, *event) ? 1.0 : 0.0);
229 hF.Fill(volume.
getX(E), test_event(instvol, *event) ? 1.0 : 0.0);
234 hV.Fill(volume.
getX(E), volume.
getW(hV.GetXaxis(), E));
239 WARNING(
"JVolume1D: cannot find neutrino in triggered event " << inputFile.
getCounter() );
252 TH1D* hNV = (TH1D*) hV.Clone(
"hNV");
256 TH1D* hNF = (TH1D*) hF.Clone(
"hNF");
259 NOTICE(
"JVolume1D: Scanning generated events." << endl);
272 const double E = neutrino.
E;
274 hNV->Fill(volume.
getX(E), test_event(canvol, *event) ? 1.0 : 0.0);
275 hNF->Fill(volume.
getX(E), test_event(instvol, *event) ? 1.0 : 0.0);
279 WARNING(
"JVolume1D: cannot find neutrino in generated event " << inputFile.
getCounter() );
286 FATAL(
"JVolume1D: generated events not stored in the input file, JTriggerEfficiency should be run without option -O");
int main(int argc, char **argv)
Auxiliary class for defining the range of iterations of objects.
JAANET::coord_origin coord_origin
bool is_valid(const T &value)
Check validity of given value.
double getVolume() const
Get volume.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
General purpose class for multiple pointers.
bool is_inside(const JVector3D &pos) const
Check whether given point is inside cylinder.
double E
Energy (either MC truth or reconstructed)
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Utility class to parse command line options.
Double_t getXmax() const
Get maximal abscissa value.
void addMargin(const double D)
Add (safety) margin.
virtual bool hasNext()
Check availability of next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
counter_type getCounter() const
Get counter.
Double_t getXmin() const
Get minimal abscissa value.
Double_t getW(TAxis *axis, const Double_t E) const
Get bin width corrected energy spectrum dependent weight.
virtual const pointer_type & next()
Get next element.
virtual const multi_pointer_type & next()
Get next element.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
Auxiliary class for histogramming of effective volume.
Double_t getX(const Double_t E, double constrain=false) const
Get abscissa value.
virtual bool hasNext()
Check availability of next element.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose class for object reading from a list of file names.
JPosition3D getPosition(const Vec &v)
Get position.
#define DEBUG(A)
Message macros.
KM3NeT DAQ data structures and auxiliaries.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
bool is_genie(const JHead &header)
Check for generator.
static counter_type max()
Get maximum counter value.