Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMonitorSinglesRates.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5
6#include "TROOT.h"
7#include "TFile.h"
8#include "TH2D.h"
9
10#include "JROOT/JManager.hh"
11
17
18#include "JTools/JRange.hh"
19
21#include "JSupport/JSupport.hh"
22#include "Jeep/JParser.hh"
23#include "Jeep/JMessage.hh"
24
25/**
26 * \file
27 *
28 * Monitoring of PMT time over threshold distributions.
29 * \author mkarel
30 */
31int main(int argc, char **argv)
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
55 using namespace KM3NETDAQ;
56
57 const double factor = 1.0/1000 ;
58 const int Nbins = 90 ; // reasonable range for singles rates from 0-20 kHz
59
60 JManager<int, TH2D> SinglesRatedistr(new TH2D("%.2S", NULL, NUMBER_OF_PMTS, -0.5, NUMBER_OF_PMTS-0.5, Nbins, JDAQRate::getData(factor))) ;
61
62 while (inputFile.hasNext()) {
63
64 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
65
66 JDAQSummaryslice* summary = inputFile.next() ;
67
68 for (KM3NETDAQ::JDAQSummaryslice::const_iterator summary_frame = summary->begin(); summary_frame != summary->end(); ++summary_frame) {
69
70 int DOMID = summary_frame->getModuleID() ;
71 TH2D* h_i = SinglesRatedistr[DOMID] ;
72
73 for (int ipmt = 0 ; ipmt<NUMBER_OF_PMTS ; ipmt++) {
74 h_i->Fill(ipmt, summary_frame->getRate(ipmt, factor), summary_frame->getWeight(ipmt, factor));
75 }
76
77 }
78
79 }
80 STATUS(endl);
81
82 // Store histogram(s).
83 TFile out(outputFile.c_str(), "recreate");
84 SinglesRatedistr.Write(out) ;
85 out.Write();
86 out.Close();
87
88}
string outputFile
KM3NeT DAQ constants, bit handling, etc.
Dynamic ROOT object management.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Direct access to module in detector data structure.
int main(int argc, char **argv)
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Auxiliary class to define a range between two values.
ROOT TTree parameter settings of various packages.
Utility class to parse command line options.
Definition JParser.hh:1698
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Definition JManager.hh:47
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
Definition JManager.hh:304
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
static const double * getData(const double factor=1.0)
Get abscissa values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition JDAQ.hh:26