Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
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

◆ main()

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  if (event->empty()) { // due to emptying of overlapping events
72  continue;
73  }
74 
75  const double t1 = event->begin()->getToE();
76 
77  JQuantile Q1("", true), Q2;
78 
79  for (JEvent::const_iterator i = event->begin(); i != event->end(); ++i) {
80  Q1.put(i->getToE());
81  Q2.put(log10(i->getQ()));
82  }
83 
84  AddPoint(GA[event->getID()], t1, event->size());
85  AddPoint(GD[event->getID()], t1, Q1.getSTDev());
86  AddPoint(GQ[event->getID()], t1, Q2.getMean());
87  AddPoint(G1[event->getID()], t1, Q1.getQuantile(Q, JQuantile::symmetric_t));
88  AddPoint(GN[event->getID()], t1, event->getOverlays());
89  }
90  STATUS(endl);
91 
92  TFile out(outputFile.c_str(), "recreate");
93 
94  out << GA << GD << GQ << G1 << GN;
95 
96  out.Write();
97  out.Close();
98 }
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:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void AddPoint(TGraph *g1, const Double_t x, const Double_t y)
Add point to TGraph.
Definition: JSTDTypes.hh:14
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:45
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:46
void put(const double x, const double w=1.0)
Put value.
Definition: JQuantile.hh:133
double getMean() const
Get mean value.
Definition: JQuantile.hh:252