Jpp  16.0.0-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  int debug;
39 
40  try {
41 
42  JParser<> zap("Example program to monitor acoustic events.");
43 
44  zap['f'] = make_field(inputFile, "output of JAcousticTriggerProcessor[.sh]");
45  zap['n'] = make_field(numberOfEvents) = JLimit::max();
46  zap['o'] = make_field(outputFile) = "monitor.root";
47  zap['d'] = make_field(debug) = 2;
48 
49  zap(argc, argv);
50  }
51  catch(const exception &error) {
52  FATAL(error.what() << endl);
53  }
54 
55  JManager<int, TGraph> GA(new TGraph(), "G[%].size");
56  JManager<int, TGraph> GD(new TGraph(), "G[%].rms");
57  JManager<int, TGraph> GQ(new TGraph(), "G[%].quality");
58  JManager<int, TGraph> GN(new TGraph(), "G[%].overlays");
59 
60  while (inputFile.hasNext()) {
61 
62  if (inputFile.getCounter()%100 == 0) {
63  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
64  }
65 
66  const JEvent* event = inputFile.next();
67 
68  const double t1 = event->begin()->getToA();
69 
70  JQuantile QD, QQ;
71 
72  for (JEvent::const_iterator i = event->begin(); i != event->end(); ++i) {
73  QD.put(i->getToA() - t1);
74  QQ.put(log10(i->getQ()));
75  }
76 
77  AddPoint(GA[event->getID()], t1, event->size());
78  AddPoint(GD[event->getID()], t1, QD.getSTDev());
79  AddPoint(GQ[event->getID()], t1, QQ.getMean());
80  AddPoint(GN[event->getID()], t1, event->getOverlays());
81  }
82  STATUS(endl);
83 
84  TFile out(outputFile.c_str(), "recreate");
85 
86  out << GA << GD << GQ << GN;
87 
88  out.Write();
89  out.Close();
90 }
Utility class to parse command line options.
Definition: JParser.hh:1500
void AddPoint(TGraph *g1, const Double_t x, const Double_t y)
Add point to TGraph.
double getSTDev() const
Get standard deviation.
Definition: JQuantile.hh:266
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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
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
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
Acoustic event.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73