Go to the documentation of this file.
42 inline bool test_event(
const JCylinder3D& cylinder,
const Evt& event) {
47 Bool_t accepted =
true;
69 inline Vec get_coord_origin(
const JHead &header) {
78 cout <<
"JVolume1D::get_coord_origin() Coordinate origin (x, y, z) " <<
coord_origin <<
" read from header" << endl;
86 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;
91 FATAL(
"JVolume1D::get_coord_origin() Error in determining the coordinate origin.");
107 int main(
int argc,
char **argv)
119 JLimit& numberOfEvents = inputFile.getLimit();
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.");
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);
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);
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() );
285 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.
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.
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.
bool is_genie(const JHead &header)
Check for generator.
static counter_type max()
Get maximum counter value.