Jpp
Functions
JSampler.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "JDAQ/JDAQSummaryslice.hh"
#include "JSupport/JMultipleFileSampler.hh"
#include "JSupport/JRandomSampler.hh"
#include "JSupport/JSupport.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

Program to test sampling of summary data using the JSUPPORT::JMultipleFileSampler class.

Author
mdejong

Definition in file JSampler.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file JSampler.cc.

23 {
24  using namespace std;
25  using namespace JPP;
26  using namespace KM3NETDAQ;
27 
28  JMultipleFileSampler<JDAQSummaryslice, JRandomSampler> inputFile;
29  JLimit_t numberOfEvents;
30  UInt_t seed;
31  int debug;
32 
33  try {
34 
35  JParser<> zap("Program to test sampling of summary data.");
36 
37  zap['f'] = getOption(inputFile.get<JMultipleFileScanner<>,true>(), "inputFile");
38  zap['R'] = getOption(inputFile.getSampler(), "sampler") = JPARSER::initialised();
39  zap['n'] = make_field(numberOfEvents);
40  zap['S'] = make_field(seed) = 0;
41  zap['d'] = make_field(debug) = 1;
42 
43  zap(argc, argv);
44  }
45  catch(const exception& error) {
46  FATAL(error.what() << endl);
47  }
48 
49  gRandom->SetSeed(seed);
50 
51  for (counter_type i = 0; i != numberOfEvents && inputFile.hasNext(); ++i) {
52 
53  cout << "event: " << setw(8) << i << flush;
54 
55  JDAQSummaryslice* summary = inputFile.next();
56 
57  cout << " index " << setw(8) << summary->getFrameIndex() << endl;
58  }
59 }
JPARSER::getOption
JParserTemplateElement< bool > getOption(bool &object, const std::string &name, const std::string &help="")
Auxiliary method for creation of template parser element object.
Definition: JParser.hh:1875
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
KM3NETDAQ::JDAQChronometer::getFrameIndex
int getFrameIndex() const
Get frame index.
Definition: JDAQChronometer.hh:132
JSUPPORT::JLimit_t
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:215
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
KM3NETDAQ::JDAQSummaryslice
Data summary slice.
Definition: JDAQSummaryslice.hh:31
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JMultipleFileScanner<>
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JROOT::counter_type
Long64_t counter_type
Type definition for counter.
Definition: JCounter.hh:24