99 const TH1* h1 =
dynamic_cast<const TH1*
>(o1);
100 const TH1* h2 =
dynamic_cast<const TH1*
>(o2);
102 if (h1 == NULL || h2 == NULL) {
103 THROW(
JValueOutOfRange,
"JTestEffectiveLogLikelihood::test(): Could not cast given TObjects to TH1.");
106 if(h1->GetNbinsX() != h2->GetNbinsX() ||
107 h1->GetNbinsY() != h2->GetNbinsY() ||
108 h1->GetNbinsZ() != h2->GetNbinsZ()) {
109 THROW(
JValueOutOfRange,
"JTestEffectiveLogLikelihood::test(): Histograms with different binning. The objects: " <<
110 h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." << endl);
113 TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
119 double LnLratio = 0.0;
121 for (
int i=1 ; i <= h1->GetNbinsX() ; ++i) {
122 for (
int j=1 ; j <= h1->GetNbinsY() ; ++j) {
123 for (
int k=1 ; k <= h1->GetNbinsZ() ; ++k) {
125 const double n1 = h1->GetBinContent(i,j,k);
126 const double n2 = h2->GetBinContent(i,j,k);
128 const double e1 = h1->GetBinError(i,j,k);
129 const double e2 = h2->GetBinError(i,j,k);
131 double contribution = 0.0;
134 contribution = (
getNLL(n1, n2, e2) -
136 }
else if (n2 > 0.0) {
137 contribution =
getNLL(n1, n2, e2);
140 h3->SetBinContent(i,j,k, contribution);
142 LnLratio += contribution;
147 const bool passed = (LnLratio <
threshold);
151 h3->SetTitle(title.
getTitle().c_str());