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)
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.");
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);
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");
293 hV.Scale(canvol.getVolume()*1e-9);
Utility class to parse command line options.
virtual const pointer_type & next()
Get next element.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
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...
static counter_type max()
Get maximum counter value.
Double_t getX(const Double_t E, double constrain=false) const
Get abscissa value.
Data structure for detector geometry and calibration.
Double_t getXmin() const
Get minimal abscissa value.
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.
Double_t getW(TAxis *axis, const Double_t E) const
Get bin width corrected energy spectrum dependent weight.
General purpose messaging.
virtual bool hasNext()
Check availability of next element.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
ROOT TTree parameter settings.
bool is_inside(const JVector3D &pos) const
Check whether given point is inside cylinder.
counter_type getCounter() const
Get counter.
const JLimit & getLimit() const
Get limit.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
JAANET::coord_origin coord_origin
General purpose class for multiple pointers.
Double_t getXmax() const
Get maximal abscissa value.
bool is_valid(const T &value)
Check validity of given value.
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.
int main(int argc, char *argv[])