Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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/JSupport.hh"
12 
13 #include "JTools/JQuantile.hh"
14 
15 #include "Jeep/JPrint.hh"
16 #include "Jeep/JParser.hh"
17 #include "Jeep/JMessage.hh"
18 
19 
20 /**
21  * \file
22  *
23  * Auxiliary program to print chi2/NDF of acoustic events.
24  * \author mdejong
25  */
26 int main(int argc, char **argv)
27 {
28  using namespace std;
29  using namespace JPP;
30 
32  JLimit_t& numberOfEvents = inputFile.getLimit();
33  int width;
34  int precision;
35  int debug;
36 
37  try {
38 
39  JParser<> zap("Auxiliary program to print chi2/NDF of acoustic events.");
40 
41  zap['f'] = make_field(inputFile);
42  zap['n'] = make_field(numberOfEvents) = JLimit_t::max();
43  zap['w'] = make_field(width) = 1;
44  zap['p'] = make_field(precision) = 15;
45  zap['d'] = make_field(debug) = 1;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
53 
54  JQuantile Q;
55 
56  while (inputFile.hasNext()) {
57 
58  const JEvt* evt = inputFile.next();
59 
60  Q.put(evt->chi2 / evt->ndf);
61  }
62 
63  cout << scientific << setw(width) << setprecision(precision) << (Q.getCount() > 0 ? Q.getMean() : numeric_limits<float>::max()) << endl;
64 }
Utility class to parse command line options.
Definition: JParser.hh:1517
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
Definition: Main.cc:15
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:43
ROOT TTree parameter settings.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
I/O formatting auxiliaries.
Acoustic event fit.
double ndf
weighed number of degrees of freedom
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
Acoustic event fit.
int debug
debug level