Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQSummaryslice.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <iostream>
4 #include <iomanip>
5 #include <limits>
6 
7 #include "TROOT.h"
8 #include "TFile.h"
9 #include "TH1D.h"
10 #include "TProfile.h"
11 
12 #include "JDAQ/JDAQSummaryslice.hh"
13 
15 #include "JSupport/JSupport.hh"
16 
17 #include "Jeep/JParser.hh"
18 #include "Jeep/JMessage.hh"
19 
20 
21 /**
22  * \file
23  *
24  * Example program to histogram KM3NETDAQ::JDAQSummaryslice.
25  * \author mdejong
26  */
27 int main(int argc, char **argv)
28 {
29  using namespace std;
30  using namespace JPP;
31  using namespace KM3NETDAQ;
32 
33  JMultipleFileScanner<JDAQSummaryslice> inputFile;
34  JLimit_t& numberOfEvents = inputFile.getLimit();
35  string outputFile;
36  int debug;
37 
38  try {
39 
40  JParser<> zap("Example program to histogram summary data.");
41 
42  zap['f'] = make_field(inputFile);
43  zap['o'] = make_field(outputFile) = "summaryslice.root";
44  zap['n'] = make_field(numberOfEvents) = JLimit::max();
45  zap['d'] = make_field(debug) = 2;
46 
47  zap(argc, argv);
48  }
49  catch(const exception& error) {
50  FATAL(error.what() << endl);
51  }
52 
53 
54  const double factor = 1.0e-3; // [kHz]
55 
56  cout.tie(&cerr);
57 
58  TFile out(outputFile.c_str(), "recreate");
59 
60  TH1D h0("h0", NULL, JDAQRate::getN(), JDAQRate::getData(factor));
61  TH1D h1("h1", NULL, 32,-0.5, 32.5);
62 
63  while (inputFile.hasNext()) {
64 
65  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
66 
67  JDAQSummaryslice* summaryslice = inputFile.next();
68 
69  for (JDAQSummaryslice::const_iterator frame = summaryslice->begin(); frame != summaryslice->end(); ++frame) {
70 
71  for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
72  h0.Fill(frame->getRate(pmt, factor), frame->getWeight(pmt, factor));
73  h1.Fill((Double_t) pmt, frame->testHighRateVeto(pmt));
74  }
75 
76  if (frame->testWhiteRabbitStatus()) {
77  h1.Fill((Double_t) 32);
78  }
79  }
80  }
81  STATUS(endl);
82 
83  out.Write();
84  out.Close();
85 }
Utility class to parse command line options.
Definition: JParser.hh:1410
#define STATUS(A)
Definition: JMessage.hh:61
string outputFile
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:214
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
int debug
debug level
Definition: JSirene.cc:59
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:65
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
ROOT TTree parameter settings.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:72
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:60
int main(int argc, char *argv[])
Definition: Main.cpp:15