|
| JTestIdentical_1D () |
| Default constructor. More...
|
|
std::istream & | read (std::istream &in) override |
| Read test parameters from input. More...
|
|
void | test (TObject *o1, TObject *o2) override |
| Applies test for two ROOT TH1 histograms. More...
|
|
std::ostream & | write (std::ostream &out, const char delimiter= ' ', const bool onlyFailures=false) const |
| Write test result to output. More...
|
|
virtual void | save (TFile *f, const std::string &path, const bool onlyFailures=false) |
| Writes the test result to root file. More...
|
|
virtual void | clear () |
| Clear results. More...
|
|
const std::string & | getTestName () |
| Get test name. More...
|
|
const std::string & | getResultType () |
| Get result type. More...
|
|
template<class T > |
JTestResult | JIdenticalTest (T *h1, T *h2, double tolerance, std::string testName, std::string parameterName) |
| Bin-by-Bin test of two histograms, that verifies whether the histograms are the same. More...
|
|
Implementation of the a test to check if two 1D histograms are the same.
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.
The input parameter tolerance(), is used to evaluate whether the test is passed or failed.
The test is run by the method JIdenticalTest().
Definition at line 20 of file JTestIdentical_1D.hh.
template<class T >
JTestResult JCOMPAREHISTOGRAMS::JTestIdentical_t::JIdenticalTest |
( |
T * |
h1, |
|
|
T * |
h2, |
|
|
double |
tolerance, |
|
|
std::string |
testName, |
|
|
std::string |
parameterName |
|
) |
| |
|
inlineinherited |
Bin-by-Bin test of two histograms, that verifies whether the histograms are the same.
For each bin, the test calculates the difference, and compares it with a tolerance passed as an argument.
The test is passed if the difference is smaller than the tolerance for every bin.
The template parameter can be TH1X, TH2X or TH3X.
- Parameters
-
h1 | First object |
h2 | Second object |
tolerance | tolerance value for the bin-by-bin differences |
parameterName | Name of the parameter used to test the histograms |
testName | Name of the test used to compare the histograms |
- Returns
- Test result.
Definition at line 45 of file JTestIdentical_t.hh.
50 if(
h1 -> GetNbinsX() != h2 -> GetNbinsX() ||
h1 -> GetNbinsY() != h2 -> GetNbinsY() ||
h1 -> GetNbinsZ() != h2 -> GetNbinsZ())
51 ERROR(
"Histograms with different bining. The objects: " <<
h1 -> GetName() <<
" can not be compared." << endl);
53 T* h3 = (
T*)
h1->Clone(
h1->GetName()==h2->GetName() ?
61 double maxDifference = 0.0;
63 for (
int i=0 ; i <
h1->GetNbinsX() ; ++i){
64 for (
int j=0 ;
j<
h1->GetNbinsY() ; ++
j){
65 for (
int k=0 ;
k<
h1->GetNbinsZ() ; ++
k){
67 double d =
h1->GetBinContent(i+1,
j+1,
k+1) - h2->GetBinContent(i+1,
j+1,
k+1);
69 if (fabs(d) > maxDifference)
70 maxDifference = fabs(d);
71 if (fabs(d) > tolerance)
77 JResultTitle title(testName, parameterName, passed , maxDifference);
79 h3->SetTitle(title.getTitle().c_str());
81 JTestResult
r (testName,
82 JRootObjectID(
MAKE_STRING(
h1->GetDirectory()->GetPath() <<
h1->GetName())),
83 JRootObjectID(
MAKE_STRING(h2->GetDirectory()->GetPath() <<
h1->GetName())),
84 parameterName, maxDifference, tolerance, h3, passed);
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
#define MAKE_STRING(A)
Make string.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
std::string to_string(const T &value)
Convert value to string.