Jpp  16.0.3
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"
17 #include "JSupport/JSupport.hh"
18 #include "JSupport/JMeta.hh"
20 
21 #include "Jeep/JParser.hh"
22 #include "Jeep/JMessage.hh"
23 
24 
25 /**
26  * \file
27  *
28  * Auxiliary program to write summary data.
29  * \author mdejong
30  */
31 int main(int argc, char **argv)
32 {
33  using namespace std;
34  using namespace JPP;
35  using namespace KM3NETDAQ;
36 
38  int numberOfEvents;
39  string detectorFile;
41  JPMTParametersMap pmtParameters;
42  JK40Rates rates_Hz;
43  int run_number;
44  int debug;
45 
46  try {
47 
48  JParser<> zap("Auxiliary program to create summary data.");
49 
50  zap['n'] = make_field(numberOfEvents);
51  zap['o'] = make_field(outputFile);
52  zap['a'] = make_field(detectorFile);
54  zap['P'] = make_field(pmtParameters) = JPARSER::initialised();
55  zap['B'] = make_field(rates_Hz) = JPARSER::initialised();
56  zap['R'] = make_field(run_number) = 1;
57  zap['d'] = make_field(debug) = 0;
58 
59  zap(argc, argv);
60  }
61  catch(const exception &error) {
62  FATAL(error.what() << endl);
63  }
64 
65 
66 
68 
69  try {
70  load(detectorFile, detector);
71  }
72  catch(const JException& error) {
73  FATAL(error);
74  }
75 
76  JPMTParametersMap::Throw(false);
77 
79 
80  simbad.reset(new JPMTDefaultSimulator(pmtParameters, detector));
81  simbad.reset(new JK40DefaultSimulator(rates_Hz));
82  simbad.reset(new JCLBDefaultSimulator());
83 
84  outputFile.open();
85 
86  outputFile.put(JMeta(argc, argv));
88 
89  for (int frame_index = 1; frame_index <= numberOfEvents; ++frame_index) {
90 
91  NOTICE("event: " << setw(10) << frame_index << '\r'); DEBUG(endl);
92 
93  JSummaryslice summary(JDAQChronometer(detector.getID(),
94  run_number,
95  frame_index,
96  getTimeOfFrame(frame_index)),
97  simbad);
98 
99  outputFile.put(summary);
100  }
101  NOTICE(endl);
102 
103  outputFile.close();
104 }
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:224
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