Jpp
JWeightFileScanner.cc
Go to the documentation of this file.
1 
2 #include "JWeightFileScanner.hh"
3 #include "JWeightMupage.hh"
4 
5 #include "Jeep/JParser.hh"
6 #include "Jeep/JMessage.hh"
7 
8 
9 int main(int argc, char **argv)
10 {
11  using namespace std;
12  using namespace JPP;
13 
14  JMultipleFileScanner<Evt> inputFile;
15  int debug;
16 
17  try {
18 
19  JParser<> zap;
20 
21  zap['f'] = make_field(inputFile);
22  zap['d'] = make_field(debug) = 1;
23 
24  zap(argc, argv);
25  }
26  catch(const exception& error) {
27  FATAL(error.what() << endl);
28  }
29 
30 
31  JHead header; // selection
32 
33  header.physics.resize(1);
34  header.physics[0].program = "MUPAGE";
35  header.livetime.numberOfSeconds = 1.0;
36 
37  JWeightFileScanner<> in(getAAnetFiles(inputFile, header), JWeightMupage());
38 
39  // following syntax should be universal
40 
41  while (in.hasNext()) {
42 
43  const Evt* evt = in.next();
44 
45  const double W = in.getWeight(*evt);
46 
47  DEBUG("Weight: " << W << endl);
48 
49  //TH1D::Fill(.., W);
50  }
51 }
JAANET::JHead::physics
std::vector< JAANET::physics > physics
Definition: JHead.hh:1076
JAANET::JWeightMupage
Implementation of event weighing for MUPAGE data.
Definition: JWeightDAQ.hh:12
JMessage.hh
JAANET::JHead::livetime
JAANET::livetime livetime
Definition: JHead.hh:1089
JWeightFileScanner.hh
JAANET::JWeightFileScanner
Template file scanner with event weight.
Definition: JWeightFileScanner.hh:22
Evt
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JAANET::JHead
Monte Carlo run header.
Definition: JHead.hh:839
main
int main(int argc, char **argv)
Definition: JWeightFileScanner.cc:9
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
JWeightMupage.hh
JAANET::livetime::numberOfSeconds
double numberOfSeconds
Live time [s].
Definition: JHead.hh:644
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JAANET::JWeightEventHelper::getWeight
double getWeight(const Evt &evt) const
Get weight of given event.
Definition: JWeightEventHelper.hh:50
JSUPPORT::JMultipleFileScanner
General purpose class for object reading from a list of file names.
Definition: JMultipleFileScanner.hh:167
DEBUG
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JSUPPORT::getAAnetFiles
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, const JHead &header, const bool option=false)
Get list of files compatible with geven header.
Definition: JMonteCarloFileSupportkit.hh:474