Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JSummaryWriter.cc File Reference

Auxiliary program to write summary data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JPhysics/JK40Rates.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JDetectorSimulator.hh"
#include "JDetector/JPMTParametersMap.hh"
#include "JDetector/JK40DefaultSimulator.hh"
#include "JDetector/JPMTDefaultSimulator.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMeta.hh"
#include "JSummaryslice/JSummaryslice.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to write summary data.

Author
mdejong

Definition in file JSummaryWriter.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file JSummaryWriter.cc.

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
Default implementation of the simulation of K40 background.
Detector data structure.
Definition: JDetector.hh:80
*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
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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#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
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary class for K40 rates.
Definition: JK40Rates.hh:41
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62