#include <JTestChi2_1D.hh>
Definition at line 17 of file JTestChi2_1D.hh.
JTestChi2_1D::JTestChi2_1D |
( |
| ) |
|
|
inline |
std::istream& JTestChi2_1D::read |
( |
std::istream & |
in | ) |
|
|
inlinevirtual |
Implements JTest_t.
Definition at line 34 of file JTestChi2_1D.hh.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
double threshold
threshold p-value to decide if test is passed.
std::ostream& JTestChi2_1D::write |
( |
std::ostream & |
out | ) |
|
|
inlinevirtual |
Implements JTest_t.
Definition at line 44 of file JTestChi2_1D.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_1D.hh.
59 if (!(dynamic_cast<TH2*>(o1) == NULL) || !(dynamic_cast<TH2*>(o2) == NULL)) {
60 ERROR(
"For 2D histograms call JTestChi2_2D: " << o1->GetName() << endl);
62 }
else if (!(dynamic_cast<TH1*>(o1) == NULL) && !(
dynamic_cast<TH1*
>(o2) == NULL)) {
64 TH1D*
h1 =
dynamic_cast<TH1D*
>(o1);
65 TH1D* h2 =
dynamic_cast<TH1D*
>(o2);
67 if(h1 -> GetNbinsX() != h2 -> GetNbinsX())
68 ERROR(
"Histograms with different bining. The objects: " << h1 -> GetName() <<
" can not be compared." << endl);
double threshold
threshold p-value to decide if test is passed.
then for HISTOGRAM in h0 h1
JTestResult JChi2Test(TH1 *h1, TH1 *h2, double threshold)
vector< JTestResult > results
virtual void JTestChi2_1D::save |
( |
TFile * |
f, |
|
|
string |
path |
|
) |
| |
|
inlinevirtual |
Implements JTest_t.
Definition at line 81 of file JTestChi2_1D.hh.
85 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_1D::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_1D::threshold |
|
private |
threshold p-value to decide if test is passed.
Definition at line 99 of file JTestChi2_1D.hh.
The documentation for this class was generated from the following file: