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

Auxiliary program to print chi2/NDF of acoustic events. More...

#include <iostream>
#include <iomanip>
#include <limits>
#include "TROOT.h"
#include "TFile.h"
#include "JSupport/JMultipleFileScanner.hh"
#include "JAcoustics/JEvt.hh"
#include "JAcoustics/JSupport.hh"
#include "JTools/JQuantile.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

Auxiliary program to print chi2/NDF of acoustic events.

Author
mdejong

Definition in file JPrintChi2.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JPrintChi2.cc.

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
Auxiliary data structure for running average, standard deviation and quantiles.
Definition: JQuantile.hh:43
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
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
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
int debug
debug level