Jpp  15.0.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JSummary.cc File Reference

Auxiliary program to blend and write summary data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JTriggerParametersSupportkit.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 blend and write summary data.

This application can be used to convert measured rates of any detector to a consistent set of rates for a simulated complete detector.
The rates as well as the high-rate veto and FIFO (almost) full will then be included in the run-by-run simulations using JTriggerEfficiency.cc.

The option -f <inputFile> corresponds to a list of input files containing summary data (commonly referred to as "measured rates").
These data can originate from any detector.

The option -a <detectorFile> corresponds to the detector to be used in simulations.
This could be a complete detector.

The option -@ <parameters> corresponds to the trigger parameters.
This is needed here because in the run-by-run simulations, the trigger parameters are taken from the input file.

The application JSummaryWriter.cc can be used to write summary data according user defined input rates.

Author
mdejong

Definition in file JSummary.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file JSummary.cc.

47 {
48  using namespace std;
49  using namespace JPP;
50  using namespace KM3NETDAQ;
51 
54  int numberOfEvents;
55  string detectorFile;
57  int run_number;
58  int debug;
59 
60  try {
61 
62  JParser<> zap("Auxiliary program to blend and write summary data.");
63 
64  zap['f'] = make_field(inputFile);
65  zap['n'] = make_field(numberOfEvents);
66  zap['o'] = make_field(outputFile);
67  zap['a'] = make_field(detectorFile);
69  zap['R'] = make_field(run_number) = 1;
70  zap['d'] = make_field(debug) = 0;
71 
72  zap(argc, argv);
73  }
74  catch(const exception &error) {
75  FATAL(error.what() << endl);
76  }
77 
78 
79 
81 
82  try {
83  load(detectorFile, detector);
84  }
85  catch(const JException& error) {
86  FATAL(error);
87  }
88 
89 
90  // check availability of sufficient summary data
91 
92  unsigned int number_of_modules = 0;
93 
94  while (inputFile.hasNext() && number_of_modules < detector.size()) {
95  number_of_modules += inputFile.next()->size();
96  }
97 
98  if (number_of_modules < detector.size()) {
99  FATAL("Input summary data insufficient: " << number_of_modules << " < " << detector.size() << endl);
100  }
101 
102  inputFile.rewind();
103 
104 
105  outputFile.open();
106 
107  outputFile.put(JMeta(argc, argv));
108 
109  outputFile.put(parameters);
110 
111  for (int frame_index = 1; frame_index <= numberOfEvents; ) {
112 
113  NOTICE("event: " << setw(10) << frame_index << '\r'); DEBUG(endl);
114 
115  JSummaryslice summary(JDAQChronometer(detector.getID(),
116  run_number,
117  frame_index,
118  getTimeOfFrame(frame_index)),
119  inputFile,
120  detector);
121 
122  if (summary.size() == detector.size()) {
123 
124  outputFile.put(summary);
125 
126  ++frame_index;
127 
128  } else {
129 
130  inputFile.rewind();
131  }
132  }
133  NOTICE(endl);
134 
135  outputFile.close();
136 }
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
Detector data structure.
Definition: JDetector.hh:89
*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.
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.
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