Jpp
 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 
8 #include "JDetector/JDetector.hh"
11 #include "JDetector/JK40Rates.hh"
18 #include "JSupport/JSupport.hh"
19 #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 
37  JFileRecorder<JTYPELIST<JDAQSummaryslice, JTriggerParameters, JMeta>::typelist> outputFile;
38  int numberOfEvents;
39  string detectorFile;
40  JTriggerParameters parameters;
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);
53  zap['@'] = make_field(parameters) = JPARSER::initialised();
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 
67  JDetector detector;
68 
69  try {
70  load(detectorFile, detector);
71  }
72  catch(const JException& error) {
73  FATAL(error);
74  }
75 
76  JPMTParametersMap::Throw(false);
77 
78  JDetectorSimulator simbad(detector);
79 
80  simbad.reset(new JPMTDefaultSimulator(pmtParameters, detector));
81  simbad.reset(new JK40DefaultSimulator(rates_Hz));
82 
83  outputFile.open();
84 
85  outputFile.put(JMeta(argc, argv));
86  outputFile.put(parameters);
87 
88  for (int frame_index = 1; frame_index <= numberOfEvents; ++frame_index) {
89 
90  NOTICE("event: " << setw(10) << frame_index << '\r'); DEBUG(endl);
91 
92  JSummaryslice summary(JDAQChronometer(detector.getID(),
93  run_number,
94  frame_index,
95  getTimeOfFrame(frame_index)),
96  simbad);
97 
98  outputFile.put(summary);
99  }
100  NOTICE(endl);
101 
102  outputFile.close();
103 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
Utility class to parse command line options.
Definition: JParser.hh:1410
Data structure for all trigger parameters.
Recording of objects on file according a format that follows from the file name extension.
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:64
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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
ROOT I/O of application specific meta data.
#define NOTICE(A)
Definition: JMessage.hh:62
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:59
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:65
Auxiliaries for creation of summary data.
Utility class to parse command line options.
ROOT TTree parameter settings.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:60
int main(int argc, char *argv[])
Definition: Main.cpp:15