CMS 3D CMS Logo

Public Member Functions | Static Public Attributes

utils_v2::StatisticalTest Class Reference

StatisticalTests. More...

Inheritance diagram for utils_v2::StatisticalTest:
utils_v2::Chi2Test utils_v2::KolmogorovTest

List of all members.

Public Member Functions

def do_test
def get_N_bins
def is_empty

Static Public Attributes

 name = None

Detailed Description

StatisticalTests.

Definition at line 299 of file utils_v2.py.


Member Function Documentation

def utils_v2::StatisticalTest::do_test (   self,
  h1,
  h2 
)

Reimplemented in utils_v2::KolmogorovTest, and utils_v2::Chi2Test.

Definition at line 316 of file utils_v2.py.

00317                              :
00318         if not h1 or not h2:
00319             raise ComparisonError('Missing histogram')
00320         if type(h1) != type(h2):
00321             return -104     # raise ComparisonError('Histograms have different types')
00322         if not h1.InheritsFrom('TH1'):
00323             return -105     # raise ComparisonError('Object is not a histogram')
00324         if self.is_empty(h1) or self.is_empty(h2):
00325             return 1
00326         h1_bins = self.get_N_bins(h1)
00327         if h1_bins != self.get_N_bins(h2):
00328             return -103     # raise CoparisonError('Ranges of histograms are different')
00329 

def utils_v2::StatisticalTest::get_N_bins (   self,
  h 
)

Definition at line 302 of file utils_v2.py.

00303                            :
00304         x = h.GetNbinsX()
00305         y = h.GetNbinsY()
00306         z = h.GetNbinsZ()
00307         if not (y and z): # Is this realy necessary?
00308             return 0
00309         return (x + 1) * (y + 1) * (z + 1)

def utils_v2::StatisticalTest::is_empty (   self,
  h 
)

Definition at line 310 of file utils_v2.py.

00311                          :
00312         for i in xrange(1, self.get_N_bins(h)):
00313             if h.GetBinContent(i) != 0:
00314                 return False
00315             return True


Member Data Documentation

Reimplemented in utils_v2::KolmogorovTest, and utils_v2::Chi2Test.

Definition at line 300 of file utils_v2.py.