Public Member Functions | |
def | __init__ |
def | checkBinningMatches |
def | do_test |
Public Attributes | |
epsilon | |
name |
The bin to bin comparison builds a fake pvalue. It is 0 if the number of bins is different. It is % of corresponding bins otherwhise. A threshold of 1 is needed to require a 1 to 1 correspondance between hisograms.
def utils::BinToBin::__init__ | ( | self, | |
threshold = 1 |
|||
) |
Reimplemented from utils::StatisticalTest.
def utils::BinToBin::checkBinningMatches | ( | self | ) |
Definition at line 293 of file utils.py.
00294 : 00295 if self.h1.GetNbinsX() != self.h2.GetNbinsX() \ 00296 or self.h1.GetNbinsY() != self.h2.GetNbinsY() \ 00297 or self.h1.GetNbinsZ() != self.h2.GetNbinsZ() \ 00298 or abs(self.h1.GetXaxis().GetXmin() - self.h2.GetXaxis().GetXmin()) >self.epsilon \ 00299 or abs(self.h1.GetYaxis().GetXmin() - self.h2.GetYaxis().GetXmin()) >self.epsilon \ 00300 or abs(self.h1.GetZaxis().GetXmin() - self.h2.GetZaxis().GetXmin()) >self.epsilon \ 00301 or abs(self.h1.GetXaxis().GetXmax() - self.h2.GetXaxis().GetXmax()) >self.epsilon \ 00302 or abs(self.h1.GetYaxis().GetXmax() - self.h2.GetYaxis().GetXmax()) >self.epsilon \ 00303 or abs(self.h1.GetZaxis().GetXmax() - self.h2.GetZaxis().GetXmax()) >self.epsilon: 00304 return False 00305 return True
def utils::BinToBin::do_test | ( | self | ) |
Reimplemented from utils::StatisticalTest.
Definition at line 306 of file utils.py.
00307 : 00308 # fist check that binning matches 00309 if not self.checkBinningMatches(): 00310 return test_codes["DIFF_BIN"] 00311 # then do the real check 00312 equal = 1 00313 nbins = getNbins(self.h1) 00314 n_ok_bins=0.0 00315 for ibin in xrange(0,nbins): 00316 ibin+=1 00317 h1bin=self.h1.GetBinContent(ibin) 00318 h2bin=self.h2.GetBinContent(ibin) 00319 bindiff=h1bin-h2bin 00320 00321 binavg=.5*(h1bin+h2bin) 00322 00323 if binavg==0 or abs(bindiff) < self.epsilon: 00324 n_ok_bins+=1 00325 #print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00326 else: 00327 print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00328 00329 #if abs(bindiff)!=0 : 00330 #print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00331 00332 rank=n_ok_bins/nbins 00333 00334 if rank!=1: 00335 print "Histogram %s differs: nok: %s ntot: %s" %(self.h1.GetName(),n_ok_bins,nbins) 00336 00337 return rank 00338 00339 #-------------------------------------------------------------------------------
Reimplemented from utils::StatisticalTest.