Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSummaryWriter.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
7 #include "JPhysics/JK40Rates.hh"
8 #include "JDetector/JDetector.hh"
16 #include "JSupport/JSupport.hh"
17 #include "JSupport/JMeta.hh"
19 
20 #include "Jeep/JParser.hh"
21 #include "Jeep/JMessage.hh"
22 
23 
24 /**
25  * \file
26  *
27  * Auxiliary program to write summary data.
28  * \author mdejong
29  */
30 int main(int argc, char **argv)
31 {
32  using namespace std;
33  using namespace JPP;
34  using namespace KM3NETDAQ;
35 
37  int numberOfEvents;
38  string detectorFile;
40  JPMTParametersMap pmtParameters;
41  JK40Rates rates_Hz;
42  int run_number;
43  int debug;
44 
45  try {
46 
47  JParser<> zap("Auxiliary program to create summary data.");
48 
49  zap['n'] = make_field(numberOfEvents);
50  zap['o'] = make_field(outputFile);
51  zap['a'] = make_field(detectorFile);
53  zap['P'] = make_field(pmtParameters) = JPARSER::initialised();
54  zap['B'] = make_field(rates_Hz) = JPARSER::initialised();
55  zap['R'] = make_field(run_number) = 1;
56  zap['d'] = make_field(debug) = 0;
57 
58  zap(argc, argv);
59  }
60  catch(const exception &error) {
61  FATAL(error.what() << endl);
62  }
63 
64 
65 
67 
68  try {
69  load(detectorFile, detector);
70  }
71  catch(const JException& error) {
72  FATAL(error);
73  }
74 
75  JPMTParametersMap::Throw(false);
76 
78 
79  simbad.reset(new JPMTDefaultSimulator(pmtParameters, detector));
80  simbad.reset(new JK40DefaultSimulator(rates_Hz));
81 
82  outputFile.open();
83 
84  outputFile.put(JMeta(argc, argv));
86 
87  for (int frame_index = 1; frame_index <= numberOfEvents; ++frame_index) {
88 
89  NOTICE("event: " << setw(10) << frame_index << '\r'); DEBUG(endl);
90 
91  JSummaryslice summary(JDAQChronometer(detector.getID(),
92  run_number,
93  frame_index,
94  getTimeOfFrame(frame_index)),
95  simbad);
96 
97  outputFile.put(summary);
98  }
99  NOTICE(endl);
100 
101  outputFile.close();
102 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
Default implementation of the simulation of K40 background.
Detector data structure.
Definition: JDetector.hh:89
Recording of objects on file according a format that follows from the file name extension.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
string outputFile
Data structure for detector geometry and calibration.
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index.
Definition: JDAQClock.hh:185
Detector file.
Definition: JHead.hh:196
Auxiliaries for creation of summary data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
ROOT I/O of application specific meta data.
#define NOTICE(A)
Definition: JMessage.hh:64
Auxiliary class to create summary data.
Auxiliary class for map of PMT parameters.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
void reset(JK40Simulator *k40Simulator)
Reset K40 simulator.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
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
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41