CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
def get_N_bins
 
def is_empty
 

Static Public Attributes

 name = None
 

Detailed Description

StatisticalTests.

Definition at line 302 of file utils_v2.py.

Member Function Documentation

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().

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

306  def get_N_bins(self, h):
307  x = h.GetNbinsX()
308  y = h.GetNbinsY()
309  z = h.GetNbinsZ()
310  if not (y and z): # Is this realy necessary?
311  return 0
312  return (x + 1) * (y + 1) * (z + 1)
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 sistrip::SpyUtilities.range().

Referenced by utils_v2.StatisticalTest.do_test().

314  def is_empty(self, h):
315  for i in range(1, self.get_N_bins(h)):
316  if h.GetBinContent(i) != 0:
317  return False
318  return True
const uint16_t range(const Frame &aFrame)

Member Data Documentation

utils_v2.StatisticalTest.name = None
static

Definition at line 303 of file utils_v2.py.

Referenced by config.CFG.__str__(), geometryComparison.GeometryComparison.createScript(), validation.Sample.digest(), primaryVertexResolution.PrimaryVertexResolution.getRepMap(), primaryVertexValidation.PrimaryVertexValidation.getRepMap(), zMuMuValidation.ZMuMuValidation.getRepMap(), and VIDSelectorBase.VIDSelectorBase.initialize().