43 inline bool test_event(
const JCylinder3D& cylinder,
const Evt& event)
48 Bool_t accepted =
true;
71 inline Vec get_coord_origin(
const JHead &header)
81 NOTICE(
"JVolume1D::get_coord_origin() Coordinate origin (x, y, z) " << coord_origin <<
" read from header" << endl);
87 NOTICE(
"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.");
105 int main(
int argc,
char **argv)
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.");
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 );
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);
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() );
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.
Double_t getXmin() const
Get minimal abscissa value.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
bool is_gseagen(const JHead &header)
Check for generator.
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)...
Double_t getXmax() const
Get maximal abscissa value.
Double_t getX(const Double_t E, double constrain=false) const
Get abscissa value.
static counter_type max()
Get maximum counter value.
double E
Energy [GeV] (either MC truth or reconstructed)
Data structure for detector geometry and calibration.
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.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
virtual bool hasNext() override
Check availability of next element.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Double_t getW(TAxis *axis, const Double_t E) const
Get bin width corrected energy spectrum dependent weight.
JPosition3D getPosition(const Vec &pos)
Get position.
void addMargin(const double D)
Add (safety) margin.
General purpose messaging.
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.
Utility class to parse command line options.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
virtual const pointer_type & next() override
Get next element.
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.
do set_variable DETECTOR_TXT $WORKDIR detector
JAANET::coord_origin coord_origin
General purpose class for multiple pointers.
bool is_valid(T JHead::*pd) const
Check validity of given data member in JHead.
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.
Vec coord_origin() const
Get coordinate origin.
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.
then usage $script[input file[working directory[option]]] nWhere option can be E