CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
utils.BinToBin Class Reference
Inheritance diagram for utils.BinToBin:
utils.StatisticalTest

Public Member Functions

def __init__
 
def checkBinningMatches
 
def do_test
 
- Public Member Functions inherited from utils.StatisticalTest
def __init__
 
def do_test
 
def get_rank
 
def get_status
 
def set_operands
 

Public Attributes

 epsilon
 
 name
 
- Public Attributes inherited from utils.StatisticalTest
 h1
 
 h2
 
 is_init
 
 name
 
 rank
 2D! return test_codes["2D"] More...
 
 threshold
 

Detailed Description

The bin to bin comparison builds a fake pvalue. It is 0 if the number of 
bins is different. It is % of corresponding bins otherwhise.
A threshold of 1 is needed to require a 1 to 1 correspondance between 
hisograms.

Definition at line 298 of file utils.py.

Constructor & Destructor Documentation

def utils.BinToBin.__init__ (   self,
  threshold = 1 
)

Definition at line 304 of file utils.py.

305  def __init__(self, threshold=1):
306  StatisticalTest.__init__(self, threshold)
307  self.name='BinToBin'
308  self.epsilon= 0.000001
def __init__
Definition: utils.py:304

Member Function Documentation

def utils.BinToBin.checkBinningMatches (   self)

Definition at line 309 of file utils.py.

References funct.abs(), learn_.epsilon, HcalAutoPedestalValidator.epsilon, HcalPedestalWidthsCheck.epsilon, HcalPedestalsCheck.epsilon, HcalGainsCheck.epsilon, and utils.BinToBin.epsilon.

Referenced by utils.BinToBin.do_test(), and utils.BinToBin1percent.do_test().

310  def checkBinningMatches(self):
311  if self.h1.GetNbinsX() != self.h2.GetNbinsX() \
312  or self.h1.GetNbinsY() != self.h2.GetNbinsY() \
313  or self.h1.GetNbinsZ() != self.h2.GetNbinsZ() \
314  or abs(self.h1.GetXaxis().GetXmin() - self.h2.GetXaxis().GetXmin()) >self.epsilon \
315  or abs(self.h1.GetYaxis().GetXmin() - self.h2.GetYaxis().GetXmin()) >self.epsilon \
316  or abs(self.h1.GetZaxis().GetXmin() - self.h2.GetZaxis().GetXmin()) >self.epsilon \
317  or abs(self.h1.GetXaxis().GetXmax() - self.h2.GetXaxis().GetXmax()) >self.epsilon \
318  or abs(self.h1.GetYaxis().GetXmax() - self.h2.GetYaxis().GetXmax()) >self.epsilon \
319  or abs(self.h1.GetZaxis().GetXmax() - self.h2.GetZaxis().GetXmax()) >self.epsilon:
320  return False
321  return True
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def checkBinningMatches
Definition: utils.py:309
def utils.BinToBin.do_test (   self)

Definition at line 322 of file utils.py.

References funct.abs(), utils.BinToBin.checkBinningMatches(), DQMStore.checkBinningMatches(), learn_.epsilon, HcalAutoPedestalValidator.epsilon, HcalPedestalWidthsCheck.epsilon, HcalPedestalsCheck.epsilon, HcalGainsCheck.epsilon, utils.BinToBin.epsilon, utils.getNbins(), FitSlicesYTool.h1, ConfigurableHisto.h1, DQMSourceExample.h1, utils.StatisticalTest.h1, and PlotAlignmentValidation::DMRPlotInfo.h1.

323  def do_test(self):
324  # fist check that binning matches
325  if not self.checkBinningMatches():
326  return test_codes["DIFF_BIN"]
327  # then do the real check
328  equal = 1
329  nbins = getNbins(self.h1)
330  n_ok_bins=0.0
331  for ibin in xrange(0, nbins+2):
332  h1bin=self.h1.GetBinContent(ibin)
333  h2bin=self.h2.GetBinContent(ibin)
334  bindiff=h1bin-h2bin
335 
336  binavg=.5*(h1bin+h2bin)
337 
338  if binavg==0 or abs(bindiff) < self.epsilon:
339  n_ok_bins+=1
340  #print "Bin %ibin: bindiff %s" %(ibin,bindiff)
341  else:
342  print "Bin %ibin: bindiff %s" %(ibin,bindiff)
343 
344  #if abs(bindiff)!=0 :
345  #print "Bin %ibin: bindiff %s" %(ibin,bindiff)
346 
347  rank=n_ok_bins/nbins
348 
349  if rank!=1:
350  print "Histogram %s differs: nok: %s ntot: %s" %(self.h1.GetName(),n_ok_bins,nbins)
351 
352  return rank
353 
354 #-------------------------------------------------------------------------------
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def getNbins
Definition: utils.py:89
def do_test
Definition: utils.py:322
def checkBinningMatches
Definition: utils.py:309

Member Data Documentation

utils.BinToBin.epsilon

Definition at line 307 of file utils.py.

Referenced by utils.BinToBin.checkBinningMatches(), utils.BinToBin1percent.checkBinningMatches(), and utils.BinToBin.do_test().

utils.BinToBin.name

Definition at line 306 of file utils.py.

Referenced by cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), config.CFG.__str__(), VIDSelectorBase.VIDSelectorBase.initialize(), and Vispa.Views.PropertyView.Property.valueChanged().