Jpp  15.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JMonitorSinglesRates.cc File Reference

Monitoring of PMT time over threshold distributions. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH2D.h"
#include "JROOT/JManager.hh"
#include "km3net-dataformat/online/JDAQ.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "JTools/JRange.hh"
#include "JSupport/JMultipleFileScanner.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

Monitoring of PMT time over threshold distributions.

Author
mkarel

Definition in file JMonitorSinglesRates.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file JMonitorSinglesRates.cc.

32 {
33  using namespace std;
34  using namespace JPP;
35  using namespace KM3NETDAQ;
36 
38  string outputFile;
39  int debug;
40 
41  try {
42 
43  JParser<> zap("Monitoring of PMT time over threshold distributions.");
44 
45  zap['f'] = make_field(inputFile);
46  zap['o'] = make_field(outputFile) = "monitor.root";
47  zap['d'] = make_field(debug) = 1;
48  zap(argc, argv);
49  }
50  catch(const exception &error) {
51  FATAL(error.what() << endl);
52  }
53 
54  cout.tie(&cerr);
55 
56  using namespace KM3NETDAQ;
57 
58  const double factor = 1.0/1000 ;
59  const int Nbins = 90 ; // reasonable range for singles rates from 0-20 kHz
60 
61  JManager<int, TH2D> SinglesRatedistr(new TH2D("%.2S", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS-0.5, Nbins, JDAQRate::getData(factor))) ;
62 
63  while (inputFile.hasNext()) {
64 
65  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
66 
67  JDAQSummaryslice* summary = inputFile.next() ;
68 
69  for (KM3NETDAQ::JDAQSummaryslice::const_iterator summary_frame = summary->begin(); summary_frame != summary->end(); ++summary_frame) {
70 
71  int DOMID = summary_frame->getModuleID() ;
72  TH2D* h_i = SinglesRatedistr[DOMID] ;
73 
74  for (int ipmt = 0 ; ipmt<NUMBER_OF_PMTS ; ipmt++) {
75  h_i->Fill(ipmt, summary_frame->getRate(ipmt, factor), summary_frame->getWeight(ipmt, factor));
76  }
77 
78  }
79 
80  }
81  STATUS(endl);
82 
83  // Store histogram(s).
84  TFile out(outputFile.c_str(), "recreate");
85  SinglesRatedistr.Write(out) ;
86  out.Write();
87  out.Close();
88 
89 }
Utility class to parse command line options.
Definition: JParser.hh:1500
#define STATUS(A)
Definition: JMessage.hh:63
string outputFile
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26