Jpp  16.0.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTestZero.hh
Go to the documentation of this file.
1 #ifndef __JCOMPAREHISTOGRAMS__JTESTZERO__
2 #define __JCOMPAREHISTOGRAMS__JTESTZERO__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include <TROOT.h>
8 #include <TObject.h>
9 #include "TGraph.h"
10 #include "TCanvas.h"
11 #include "TLine.h"
12 #include "TMath.h"
15 #include "JTools/JQuantile.hh"
16 #include "JTools/JRange.hh"
17 
18 
19 /**
20  * \author rgruiz
21  */
22 namespace JCOMPAREHISTOGRAMS {
23 
24  /**
25  * Implementation of a bin-by-bin compatibility test for 2D histograms with low bin contents.\n
26  * This class is derived from the abstract class JTest_t(). For a general description of the implementation of this and other tests derived from JTest_t(), see its documentation.\n
27  * The test is run by the method JTestZero_2D().
28  */
29  class JTestZero:
30  public JTest_t,
31  public JTestZero_t
32  {
33  public:
34 
35  /**
36  * Default constructor.
37  */
39  JTest_t("Zero", "failure_fraction"),
40  JTestZero_t()
41  {}
42 
43  /**
44  * Read test parameters from input.
45  *
46  * \param in input stream
47  * \return input stream
48  */
49  std::istream& read(std::istream& in) override{
50  return in >> outliersThreshold >> threshold;
51  };
52 
53  /**
54  * Bin-by-bin comparison for ROOT TH2 histograms, of compatibility with a Poisson pdf of parameter 1.
55  *
56  * \param o1 First histogram
57  * \param o2 Second histogram
58  */
59  void test(TObject* o1, TObject* o2) override{
60 
61  using namespace std;
62 
63  if (!(dynamic_cast<TH2*>(o1) == NULL) && !(dynamic_cast<TH2*>(o2) == NULL)) {
64 
65  TH2D* h1 = dynamic_cast<TH2D*>(o1);
66  TH2D* h2 = dynamic_cast<TH2D*>(o2);
67 
69  results.push_back(r);
70  }
71  };
72 
73  private:
74  double outliersThreshold; //!< Fraction of bins allowed to fail.
75  double threshold; //!< threshold p-value to decide if test is passed.
76  };
77 }
78 
79 #endif
Interface to read input and write output for TObject tests.
Definition: JTest_t.hh:46
Definition: JRoot.hh:19
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:71
data_type r[M+1]
Definition: JPolint.hh:758
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
Implementation of the Zeros test for histograms with expected low bin contents.
Definition: JTestZero_t.hh:28
double outliersThreshold
Fraction of bins allowed to fail.
Definition: JTestZero.hh:71
double threshold
threshold p-value to decide if test is passed.
Definition: JTestZero.hh:75
const std::string resultType
result type
Definition: JTest_t.hh:167
const std::string testName
test name
Definition: JTest_t.hh:166
JTestResult JTestZero_2D(TH2 *h1, TH2 *h2, double outliersThreshold, double threshold, std::string testName, std::string parameterName)
Bin-by-Bin test for 2D histograms where a very low number of entries is expected. ...
Definition: JTestZero_t.hh:54
std::istream & read(std::istream &in) override
Read test parameters from input.
Definition: JTestZero.hh:49
Auxiliary class to define a range between two values.
Implementation of a bin-by-bin compatibility test for 2D histograms with low bin contents.
Definition: JTestZero.hh:29
Structure containing the result of the test.
Definition: JTestResult.hh:27
JTestZero()
Default constructor.
Definition: JTestZero.hh:38
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
void test(TObject *o1, TObject *o2) override
Bin-by-bin comparison for ROOT TH2 histograms, of compatibility with a Poisson pdf of parameter 1...
Definition: JTestZero.hh:59