Jpp  18.2.1-ARCA-DF-PATCH
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/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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings.
Auxiliary class for multiplexing object iterators.
Type list.
Definition: JTypeList.hh:22
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:1989
Acoustic event fit.
General purpose messaging.
I/O manipulators.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Auxiliary data structure for average.
Definition: JKatoomba_t.hh:76
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:84
Acoustic event fit.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:484
int debug
debug level