Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JTestZero_t Class Reference

#include <JTestZero_t.hh>

Inheritance diagram for JTestZero_t:
JTestZero

Public Member Functions

 JTestZero_t ()
 
JTestResult JTestZero_2D (TH2 *h1, TH2 *h2, double outliersThreshold, double threshold)
 

Detailed Description

Definition at line 20 of file JTestZero_t.hh.

Constructor & Destructor Documentation

JTestZero_t::JTestZero_t ( )
inline

Definition at line 27 of file JTestZero_t.hh.

27 {}

Member Function Documentation

JTestResult JTestZero_t::JTestZero_2D ( TH2 *  h1,
TH2 *  h2,
double  outliersThreshold,
double  threshold 
)
inline

Definition at line 37 of file JTestZero_t.hh.

37  {
38 
39  int nx1 = h1->GetNbinsX();
40  int nx2 = h2->GetNbinsX();
41  int ny1 = h1->GetNbinsY();
42  int ny2 = h2->GetNbinsY();
43 
44  if(nx1 != nx2 || ny1 != ny2)
45  ERROR("Histograms with different binning. The objects: " << h1->GetName() << " can not be compared." << endl);
46 
47  TH2D* h3 = (TH2D*)h1->Clone(h1->GetName()==h2->GetName() ?
48  MAKE_CSTRING(to_string(h1->GetName())) :
49  MAKE_CSTRING(to_string(h1->GetName()) + "_VS_" + to_string(h2->GetName())));
50  h3->Reset();
51 
52  JTestResult r;
53 
54  double failures = 0;
55 
56  for (int i=1 ; i<nx1+1 ; ++i){
57  for (int j=1 ; j<ny1+1 ; ++j){
58 
59  double m = h1 -> GetBinContent(i,j);
60  double n = h2 -> GetBinContent(i,j);
61 
62  double p1 = 1 - ROOT::Math::poisson_cdf(m,1);
63  double p2 = 1 - ROOT::Math::poisson_cdf(n,1);
64 
65  cout << "m " << m << " pm " << p1 << " n " << n << " pn " << p2 << endl;
66 
67  if ((p1 > threshold && p2 < threshold) ||
68  (p1 < threshold && p2 > threshold)){
69  h3->Fill(i,j);
70  failures+=1./(nx1*ny1);
71  }
72  }
73  }
74 
75  (failures > outliersThreshold ? r.passed = false : r.passed = true);
76 
77  r.message = MAKE_STRING(scientific << setprecision(2)<< "Test: " << "Chi2" <<
78  " HA: " << h1->GetUniqueID() << " " << h1->GetName() <<
79  " HB: " << h2->GetUniqueID() << " " << h2->GetName() <<
80  " Threshold: " << outliersThreshold << " Result: " << failures << " " << (r.passed ? "PASSED" : "FAILED"));
81 
82  JResultTitle title("Zero", "Failures[%] ", r.passed , failures * 100);
83 
84  h3->SetTitle(title.getTitle().c_str());
85 
86  r.obj = h3;
87 
88  return r;
89  };
TPaveText * p1
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:708
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:69
data_type r[M+1]
Definition: JPolint.hh:709
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:699
#define ERROR(A)
Definition: JMessage.hh:66
string message
Definition: JTest_t.hh:65
alias put_queue eval echo n
Definition: qlib.csh:19
std::string to_string(const T &value)
Convert value to string.
int j
Definition: JPolint.hh:634
bool passed
Definition: JTest_t.hh:64
TObject * obj
Definition: JTest_t.hh:66

The documentation for this class was generated from the following file: