Jpp  15.0.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSampler.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 
7 
10 #include "JSupport/JSupport.hh"
11 
12 #include "Jeep/JParser.hh"
13 #include "Jeep/JMessage.hh"
14 
15 
16 /**
17  * \file
18  *
19  * Program to test sampling of summary data using the JSUPPORT::JMultipleFileSampler class.
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25  using namespace JPP;
26  using namespace KM3NETDAQ;
27 
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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
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:1882
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Long64_t counter_type
Type definition for counter.
int getFrameIndex() const
Get frame index.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.