Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JToAshortMonitor.cc File Reference

Example program to monitor "toashort" data. More...

#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TGraph.h"
#include "TH1D.h"
#include "JDB/JToAshort.hh"
#include "JDB/JSupport.hh"
#include "JROOT/JGraph.hh"
#include "JROOT/JManager.hh"
#include "JSupport/JMultipleFileScanner.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

Example program to monitor "toashort" data.

Definition in file JToAshortMonitor.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 26 of file JToAshortMonitor.cc.

27{
28 using namespace std;
29 using namespace JPP;
30
32 JLimit_t& numberOfEvents = inputFile.getLimit();
33 string outputFile;
34 int debug;
35
36 try {
37
38 JParser<> zap("Example program to monitor \"toashort\" data.");
39
40 zap['f'] = make_field(inputFile, "output of JToA");
41 zap['n'] = make_field(numberOfEvents) = JLimit::max();
42 zap['o'] = make_field(outputFile) = "toashort.root";
43 zap['d'] = make_field(debug) = 1;
44
45 zap(argc, argv);
46 }
47 catch(const exception &error) {
48 FATAL(error.what() << endl);
49 }
50
51
53 JManager<int, TH1D> H1(new TH1D("H[%].quality", NULL, 100, 0.0, 8.0));
54
55 while (inputFile.hasNext()) {
56
57 if (inputFile.getCounter()%1000 == 0) {
58 STATUS("counter: " << setw(8) << inputFile.getCounter() << '\r' << flush); DEBUG(endl);
59 }
60
61 const JToAshort* toashort = inputFile.next();
62
63 G1[toashort->EMITTERID].put(toashort->UNIXTIMEBASE + toashort->TOA_S, log10(toashort->QUALITYFACTOR));
64 H1[toashort->EMITTERID]->Fill(log10(toashort->QUALITYFACTOR));
65 }
66 STATUS(endl);
67
68 TFile out(outputFile.c_str(), "recreate");
69
70 for (map<int, JGraph_t>::const_iterator i = G1.begin(); i != G1.end(); ++i) {
71 out << JGraph(i->second, MAKE_CSTRING("G[" << i->first << "].toa"));
72 }
73
74 out << H1;
75
76 out.Write();
77 out.Close();
78}
string outputFile
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:72
Double_t G1(const Double_t x)
Integral of method g1.
Definition JQuantiles.cc:37
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
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.
const char * map
Definition elog.cc:87
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
int EMITTERID
waveform identifier
Definition JToAshort.hh:29
double UNIXTIMEBASE
[s]
Definition JToAshort.hh:27
Auxiliary data structure to build TGraph.
Definition JGraph.hh:44
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128