1 #ifndef __JTESTCHI2_2D__
2 #define __JTESTCHI2_2D__
34 std::istream&
read(std::istream&
in) {
35 return in >> threshold >> slice;
44 std::ostream&
write(std::ostream& out) {
46 out << scientific << setprecision(2) << (
r->passed ?
GREEN :
RED) <<
r->message << endl;
59 if (!(dynamic_cast<TH2*>(o1) == NULL) && !(dynamic_cast<TH2*>(o2) == NULL)) {
61 TH2D*
h1 =
dynamic_cast<TH2D*
>(o1);
62 TH2D* h2 =
dynamic_cast<TH2D*
>(o2);
64 if(slice ==
'x' || slice ==
'X'){
66 int nSlices1 = h1->GetNbinsX();
67 int nSlices2 = h2->GetNbinsX();
69 if(nSlices1 != nSlices2)
70 ERROR(
"Histograms with different binning. The objects: " << o1->GetName() <<
" can not be compared." << endl);
72 for (
int i=1 ; i<=nSlices1 ; ++i){
76 TH1D* s1 = h1->ProjectionY (name.c_str(),i,i);
77 TH1D* s2 = h2->ProjectionY (name.c_str(),i,i);
80 cout <<
"name test " << r.
obj->GetName() << endl;
83 }
else if (slice ==
'y' || slice ==
'Y'){
85 int nSlices1 = h1->GetNbinsY();
86 int nSlices2 = h2->GetNbinsY();
88 if(nSlices1 != nSlices2)
89 ERROR(
"Histograms with different binning. The objects: " << o1->GetName() <<
" can not be compared." << endl);
91 for (
int i=1 ; i<=nSlices1 ; ++i){
95 TH1D* s1 = h1->ProjectionX (name.c_str(),i,i);
96 TH1D* s2 = h2->ProjectionX (name.c_str(),i,i);
103 }
else if (!(dynamic_cast<TH1*>(o1) == NULL) && !(dynamic_cast<TH1*>(o2) == NULL)) {
104 ERROR(
"For 1D histograms call JChi2_1D: " << o1->GetName() << endl);
117 if (f -> GetDirectory(path.c_str())==0) f->mkdir(path.c_str());
double threshold
threshold p-value to decide if test is passed.
virtual void save(TFile *f, string path)
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
then for HISTOGRAM in h0 h1
void test(TObject *o1, TObject *o2)
#define MAKE_STRING(A)
Make string.
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
std::ostream & write(std::ostream &out)
std::istream & read(std::istream &in)
std::string to_string(const T &value)
Convert value to string.