Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTestKolmogorov_1D.hh
Go to the documentation of this file.
1 #ifndef __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_1D__
2 #define __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_1D__
3 
4 #include <istream>
5 #include <ostream>
6 #include "TMath.h"
9 
10 
11 /**
12  * \author rgruiz
13  */
14 namespace JCOMPAREHISTOGRAMS {
15 
16  /**
17  *
18  * Implementation of the Kolmogorov test for 1D histograms.\n
19  * 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
20  * This test uses the input parameter threshold() to evaluate whether the test is passed or failed.\n
21  * The evaluation is done by comparing the threshold value with the result of the JKolmogorovTest() test. This is a p-value.\n
22  * The parameter threshold should therefore be a real value between 0 and 1.
23  */
25  public JTest_t,
26  public JTestKolmogorov_t
27  {
28  public:
29 
30  /**
31  * Default constructor.
32  */
34  JTest_t("KS_1D", "p-Value(KS)"),
36  {}
37 
38  /**
39  * Read test parameters from input.
40  *
41  * \param in input stream
42  * \return input stream
43  */
44  std::istream& read(std::istream& in) override{
45  return in >> threshold;
46  };
47 
48  /**
49  * Applies Kolmogorov test for two ROOT TH1 histograms.
50  *
51  * \param o1 First histogram
52  * \param o2 Second histogram
53  */
54  void test(TObject* o1, TObject* o2) override{
55 
56  using namespace std;
57 
58  if (!(dynamic_cast<TH2*>(o1) == NULL) || !(dynamic_cast<TH2*>(o2) == NULL)) {
59  ERROR("For 2D histograms call JTestKolmogorov_2D: " << o1->GetName() << endl);
60 
61  } else if (!(dynamic_cast<TH1*>(o1) == NULL) && !(dynamic_cast<TH1*>(o2) == NULL)) {
62 
63  TH1D* h1 = dynamic_cast<TH1D*>(o1);
64  TH1D* h2 = dynamic_cast<TH1D*>(o2);
65 
67 
68  results.push_back(r);
69  }
70  };
71 
72  private:
73  double threshold; //!< threshold p-value to decide if test is passed.
74  };
75 }
76 
77 #endif
Interface to read input and write output for TObject tests.
Definition: JTest_t.hh:46
Implementation of the different Kolmogorov-related tests.
Definition: JRoot.hh:19
data_type r[M+1]
Definition: JPolint.hh:779
JTestResult JKolmogorovTest(TH1 *h1, TH1 *h2, double threshold, std::string testName, std::string parameterName)
Kolmogorov test for 1D histograms.
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
std::istream & read(std::istream &in) override
Read test parameters from input.
double threshold
threshold p-value to decide if test is passed.
#define ERROR(A)
Definition: JMessage.hh:66
const std::string resultType
result type
Definition: JTest_t.hh:167
const std::string testName
test name
Definition: JTest_t.hh:166
void test(TObject *o1, TObject *o2) override
Applies Kolmogorov test for two ROOT TH1 histograms.
Structure containing the result of the test.
Definition: JTestResult.hh:27
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
Implementation of the Kolmogorov test for 1D histograms.