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 312 of file utils.py.
00313 : 00314 if self.h1.GetNbinsX() != self.h2.GetNbinsX() \ 00315 or self.h1.GetNbinsY() != self.h2.GetNbinsY() \ 00316 or self.h1.GetNbinsZ() != self.h2.GetNbinsZ() \ 00317 or abs(self.h1.GetXaxis().GetXmin() - self.h2.GetXaxis().GetXmin()) >self.epsilon \ 00318 or abs(self.h1.GetYaxis().GetXmin() - self.h2.GetYaxis().GetXmin()) >self.epsilon \ 00319 or abs(self.h1.GetZaxis().GetXmin() - self.h2.GetZaxis().GetXmin()) >self.epsilon \ 00320 or abs(self.h1.GetXaxis().GetXmax() - self.h2.GetXaxis().GetXmax()) >self.epsilon \ 00321 or abs(self.h1.GetYaxis().GetXmax() - self.h2.GetYaxis().GetXmax()) >self.epsilon \ 00322 or abs(self.h1.GetZaxis().GetXmax() - self.h2.GetZaxis().GetXmax()) >self.epsilon: 00323 return False 00324 return True
def utils::BinToBin::do_test | ( | self | ) |
Reimplemented from utils::StatisticalTest.
Definition at line 325 of file utils.py.
00326 : 00327 # fist check that binning matches 00328 if not self.checkBinningMatches(): 00329 return test_codes["DIFF_BIN"] 00330 # then do the real check 00331 equal = 1 00332 nbins = getNbins(self.h1) 00333 n_ok_bins=0.0 00334 for ibin in xrange(0,nbins): 00335 h1bin=self.h1.GetBinContent(ibin) 00336 h2bin=self.h2.GetBinContent(ibin) 00337 bindiff=h1bin-h2bin 00338 00339 binavg=.5*(h1bin+h2bin) 00340 00341 if binavg==0 or abs(bindiff) < self.epsilon: 00342 n_ok_bins+=1 00343 #print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00344 else: 00345 print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00346 00347 #if abs(bindiff)!=0 : 00348 #print "Bin %ibin: bindiff %s" %(ibin,bindiff) 00349 00350 rank=n_ok_bins/nbins 00351 00352 if rank!=1: 00353 print "Histogram %s differs: nok: %s ntot: %s" %(self.h1.GetName(),n_ok_bins,nbins) 00354 00355 return rank 00356 00357 #-------------------------------------------------------------------------------
Reimplemented from utils::StatisticalTest.