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

Member Function Documentation

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

Definition at line 316 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().

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

Definition at line 302 of file utils_v2.py.

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

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

Definition at line 310 of file utils_v2.py.

References utils_v2.StatisticalTest.get_N_bins().

Referenced by utils_v2.StatisticalTest.do_test().

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

Member Data Documentation

utils_v2.StatisticalTest.name
static