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

Example program to monitor acoustic events. More...

#include <iostream>
#include <iomanip>
#include <limits>
#include "TROOT.h"
#include "TFile.h"
#include "TGraph.h"
#include "JSupport/JMultipleFileScanner.hh"
#include "JTools/JQuantile.hh"
#include "JROOT/JRootToolkit.hh"
#include "JROOT/JManager.hh"
#include "JAcoustics/JEvent.hh"
#include "JAcoustics/JSupport.hh"
#include "Jeep/JPrint.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 acoustic events.

Author
mdejong

Definition in file JAcousticsTriggerMonitor.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file JAcousticsTriggerMonitor.cc.

31 {
32  using namespace std;
33  using namespace JPP;
34 
36  JLimit_t& numberOfEvents = inputFile.getLimit();
37  string outputFile;
38  double Q;
39  int debug;
40 
41  try {
42 
43  JParser<> zap("Example program to monitor acoustic events.");
44 
45  zap['f'] = make_field(inputFile, "output of JAcousticTriggerProcessor[.sh]");
46  zap['n'] = make_field(numberOfEvents) = JLimit::max();
47  zap['o'] = make_field(outputFile) = "monitor.root";
48  zap['Q'] = make_field(Q) = 0.9;
49  zap['d'] = make_field(debug) = 2;
50 
51  zap(argc, argv);
52  }
53  catch(const exception &error) {
54  FATAL(error.what() << endl);
55  }
56 
57  JManager<int, TGraph> GA(new TGraph(), "G[%].size");
58  JManager<int, TGraph> GD(new TGraph(), "G[%].rms");
59  JManager<int, TGraph> GQ(new TGraph(), "G[%].quality");
60  JManager<int, TGraph> G1(new TGraph(), "G[%].quantile");
61  JManager<int, TGraph> GN(new TGraph(), "G[%].overlays");
62 
63  while (inputFile.hasNext()) {
64 
65  if (inputFile.getCounter()%100 == 0) {
66  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
67  }
68 
69  const JEvent* event = inputFile.next();
70 
71  const double t1 = event->begin()->getToE();
72 
73  JQuantile Q1("", true), Q2;
74 
75  for (JEvent::const_iterator i = event->begin(); i != event->end(); ++i) {
76  Q1.put(i->getToE());
77  Q2.put(log10(i->getQ()));
78  }
79 
80  AddPoint(GA[event->getID()], t1, event->size());
81  AddPoint(GD[event->getID()], t1, Q1.getSTDev());
82  AddPoint(GQ[event->getID()], t1, Q2.getMean());
83  AddPoint(G1[event->getID()], t1, Q1.getQuantile(Q, JQuantile::symmetric_t));
84  AddPoint(GN[event->getID()], t1, event->getOverlays());
85  }
86  STATUS(endl);
87 
88  TFile out(outputFile.c_str(), "recreate");
89 
90  out << GA << GD << GQ << G1 << GN;
91 
92  out.Write();
93  out.Close();
94 }
Utility class to parse command line options.
Definition: JParser.hh:1514
Q(UTCMax_s-UTCMin_s)-livetime_s
void AddPoint(TGraph *g1, const Double_t x, const Double_t y)
Add point to TGraph.
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:43
#define STATUS(A)
Definition: JMessage.hh:63
string outputFile
double getMean() const
Get mean value.
Definition: JQuantile.hh:252
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:1989
set_variable E_E log10(E_{fit}/E_{#mu})"
void put(const double x, const double w=1.0)
Put value.
Definition: JQuantile.hh:133
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
Acoustic event.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62