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 301 of file utils.py.

Constructor & Destructor Documentation

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

Definition at line 307 of file utils.py.

308  def __init__(self, threshold=1):
309  StatisticalTest.__init__(self, threshold)
310  self.name='BinToBin'
311  self.epsilon= 0.000001
def __init__
Definition: utils.py:307

Member Function Documentation

def utils.BinToBin.checkBinningMatches (   self)

Definition at line 312 of file utils.py.

References abs, learn_.epsilon, HcalAutoPedestalValidator.epsilon, HcalPedestalsCheck.epsilon, HcalPedestalWidthsCheck.epsilon, HcalGainsCheck.epsilon, EcalRawToRecHitRoI::MuJobPSet.epsilon, EcalRawToRecHitRoI::JetJobPSet.epsilon, EcalRawToRecHitRoI::CandJobPSet.epsilon, and utils.BinToBin.epsilon.

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

313  def checkBinningMatches(self):
314  if self.h1.GetNbinsX() != self.h2.GetNbinsX() \
315  or self.h1.GetNbinsY() != self.h2.GetNbinsY() \
316  or self.h1.GetNbinsZ() != self.h2.GetNbinsZ() \
317  or abs(self.h1.GetXaxis().GetXmin() - self.h2.GetXaxis().GetXmin()) >self.epsilon \
318  or abs(self.h1.GetYaxis().GetXmin() - self.h2.GetYaxis().GetXmin()) >self.epsilon \
319  or abs(self.h1.GetZaxis().GetXmin() - self.h2.GetZaxis().GetXmin()) >self.epsilon \
320  or abs(self.h1.GetXaxis().GetXmax() - self.h2.GetXaxis().GetXmax()) >self.epsilon \
321  or abs(self.h1.GetYaxis().GetXmax() - self.h2.GetYaxis().GetXmax()) >self.epsilon \
322  or abs(self.h1.GetZaxis().GetXmax() - self.h2.GetZaxis().GetXmax()) >self.epsilon:
323  return False
324  return True
#define abs(x)
Definition: mlp_lapack.h:159
def checkBinningMatches
Definition: utils.py:312
def utils.BinToBin.do_test (   self)

Definition at line 325 of file utils.py.

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

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

Member Data Documentation

utils.BinToBin.epsilon

Definition at line 310 of file utils.py.

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

utils.BinToBin.name

Definition at line 309 of file utils.py.

Referenced by dataset.Dataset.__getFileInfoList(), cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), BeautifulSoup.Tag._invert(), and Vispa.Views.PropertyView.Property.valueChanged().