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 300 of file utils_v2.py.

Member Function Documentation

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

Definition at line 317 of file utils_v2.py.

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

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

Definition at line 303 of file utils_v2.py.

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

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

Definition at line 311 of file utils_v2.py.

References utils_v2.StatisticalTest.get_N_bins().

Referenced by utils_v2.StatisticalTest.do_test().

311  def is_empty(self, h):
312  for i in xrange(1, self.get_N_bins(h)):
313  if h.GetBinContent(i) != 0:
314  return False
315  return True
316 
def is_empty(self, h)
Definition: utils_v2.py:311
def get_N_bins(self, h)
Definition: utils_v2.py:303

Member Data Documentation

utils_v2.StatisticalTest.name
static