Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTestIdentical_3D.hh
Go to the documentation of this file.
1 #ifndef __JCOMPAREHISTOGRAMS__JTESTIDENTICAL_3D__
2 #define __JCOMPAREHISTOGRAMS__JTESTIDENTICAL_3D__
3 
4 #include <istream>
5 #include <ostream>
8 
9 
10 /**
11  * \author rgruiz
12  */
13 namespace JCOMPAREHISTOGRAMS {
14 
15  /**
16  * Implementation of the a test to check if two 3D histograms are the same.\n
17  * 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
18  * The input parameter tolerance(), is used to evaluate whether the test is passed or failed.\n
19  * The test is run by the method JIdenticalTest().
20  */
22  public JTest_t,
23  public JTestIdentical_t
24  {
25  public:
26 
27  /**
28  * Default constructor.
29  */
31  JTest_t("Identical_3D", "Difference"),
33  {}
34 
35  /**
36  * Read test parameters from input.
37  *
38  * \param in input stream
39  * \return input stream
40  */
41  std::istream& read(std::istream& in) override{
42  return in >> tolerance;
43  };
44 
45  /**
46  * Applies test for two ROOT TH1 histograms.
47  *
48  * \param o1 First histogram
49  * \param o2 Second histogram
50  */
51  void test(TObject* o1, TObject* o2) override{
52 
53  using namespace std;
54 
55  if (!(dynamic_cast<TH3*>(o1) == NULL) && !(dynamic_cast<TH3*>(o2) == NULL)) {
56 
57  TH3D* h1 = dynamic_cast<TH3D*>(o1);
58  TH3D* h2 = dynamic_cast<TH3D*>(o2);
59 
60  if(h1 -> GetNbinsX() != h2 -> GetNbinsX())
61  ERROR("Histograms with different bining. The objects: " << h1 -> GetName() << " can not be compared." << endl);
62 
63  JTestResult r = JIdenticalTest<TH3D>(h1, h2, tolerance, testName, resultType);
64 
65  results.push_back(r);
66  }
67  };
68 
69  private:
70  double tolerance; //!< tolerance value to accept the difference as acceptable.
71  };
72 }
73 
74 #endif
Implementation test that verify if two histograms are the same.
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
void test(TObject *o1, TObject *o2) override
Applies test for two ROOT TH1 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.
#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
Structure containing the result of the test.
Definition: JTestResult.hh:27
Implementation of the a test to check if two 3D histograms are the same.
double tolerance
tolerance value to accept the difference as acceptable.
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