37 const char*
const Mass_t =
"Mass";
38 const char*
const Volume_t =
"Volume";
49 int main(
int argc,
char **argv)
53 using namespace KM3NETDAQ;
67 JParser<> zap(
"Example program to histogram neutrino effective mass for triggered events.");
70 zap[
'a'] =
make_field(detectorFile,
"Detector file: if not provided, instrumented volume is not calculated") =
"";
72 zap[
'R'] =
make_field(margin,
"Addition or subtraction margin around the volume in which the considered events must reside") = 0.0;
73 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
75 zap[
'O'] =
make_field(option,
"Result option") = Mass_t, Volume_t;
80 catch(
const exception &error) {
81 FATAL(error.what() << endl);
86 if (detectorFile !=
"") {
98 double Xmin = numeric_limits<double>::max();
99 double Xmax = numeric_limits<double>::lowest();
108 ERROR(
"Not a gSeaGen file; you may want to use JVolume1D" << endl);
111 const JVolume volume(header, logx);
127 NOTICE(
"Scanning file type " <<
distance(scanners.begin(), scanner) << endl);
128 DEBUG (header << endl);
149 instvol.addMargin(margin);
151 NOTICE(
"Light simulation volume dimensions, including margin: " << endl << canvol << endl);
152 NOTICE(
"Instrumented volume dimensions, including margin: " << endl << instvol << endl);
160 while (scanner->hasNext()) {
162 STATUS(
"event: " << setw(10) << scanner->getCounter() <<
'\r');
DEBUG(endl);
164 const Evt*
event = scanner->next();
167 const double x = logx ?
log10(primary.
E) : primary.
E;
169 if (event->mc_hits.empty()) {
175 hNM[primary.
type]->Fill(x);
179 if (instvol.is_inside(vertex)) {
180 hNm[primary.
type]->Fill(x);
186 ERROR(
"No events with zero hits -> use application JEffectiveMassOffline1D." << endl);
195 while (
in.hasNext()) {
197 STATUS(
"event: " << setw(10) <<
in.getCounter() <<
'\r');
DEBUG(endl);
201 const Evt*
event = mp;
203 const double x = logx ?
log10(primary.
E) : primary.
E;
208 if (option == Mass_t) {
211 }
else if (option == Volume_t) {
213 ym = instvol.getVolume() * 1.0e-15;
216 hM[primary.
type]->Fill(x, yM);
217 hm[primary.
type]->Fill(x, ym);
228 hM[pdg]->Divide(hNM[pdg]);
229 hm[pdg]->Divide(hNm[pdg]);
239 FATAL(error << endl <<
"You may want to use \"offline\" formatted file.");
JVertex3D getVertex(const Trk &track)
Get vertex.
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.
Vec getOffset(const JHead &header)
Get offset.
JCylinder3D getCylinder(const JHead &header)
Get cylinder corresponding to the positions of generated tracks (i.e.
bool is_gseagen(const JHead &header)
Check for generator.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
Double_t getXmax() const
Get maximal abscissa value.
#define MAKE_CSTRING(A)
Make C-string.
const Trk & get_primary(const Evt &evt)
Get primary.
static const double DENSITY_SEA_WATER
Fixed environment values.
Dynamic ROOT object management.
double E
Energy [GeV] (either MC truth or reconstructed)
Data structure for detector geometry and calibration.
Auxiliary class for histogramming of effective volume.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
JPosition3D getPosition(const Vec &pos)
Get position.
void addMargin(const double D)
Add (safety) margin.
General purpose messaging.
int type
MC: particle type in PDG encoding.
double getVolume() const
Get volume.
Auxiliary base class for list of file names.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
std::vector< filescanner_type >::iterator iterator
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
bool is_inside(const JVector3D &pos) const
Check whether given point is inside cylinder.
const JHead & getHeader() const
Get header.
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
do set_variable DETECTOR_TXT $WORKDIR detector
General purpose class for multiple pointers.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
std::vector< filescanner_type >::const_iterator const_iterator
int numberOfBins
number of bins for average CDF integral of optical module
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.