Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
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

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 JConvertDB -q toashort");
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 }
double UNIXTIMEBASE
[s]
Definition: JToAshort.hh:27
Utility class to parse command line options.
Definition: JParser.hh:1711
#define STATUS(A)
Definition: JMessage.hh:63
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
Auxiliary data structure to build TGraph.
Definition: JGraph.hh:42
string outputFile
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
Double_t G1(const Double_t x)
Integral of method g1.
Definition: JQuantiles.cc:37
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
set_variable E_E log10(E_{fit}/E_{#mu})"
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
double TOA_S
[s]
Definition: JToAshort.hh:30
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
int EMITTERID
waveform identifier
Definition: JToAshort.hh:29
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62