Jpp  19.1.0-rc.1
the software that should make you happy
JPrintChi2.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <limits>
4 
5 #include "TROOT.h"
6 #include "TFile.h"
7 
9 
10 #include "JAcoustics/JEvt.hh"
11 #include "JAcoustics/JSuperEvt.hh"
12 #include "JAcoustics/JSupport.hh"
13 
15 #include "JLang/JManip.hh"
16 
17 #include "JTools/JQuantile.hh"
18 
19 #include "Jeep/JPrint.hh"
20 #include "Jeep/JParser.hh"
21 #include "Jeep/JMessage.hh"
22 
23 
24 /**
25  * \file
26  *
27  * Auxiliary program to print chi2/NDF of acoustic events.
28  * \author mdejong
29  */
30 int main(int argc, char **argv)
31 {
32  using namespace std;
33  using namespace JPP;
34 
35  typedef JTYPELIST<JEvt, JSuperEvt>::typelist typelist;
36 
38  JLimit_t& numberOfEvents = inputFile.getLimit();
39  int width;
40  int precision;
41  int debug;
42 
43  try {
44 
45  JParser<> zap("Auxiliary program to print chi2/NDF of acoustic events.");
46 
47  zap['f'] = make_field(inputFile);
48  zap['n'] = make_field(numberOfEvents) = JLimit_t::max();
49  zap['w'] = make_field(width) = 1;
50  zap['p'] = make_field(precision) = 15;
51  zap['d'] = make_field(debug) = 1;
52 
53  zap(argc, argv);
54  }
55  catch(const exception &error) {
56  FATAL(error.what() << endl);
57  }
58 
59 
60  JQuantile Q;
61 
62  for (JObjectMultiplexer<typelist> in(inputFile); in.hasNext(); ) {
63 
64  const JEvt* evt = in.next();
65 
66  Q.put(evt->chi2 / evt->ndf);
67  }
68 
69  cout << SCIENTIFIC(width,precision) << Q.getMean(numeric_limits<float>::max()) << endl;
70 }
Acoustic event fit.
ROOT TTree parameter settings.
I/O manipulators.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
int main(int argc, char **argv)
Definition: JPrintChi2.cc:30
I/O formatting auxiliaries.
Acoustic event fit.
Auxiliary class for multiplexing object iterators.
virtual bool hasNext() override
Check availability of next element.
Utility class to parse command line options.
Definition: JParser.hh:1714
General purpose class for object reading from a list of file names.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Acoustic event fit.
double ndf
weighed number of degrees of freedom
Type list.
Definition: JTypeList.hh:23
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
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:488