CMS 3D CMS Logo

List of all members | 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

Public Member Functions

def do_test (self, h1, h2)
 
def get_N_bins (self, h)
 
def is_empty (self, h)
 

Static Public Attributes

 name
 

Detailed Description

StatisticalTests.

Definition at line 302 of file utils_v2.py.

Member Function Documentation

◆ do_test()

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

Definition at line 319 of file utils_v2.py.

References utils_v2.StatisticalTest.get_N_bins(), DEutils< T >.is_empty(), DEcompare< T >.is_empty(), dirstructure.Directory.is_empty(), and utils_v2.StatisticalTest.is_empty().

319  def do_test(self, h1, h2):
320  if not h1 or not h2:
321  raise ComparisonError('Missing histogram')
322  if not isinstance(h1, type(h2)):
323  return -104 # raise ComparisonError('Histograms have different types')
324  if not h1.InheritsFrom('TH1'):
325  return -105 # raise ComparisonError('Object is not a histogram')
326  if self.is_empty(h1) or self.is_empty(h2):
327  return 1
328  h1_bins = self.get_N_bins(h1)
329  if h1_bins != self.get_N_bins(h2):
330  return -103 # raise CoparisonError('Ranges of histograms are different')
331 
332 

◆ get_N_bins()

def utils_v2.StatisticalTest.get_N_bins (   self,
  h 
)

Definition at line 305 of file utils_v2.py.

Referenced by utils_v2.StatisticalTest.do_test(), utils_v2.Chi2Test.do_test(), and utils_v2.StatisticalTest.is_empty().

305  def get_N_bins(self, h):
306  x = h.GetNbinsX()
307  y = h.GetNbinsY()
308  z = h.GetNbinsZ()
309  if not (y and z): # Is this realy necessary?
310  return 0
311  return (x + 1) * (y + 1) * (z + 1)
312 

◆ is_empty()

def utils_v2.StatisticalTest.is_empty (   self,
  h 
)

Definition at line 313 of file utils_v2.py.

References utils_v2.StatisticalTest.get_N_bins(), and FastTimerService_cff.range.

Referenced by utils_v2.StatisticalTest.do_test().

313  def is_empty(self, h):
314  for i in range(1, self.get_N_bins(h)):
315  if h.GetBinContent(i) != 0:
316  return False
317  return True
318 
def is_empty(h)
Definition: utils.py:179

Member Data Documentation

◆ name

utils_v2.StatisticalTest.name
static