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.BinToBin1percent Class Reference
Inheritance diagram for utils.BinToBin1percent:
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
 
 tolerance
 
- 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 358 of file utils.py.

Constructor & Destructor Documentation

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

Definition at line 364 of file utils.py.

365  def __init__(self, threshold=1):
366  StatisticalTest.__init__(self, threshold)
367  self.name='BinToBin1percent'
368  self.epsilon= 0.000001
369  self.tolerance= 0.01

Member Function Documentation

def utils.BinToBin1percent.checkBinningMatches (   self)

Definition at line 370 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, utils.BinToBin.epsilon, and utils.BinToBin1percent.epsilon.

Referenced by utils.BinToBin1percent.do_test().

371  def checkBinningMatches(self):
372  if self.h1.GetNbinsX() != self.h2.GetNbinsX() \
373  or self.h1.GetNbinsY() != self.h2.GetNbinsY() \
374  or self.h1.GetNbinsZ() != self.h2.GetNbinsZ() \
375  or abs(self.h1.GetXaxis().GetXmin() - self.h2.GetXaxis().GetXmin()) >self.epsilon \
376  or abs(self.h1.GetYaxis().GetXmin() - self.h2.GetYaxis().GetXmin()) >self.epsilon \
377  or abs(self.h1.GetZaxis().GetXmin() - self.h2.GetZaxis().GetXmin()) >self.epsilon \
378  or abs(self.h1.GetXaxis().GetXmax() - self.h2.GetXaxis().GetXmax()) >self.epsilon \
379  or abs(self.h1.GetYaxis().GetXmax() - self.h2.GetYaxis().GetXmax()) >self.epsilon \
380  or abs(self.h1.GetZaxis().GetXmax() - self.h2.GetZaxis().GetXmax()) >self.epsilon:
381  return False
382  return True
#define abs(x)
Definition: mlp_lapack.h:159
def utils.BinToBin1percent.do_test (   self)

Definition at line 383 of file utils.py.

References abs, utils.BinToBin.checkBinningMatches(), utils.BinToBin1percent.checkBinningMatches(), DQMStore.checkBinningMatches(), utils.getNbins(), FitSlicesYTool.h1, ConfigurableHisto.h1, XmasToDQMSource.h1, DQMSourceExample.h1, utils.StatisticalTest.h1, PlotAlignmentValidation::DMRPlotInfo.h1, MuonGeometrySanityCheck.tolerance, and utils.BinToBin1percent.tolerance.

384  def do_test(self):
385  # fist check that binning matches
386  if not self.checkBinningMatches():
387  return test_codes["DIFF_BIN"]
388  # then do the real check
389  equal = 1
390  nbins = getNbins(self.h1)
391  n_ok_bins=0.0
392  for ibin in xrange(0,nbins):
393  ibin+=1
394  h1bin=self.h1.GetBinContent(ibin)
395  h2bin=self.h2.GetBinContent(ibin)
396  bindiff=h1bin-h2bin
397 
398  binavg=.5*(h1bin+h2bin)
399 
400  if binavg==0 or 100*abs(bindiff)/binavg < self.tolerance:
401  n_ok_bins+=1
402  #print "Bin %i bin: bindiff %s" %(ibin,bindiff)
403  else:
404  print "-->Bin %i bin: bindiff %s (%s - %s )" %(ibin,bindiff,h1bin,h2bin)
405 
406  #if abs(bindiff)!=0 :
407  #print "Bin %ibin: bindiff %s" %(ibin,bindiff)
408 
409  rank=n_ok_bins/nbins
410 
411  if rank!=1:
412  print "%s nok: %s ntot: %s" %(self.h1.GetName(),n_ok_bins,nbins)
413 
414  return rank
415 #-------------------------------------------------------------------------------
416 Statistical_Tests={"KS":KS,
417  "Chi2":Chi2,
418  "BinToBin":BinToBin,
419  "BinToBin1percent":BinToBin1percent,
420  "Bin2Bin":BinToBin,
421  "b2b":BinToBin,}
422 #-------------------------------------------------------------------------------
#define abs(x)
Definition: mlp_lapack.h:159
def getNbins
Definition: utils.py:92

Member Data Documentation

utils.BinToBin1percent.epsilon

Definition at line 367 of file utils.py.

Referenced by utils.BinToBin1percent.checkBinningMatches().

utils.BinToBin1percent.name

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

utils.BinToBin1percent.tolerance

Definition at line 368 of file utils.py.

Referenced by utils.BinToBin1percent.do_test().