List of all members.
Detailed Description
Definition at line 238 of file utils.py.
Constructor & Destructor Documentation
def utils::Chi2::__init__ |
( |
|
self, |
|
|
|
threshold |
|
) |
| |
Member Function Documentation
def utils::Chi2::absval |
( |
|
self | ) |
|
Definition at line 254 of file utils.py.
00255 :
00256 nbins=getNbins(self.h1)
00257 binc=0
00258 for i in xrange(1,nbins):
00259 for h in self.h1,self.h2:
00260 binc=h.GetBinContent(i)
00261 if binc<0:
00262 h.SetBinContent(i,-1*binc)
00263 if h.GetBinError(i)==0 and binc!=0:
00264
00265 h.SetBinContent(i,0)
def utils::Chi2::check_filled_bins |
( |
|
self, |
|
|
|
min_filled |
|
) |
| |
Definition at line 243 of file utils.py.
00244 :
00245 nbins=self.h1.GetNbinsX()
00246 n_filled_l=[]
00247 for h in self.h1,self.h2:
00248 nfilled=0.
00249 for ibin in xrange(1,nbins+1):
00250 if h.GetBinContent(ibin)>0:
00251 nfilled+=1
00252 n_filled_l.append(nfilled)
00253 return len(filter (lambda x:x>=min_filled,n_filled_l) )>0
def utils::Chi2::check_histograms |
( |
|
self, |
|
|
|
histogram |
|
) |
| |
Definition at line 266 of file utils.py.
00267 :
00268 if histogram.InheritsFrom("TProfile") or (histogram.GetEntries()!=histogram.GetSumOfWeights()):
00269 return 'W'
00270 else:
00271 return 'U'
def utils::Chi2::do_test |
( |
|
self | ) |
|
Reimplemented from utils::StatisticalTest.
Definition at line 272 of file utils.py.
00273 :
00274 self.absval()
00275 if self.check_filled_bins(3):
00276
00277
00278
00279
00280
00281
00282 hist1 = self.check_histograms(self.h1)
00283 hist2 = self.check_histograms(self.h2)
00284 if hist1 =='W' and hist2 =='W':
00285 chi2 = self.h1.Chi2Test(self.h2,'WW')
00286 return chi2
00287 elif hist1 == 'U' and hist2 == 'U':
00288 chi2 = self.h1.Chi2Test(self.h2,'UU')
00289 return chi2
00290 elif hist1 == 'U' and hist2 == 'W':
00291 chi2 = self.h1.Chi2Test(self.h2,'UW')
00292 return chi2
00293 elif hist1 == 'W' and hist2 == 'U':
00294 chi2 = self.h2.Chi2Test(self.h1,'UW')
00295 return chi2
00296 else:
00297 return 1
00298
00299
00300
Member Data Documentation