Changeset 8047 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 10/11/06 08:55:36 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MH.cc
r7200 r8047 1316 1316 // -------------------------------------------------------------------------- 1317 1317 // 1318 // This is a workaround for rrot-version <5.13/04 to get correct 1319 // binomial errors even if weights have been used, do: 1320 // h->Divide(h1, h2, 5, 2, "b"); 1321 // MH::SetBinomialErrors(*h, *h1, *h2, 5, 2); 1322 // 1323 // see http://root.cern.ch/phpBB2/viewtopic.php?p=14818 1324 // 1325 void MH::SetBinomialErrors(TH1 &hres, const TH1 &h1, const TH1 &h2, Double_t c1, Double_t c2) 1326 { 1327 for (Int_t binx=0; binx<=hres.GetNbinsX()+1; binx++) 1328 { 1329 const Double_t b1 = h1.GetBinContent(binx); 1330 const Double_t b2 = h2.GetBinContent(binx); 1331 const Double_t w = c2*b2 ? (c1*b1)/(c2*b2) : 0; 1332 const Double_t e1 = h2.GetBinError(binx); 1333 const Double_t e2 = h1.GetBinError(binx); 1334 1335 const Double_t rc = ((1-2*w)*e1*e1+w*w*e2*e2)/(b2*b2); 1336 1337 hres.SetBinError(binx, TMath::Sqrt(TMath::Abs(rc))); 1338 } 1339 } 1340 1341 // -------------------------------------------------------------------------- 1342 // 1318 1343 // See MTask::PrintSkipped 1319 1344 // -
trunk/MagicSoft/Mars/mhbase/MH.h
r7173 r8047 76 76 static void SetBinning(TH1 *h, const TH1 *x); 77 77 78 static void SetBinomialErrors(TH1 &hres, const TH1 &h1, const TH1 &h2, Double_t c1=1, Double_t c2=1); 79 78 80 static void RemoveFirstBin(TH1 &h); 79 81
Note:
See TracChangeset
for help on using the changeset viewer.