#ifndef __JCOMPAREHISTOGRAMS__JTESTIDENTICAL_3D__ #define __JCOMPAREHISTOGRAMS__JTESTIDENTICAL_3D__ #include #include #include "JCompareHistograms/JTest_t.hh" #include "JCompareHistograms/JTestIdentical_t.hh" /** * \author rgruiz */ namespace JCOMPAREHISTOGRAMS { /** * Implementation of the a test to check if two 3D histograms are the same.\n * 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 * The input parameter tolerance(), is used to evaluate whether the test is passed or failed.\n * The test is run by the method JIdenticalTest(). */ class JTestIdentical_3D: public JTest_t, public JTestIdentical_t { public: /** * Default constructor. */ JTestIdentical_3D() : JTest_t("Identical_3D", "Difference"), JTestIdentical_t() {} /** * Read test parameters from input. * * \param in input stream * \return input stream */ std::istream& read(std::istream& in) override{ return in >> tolerance; }; /** * Applies test for two ROOT TH1 histograms. * * \param o1 First histogram * \param o2 Second histogram */ void test(TObject* o1, TObject* o2) override{ using namespace std; if (!(dynamic_cast(o1) == NULL) && !(dynamic_cast(o2) == NULL)) { TH3D* h1 = dynamic_cast(o1); TH3D* h2 = dynamic_cast(o2); if(h1 -> GetNbinsX() != h2 -> GetNbinsX()) ERROR("Histograms with different bining. The objects: " << h1 -> GetName() << " can not be compared." << endl); JTestResult r = JIdenticalTest(h1, h2, tolerance, testName, resultType); results.push_back(r); } }; private: double tolerance; //!< tolerance value to accept the difference as acceptable. }; } #endif