#include <JTestChi2_2D.hh>
Definition at line 17 of file JTestChi2_2D.hh.
JTestChi2_2D::JTestChi2_2D |
( |
| ) |
|
|
inline |
std::istream& JTestChi2_2D::read |
( |
std::istream & |
in | ) |
|
|
inlinevirtual |
Implements JTest_t.
Definition at line 34 of file JTestChi2_2D.hh.
double threshold
threshold p-value to decide if test is passed.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
std::ostream& JTestChi2_2D::write |
( |
std::ostream & |
out | ) |
|
|
inlinevirtual |
Implements JTest_t.
Definition at line 44 of file JTestChi2_2D.hh.
46 out << scientific << setprecision(2) << (
r->passed ?
GREEN :
RED) <<
r->message << endl;
vector< JTestResult > results
Implements JTest_t.
Definition at line 57 of file JTestChi2_2D.hh.
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);
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;
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);
double threshold
threshold p-value to decide if test is passed.
then for HISTOGRAM in h0 h1
#define MAKE_STRING(A)
Make string.
JTestResult JChi2Test(TH1 *h1, TH1 *h2, double threshold)
vector< JTestResult > results
std::string to_string(const T &value)
Convert value to string.
virtual void JTestChi2_2D::save |
( |
TFile * |
f, |
|
|
string |
path |
|
) |
| |
|
inlinevirtual |
Implements JTest_t.
Definition at line 113 of file JTestChi2_2D.hh.
117 if (
f -> GetDirectory(
path.c_str())==0)
f->mkdir(
path.c_str());
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
vector< JTestResult > results
void JTestChi2_2D::clear |
( |
| ) |
|
|
inlinevirtual |
JTestResult JTestChi2_t::JChi2Test |
( |
TH1 * |
h1, |
|
|
TH1 * |
h2, |
|
|
double |
threshold |
|
) |
| |
|
inlineinherited |
Definition at line 33 of file JTestChi2_t.hh.
37 if(
h1 -> GetNbinsX() != h2 -> GetNbinsX())
38 ERROR(
"Histograms with different bining. The objects: " <<
h1 -> GetName() <<
" can not be compared." << endl);
40 double chi2 =
h1 -> Chi2Test (h2 ,
"WW");
42 double M =
h1->Integral();
43 double N = h2->Integral();
45 TH2D* h3 = (TH2D*)
h1->Clone(
h1->GetName()==h2->GetName() ?
51 for (
int i=1 ; i <
h1->GetNbinsX() ; ++i){
53 double m =
h1->GetBinContent(i);
54 double n = h2->GetBinContent(i);
57 double c = (M*n - N*m)/sqrt((n+m)*(N*
M));
58 h3->SetBinContent(i,c);
65 " HA: " <<
h1->GetUniqueID() <<
" " <<
h1->GetName() <<
66 " HB: " << h2->GetUniqueID() <<
" " << h2->GetName() <<
67 " Threshold: " << threshold <<
" Result: " << chi2 <<
" " << (r.
passed ?
"PASSED" :
"FAILED"));
72 h3->SetTitle(title.getTitle().c_str());
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
#define MAKE_STRING(A)
Make string.
alias put_queue eval echo n
std::string to_string(const T &value)
Convert value to string.
then usage $script[input file[working directory[option]]] nWhere option can be N
JTestResult JTestChi2_t::JChi2TestBin_2D |
( |
TH2 * |
h1, |
|
|
TH2 * |
h2, |
|
|
double |
outliersThreshold, |
|
|
double |
chi2Threshold |
|
) |
| |
|
inlineinherited |
Definition at line 89 of file JTestChi2_t.hh.
91 int nx1 =
h1->GetNbinsX();
92 int nx2 = h2->GetNbinsX();
93 int ny1 =
h1->GetNbinsY();
94 int ny2 = h2->GetNbinsY();
96 double M =
h1->Integral();
97 double N = h2->Integral();
99 if(nx1 != nx2 || ny1 != ny2 || M == 0 || N == 0)
100 ERROR(
"Histograms with different binning. The objects: " <<
h1->GetName() <<
" can not be compared." << endl);
102 TH2D* h3 = (TH2D*)
h1->Clone(
h1->GetName()==h2->GetName() ?
112 for (
int i=1 ; i<nx1 ; ++i){
113 for (
int j=1 ;
j<ny1 ; ++
j){
115 double m =
h1 -> GetBinContent(i,
j);
116 double n = h2 -> GetBinContent(i,
j);
117 double chi2 = (n-m*N/
M)/sqrt(m*N/M);
118 (fabs(chi2) > chi2Threshold ? outliers+=1./(nx1*ny1) : outliers+=0 );
119 h3->SetBinContent(i,
j,chi2);
123 (outliers > outliersThreshold ? r.
passed =
false : r.
passed =
true);
126 " HA: " <<
h1->GetUniqueID() <<
" " <<
h1->GetName() <<
127 " HB: " << h2->GetUniqueID() <<
" " << h2->GetName() <<
128 " Threshold: " << outliersThreshold <<
" Result: " << outliers <<
" " << (r.
passed ?
"PASSED" :
"FAILED"));
132 h3->SetTitle(title.getTitle().c_str());
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
#define MAKE_STRING(A)
Make string.
alias put_queue eval echo n
std::string to_string(const T &value)
Convert value to string.
then usage $script[input file[working directory[option]]] nWhere option can be N
double JTestChi2_2D::threshold |
|
private |
threshold p-value to decide if test is passed.
Definition at line 131 of file JTestChi2_2D.hh.
The documentation for this class was generated from the following file: