CMS 3D CMS Logo

Public Member Functions | Public Attributes

utils::StatisticalTest Class Reference

Inheritance diagram for utils::StatisticalTest:
utils::BinToBin utils::BinToBin1percent utils::Chi2 utils::KS

List of all members.

Public Member Functions

def __init__
def do_test
def get_rank
def get_status
def set_operands

Public Attributes

 h1
 h2
 is_init
 name
 rank
 2D! return test_codes["2D"]
 threshold

Detailed Description

Definition at line 102 of file utils.py.


Constructor & Destructor Documentation

def utils::StatisticalTest::__init__ (   self,
  threshold 
)

Reimplemented in utils::KS, utils::Chi2, utils::BinToBin, and utils::BinToBin1percent.

Definition at line 103 of file utils.py.

00104                               :
00105     self.name=""
00106     self.h1=None
00107     self.h2=None
00108     self.threshold=float(threshold)
00109     self.rank=-1
00110     self.is_init=False


Member Function Documentation

def utils::StatisticalTest::do_test (   self)

Reimplemented in utils::KS, utils::Chi2, utils::BinToBin, and utils::BinToBin1percent.

Definition at line 166 of file utils.py.

00167                    :
00168     pass
00169 
00170 #-------------------------------------------------------------------------------

def utils::StatisticalTest::get_rank (   self)

Definition at line 115 of file utils.py.

00116                     :
00117     if not self.is_init:
00118       if self.rank < 0:
00119         type1=type(self.h1)
00120         type2=type(self.h2)
00121         if (type1 != type2):
00122           logger(1,"*** ERROR: object types in comparison don't match: %s!=%s" %(type1,type2))
00123           self.rank=test_codes["DIFF_TYPES"]
00124         elif not self.h2.InheritsFrom("TH1"):
00125           logger(1,"*** ERROR: object type is not histogram but a %s" %(type1))
00126           self.rank=test_codes["NO_HIST"]    
00127         # if histos are empty
00128         #elif self.h1.InheritsFrom("TH2") and not "BinToBin" in self.name:
00129           ## 2D!
00130           #return test_codes["2D"]
00131         else:
00132           is_empty1=is_empty(self.h1)
00133           is_empty2=is_empty(self.h2)
00134           are_empty=is_empty1 and is_empty2
00135           one_empty=is_empty1 or is_empty2
00136 
00137           Nbins1= getNbins(self.h1)
00138           Nbins2= getNbins(self.h2)
00139 
00140           if are_empty:
00141             #return -103
00142             # Conversation with JeanRoch and David 5 April
00143             return 1
00144           elif one_empty:
00145             #return -103
00146             # Conversation with JeanRoch and David 5 April
00147             return 1
00148 
00149           # if histos have different number of bins
00150           if Nbins1!=Nbins2:
00151             return test_codes["DIFF_BIN"]
00152 
00153       self.rank=self.do_test()
00154     self.is_init=True
00155     return self.rank

def utils::StatisticalTest::get_status (   self)

Definition at line 156 of file utils.py.

00157                       :
00158     status = SUCCESS
00159     if self.get_rank()<0:
00160       status=NULL
00161       logger(0,"+++ Test %s FAILED: rank is %s and threshold is %s ==> %s" %(self.name, self.rank, self.threshold, status))  
00162     elif self.get_rank() < self.threshold:
00163       status=FAIL
00164     logger(0,"+++ Test %s: rank is %s and threshold is %s ==> %s" %(self.name, self.rank, self.threshold, status))
00165     return status

def utils::StatisticalTest::set_operands (   self,
  h1,
  h2 
)

Definition at line 111 of file utils.py.

00112                               :
00113     self.h1=h1
00114     self.h2=h2


Member Data Documentation

Definition at line 103 of file utils.py.

Definition at line 103 of file utils.py.

Definition at line 103 of file utils.py.

Reimplemented in utils::KS, utils::Chi2, utils::BinToBin, and utils::BinToBin1percent.

Definition at line 103 of file utils.py.

2D! return test_codes["2D"]

Definition at line 103 of file utils.py.

Definition at line 103 of file utils.py.