Functions | |
| TH1F * | TH1FLogX (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh) |
| TH1D * | TH1DLogX (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh) |
| TProfile * | TProfileLogX (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh) |
| TH2F * | TH2FLogXLogY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH2F * | TH2FLogXLinY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH2F * | TH2FLinXLogY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH2D * | TH2DLogXLogY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH2D * | TH2DLogXLinY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH2D * | TH2DLinXLogY (const char *Name, const char *Title, int NBinsX, double XLow, double XHigh, int NBinsY, double YLow, double YHigh) |
| TH1 * | FOMCutLow (const TH1 *hSig, const TH1 *hBG, const int iter) |
| TH1 * | FOMCutHigh (const TH1 *hSig, const TH1 *hBG, const int iter) |
| TH2 * | FOMCut2DHighXandHighY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DHighXorHighY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DLowXandHighY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DLowXorHighY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DHighXandLowY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DHighXorLowY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DLowXandLowY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| TH2 * | FOMCut2DLowXorLowY (const TH2 *hSig, const TH2 *hBG, const int iter) |
| int | HistMatch (const TH3 *H1, const TH3 *H2) |
| int | HistMatch (const TH2 *H1, const TH2 *H2) |
| int | HistMatch (const TH1 *H1, const TH1 *H2) |
| double | HMin (const TH1 *hist, double min, bool IncErr) |
| double | HMax (const TH1 *hist, double max, bool IncErr) |
| double | HMin (const std::vector< TH1 * > &hists, double min, bool IncErr) |
| double | HMax (const std::vector< TH1 * > &hists, double max, bool IncErr) |
| double | FullIntegral (const TH3 *hist, double *IntErrSq) |
| double | FullIntegral (const TH3 *hist, int ibinx1, int ibinx2, int ibiny1, int ibiny2, int ibinz1, int ibinz2, double *IntErrSq) |
| double | FullIntegral (const TH2 *hist, double *IntErrSq) |
| double | FullIntegral (const TH2 *hist, int ibinx1, int ibinx2, int ibiny1, int ibiny2, double *IntErrSq) |
| double | FullIntegral (const TH1 *hist, double *IntErrSq) |
| double | FullIntegral (const TH1 *hist, int ibinx1, int ibinx2, double *IntErrSq) |
| void | FullAdd (TH1 *h1, TH1 *h2, double SF, double ErrSqSF) |
| void | FullScale (TH1 *h1, double SF, double ErrSqSF) |
| int | SumEff (double Eff1, double SigmaEff1, double Eff2, double SigmaEff2, double &EffC, double &SigmaEffC) |
| double | Round (double value, unsigned int digit) |
| TH1 * | HistAdd (TH1 *h1, TH1 *h2, const char *hname, bool BinErrors) |
| TH1 * | HistAdd (vector< TH1 * > hvec, const char *hname, bool BinErrors) |
| double | HMin (const vector< TH1 * > &hists, double min=-DBL_MAX, bool IncErr=true) |
| double | HMax (const vector< TH1 * > &hists, double max=DBL_MAX, bool IncErr=true) |
|
||||||||||||||||
|
Definition at line 291 of file UtilHist.cxx. References Form(), and HistMatch(). 00293 {
00294 if(HistMatch(hSig, hBG) != 0) return 0;
00295
00296 TH2 *FOMOut = dynamic_cast<TH2*>
00297 (hSig->Clone(Form("FOMCut2DHighXandHighY%d%s", iter, hSig->GetName())));
00298 FOMOut->SetLineColor(kBlack);
00299 FOMOut->GetZaxis()->SetTitle("FOM");
00300 FOMOut->SetBit(TH1::kCanRebin, false);
00301 FOMOut->Reset("ICE");
00302
00303 int NBinsX = hSig->GetNbinsX();
00304 int NBinsY = hSig->GetNbinsY();
00305
00306 double NSig(0.), NBG(0.);
00307
00308 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00309 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00310 NSig = hSig->Integral(0, ibinx, 0, ibiny);
00311 NBG = hBG->Integral(0, ibinx, 0, ibiny);
00312
00313 if(NSig <= 0.) continue;
00314 else if (NBG <= 0.) {
00315 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00316 FOMOut->SetBinError(ibinx, ibiny, 0.);
00317 }
00318 else {
00319 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00320 }
00321 }
00322 }
00323
00324 return(FOMOut);
00325 }
|
|
||||||||||||||||
|
Definition at line 439 of file UtilHist.cxx. References Form(), and HistMatch(). 00441 {
00442 if(HistMatch(hSig, hBG) != 0) return 0;
00443
00444 TH2 *FOMOut = dynamic_cast<TH2*>
00445 (hSig->Clone(Form("FOMCut2DHighXandLowY%d%s", iter, hSig->GetName())));
00446 FOMOut->SetLineColor(kBlack);
00447 FOMOut->GetZaxis()->SetTitle("FOM");
00448 FOMOut->SetBit(TH1::kCanRebin, false);
00449 FOMOut->Reset("ICE");
00450
00451 int NBinsX = hSig->GetNbinsX();
00452 int NBinsY = hSig->GetNbinsY();
00453
00454 double NSig(0.), NBG(0.);
00455
00456 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00457 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00458 NSig = hSig->Integral(0, ibinx, ibiny, NBinsY+1);
00459 NBG = hBG->Integral(0, ibinx, ibiny, NBinsY+1);
00460
00461 if(NSig <= 0.) continue;
00462 else if (NBG <= 0.) {
00463 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00464 FOMOut->SetBinError(ibinx, ibiny, 0.);
00465 }
00466 else {
00467 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00468 }
00469 }
00470 }
00471 return(FOMOut);
00472 }
|
|
||||||||||||||||
|
Definition at line 327 of file UtilHist.cxx. References Form(), FullIntegral(), and HistMatch(). 00329 {
00330 if(HistMatch(hSig, hBG) != 0) return 0;
00331
00332 TH2 *FOMOut = dynamic_cast<TH2*>
00333 (hSig->Clone(Form("FOMCut2DHighXorHighY%d%s", iter, hSig->GetName())));
00334 FOMOut->SetLineColor(kBlack);
00335 FOMOut->GetZaxis()->SetTitle("FOM");
00336 FOMOut->SetBit(TH1::kCanRebin, false);
00337 FOMOut->Reset("ICE");
00338
00339 double NSigFull = FullIntegral(hSig);
00340 double NBGFull = FullIntegral(hBG);
00341
00342 int NBinsX = hSig->GetNbinsX();
00343 int NBinsY = hSig->GetNbinsY();
00344
00345 double NSig(0.), NBG(0.);
00346
00347 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00348 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00349 NSig = NSigFull - hSig->Integral(ibinx, NBinsX+1, ibiny, NBinsY+1);
00350 NBG = NBGFull - hBG->Integral(ibinx, NBinsX+1, ibiny, NBinsY+1);
00351
00352 if(NSig <= 0.) continue;
00353 else if (NBG <= 0.) {
00354 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00355 FOMOut->SetBinError(ibinx, ibiny, 0.);
00356 }
00357 else {
00358 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00359 }
00360 }
00361 }
00362
00363 return(FOMOut);
00364 }
|
|
||||||||||||||||
|
Definition at line 474 of file UtilHist.cxx. References Form(), FullIntegral(), and HistMatch(). 00476 {
00477 if(HistMatch(hSig, hBG) != 0) return 0;
00478
00479 TH2 *FOMOut = dynamic_cast<TH2*>
00480 (hSig->Clone(Form("FOMCut2DHighXorLowY%d%s", iter, hSig->GetName())));
00481 FOMOut->SetLineColor(kBlack);
00482 FOMOut->GetZaxis()->SetTitle("FOM");
00483 FOMOut->SetBit(TH1::kCanRebin, false);
00484 FOMOut->Reset("ICE");
00485
00486 double NSigFull = FullIntegral(hSig);
00487 double NBGFull = FullIntegral(hBG);
00488
00489 int NBinsX = hSig->GetNbinsX();
00490 int NBinsY = hSig->GetNbinsY();
00491
00492 double NSig(0.), NBG(0.);
00493
00494 for (int ibinx=0; ibinx<NBinsX+1; ibinx++) {
00495 for (int ibiny=0; ibiny<NBinsY+1; ibiny++) {
00496 NSig = NSigFull - hSig->Integral(ibinx, NBinsX+1, 0, ibiny);
00497 NBG = NBGFull - hBG->Integral(ibinx, NBinsX+1, 0, ibiny);
00498
00499 if(NSig <= 0.) continue;
00500 else if (NBG <= 0.) {
00501 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00502 FOMOut->SetBinError(ibinx, ibiny, 0.);
00503 }
00504 else {
00505 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00506 }
00507 }
00508 }
00509 return(FOMOut);
00510 }
|
|
||||||||||||||||
|
Definition at line 366 of file UtilHist.cxx. References Form(), and HistMatch(). 00368 {
00369 if(HistMatch(hSig, hBG) != 0) return 0;
00370
00371 TH2 *FOMOut = dynamic_cast<TH2*>
00372 (hSig->Clone(Form("FOMCut2DLowXandHighY%d%s", iter, hSig->GetName())));
00373 FOMOut->SetLineColor(kBlack);
00374 FOMOut->GetZaxis()->SetTitle("FOM");
00375 FOMOut->SetBit(TH1::kCanRebin, false);
00376 FOMOut->Reset("ICE");
00377
00378 int NBinsX = hSig->GetNbinsX();
00379 int NBinsY = hSig->GetNbinsY();
00380
00381 double NSig(0.), NBG(0.);
00382
00383 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00384 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00385 NSig = hSig->Integral(ibinx, NBinsX+1, 0, ibiny);
00386 NBG = hBG->Integral(ibinx, NBinsX+1, 0, ibiny);
00387
00388 if(NSig <= 0.) continue;
00389 else if (NBG <= 0.) {
00390 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00391 FOMOut->SetBinError(ibinx, ibiny, 0.);
00392 }
00393 else {
00394 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00395 }
00396 }
00397 }
00398 return(FOMOut);
00399 }
|
|
||||||||||||||||
|
Definition at line 512 of file UtilHist.cxx. References Form(), and HistMatch(). 00514 {
00515 if(HistMatch(hSig, hBG) != 0) return 0;
00516
00517 TH2 *FOMOut = dynamic_cast<TH2*>
00518 (hSig->Clone(Form("FOMCut2DLowXandLowY%d%s", iter, hSig->GetName())));
00519 FOMOut->SetLineColor(kBlack);
00520 FOMOut->GetZaxis()->SetTitle("FOM");
00521 FOMOut->SetTitle("FOM for a LowX and LowY Cut");
00522 FOMOut->SetBit(TH1::kCanRebin, false);
00523 FOMOut->Reset("ICE");
00524
00525 int NBinsX = hSig->GetNbinsX();
00526 int NBinsY = hSig->GetNbinsY();
00527
00528 double NSig(0.), NBG(0.);
00529
00530 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00531 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00532 NSig = hSig->Integral(ibinx, NBinsX+1, ibiny, NBinsY+1);
00533 NBG = hBG->Integral(ibinx, NBinsX+1, ibiny, NBinsY+1);
00534
00535 if(NSig <= 0.) continue;
00536 else if (NBG <= 0.) {
00537 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00538 FOMOut->SetBinError(ibinx, ibiny, 0.);
00539 }
00540 else {
00541 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00542 }
00543 }
00544 }
00545
00546 return FOMOut;
00547 }
|
|
||||||||||||||||
|
Definition at line 401 of file UtilHist.cxx. References Form(), FullIntegral(), and HistMatch(). 00403 {
00404 if(HistMatch(hSig, hBG) != 0) return 0;
00405
00406 TH2 *FOMOut = dynamic_cast<TH2*>
00407 (hSig->Clone(Form("FOMCut2DLowXorHighY%d%s", iter, hSig->GetName())));
00408 FOMOut->SetLineColor(kBlack);
00409 FOMOut->GetZaxis()->SetTitle("FOM");
00410 FOMOut->SetBit(TH1::kCanRebin, false);
00411 FOMOut->Reset("ICE");
00412
00413 double NSigFull = FullIntegral(hSig);
00414 double NBGFull = FullIntegral(hBG);
00415
00416 int NBinsX = hSig->GetNbinsX();
00417 int NBinsY = hSig->GetNbinsY();
00418
00419 double NSig(0.), NBG(0.);
00420
00421 for (int ibinx=0; ibinx<NBinsX+1; ibinx++) {
00422 for (int ibiny=0; ibiny<NBinsY+1; ibiny++) {
00423 NSig = NSigFull - hSig->Integral(0, ibinx, ibiny, NBinsY+1);
00424 NBG = NBGFull - hBG->Integral(0, ibinx, ibiny, NBinsY+1);
00425
00426 if(NSig <= 0.) continue;
00427 else if (NBG <= 0.) {
00428 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00429 FOMOut->SetBinError(ibinx, ibiny, 0.);
00430 }
00431 else {
00432 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00433 }
00434 }
00435 }
00436 return(FOMOut);
00437 }
|
|
||||||||||||||||
|
Definition at line 549 of file UtilHist.cxx. References Form(), FullIntegral(), and HistMatch(). 00551 {
00552 if(HistMatch(hSig, hBG) != 0) return 0;
00553
00554 TH2 *FOMOut = dynamic_cast<TH2*>
00555 (hSig->Clone(Form("FOMCut2DLowXorLowY%d%s", iter, hSig->GetName())));
00556 FOMOut->SetLineColor(kBlack);
00557 FOMOut->GetZaxis()->SetTitle("FOM");
00558 FOMOut->SetTitle("FOM for a LowX or LowY Cut");
00559 FOMOut->SetBit(TH1::kCanRebin, false);
00560 FOMOut->Reset("ICE");
00561
00562 int NBinsX = hSig->GetNbinsX();
00563 int NBinsY = hSig->GetNbinsY();
00564
00565 double NSig(0.), NBG(0.);
00566 double NSigFull = FullIntegral(hSig);
00567 double NBGFull = FullIntegral(hBG);
00568
00569 for (int ibinx=0; ibinx<=NBinsX+1; ibinx++) {
00570 for (int ibiny=0; ibiny<=NBinsY+1; ibiny++) {
00571 NSig = NSigFull - hSig->Integral(0, ibinx, 0 , ibiny);
00572 NBG = NBGFull - hBG->Integral(0, ibinx, 0, ibiny);
00573
00574 if(NSig <= 0.) continue;
00575 else if (NBG <= 0.) {
00576 FOMOut->SetBinContent(ibinx, ibiny, 0.);
00577 FOMOut->SetBinError(ibinx, ibiny, 0.);
00578 }
00579 else {
00580 FOMOut->SetBinContent(ibinx, ibiny, NSig/sqrt(NBG));
00581 }
00582 }
00583 }
00584
00585 return FOMOut;
00586 }
|
|
||||||||||||||||
|
Definition at line 252 of file UtilHist.cxx. References Form(), and HistMatch(). 00253 {
00254 if(HistMatch(hSig, hBG) != 0) return 0;
00255
00256 TH1 *FOMOut = dynamic_cast<TH1*>
00257 (hSig->Clone(Form("FOMCutHigh%d%s", iter, hSig->GetName())));
00258 FOMOut->SetLineColor(kBlack);
00259 FOMOut->GetYaxis()->SetTitle("FOM High Cut");
00260 FOMOut->SetBit(TH1::kCanRebin, false);
00261 FOMOut->Reset("ICE");
00262
00263 //Start with the underflow bin
00264 double NSig = hSig->GetBinContent(0);
00265 double NSigErrSq = hSig->GetBinError(0) * hSig->GetBinError(0);
00266 double NBG = hBG->GetBinContent(0);
00267 double NBGErrSq = hBG->GetBinError(0) * hBG->GetBinError(0);
00268 for (int ibinx=1; ibinx<hSig->GetNbinsX()+1; ibinx++) {
00269 NSig += hSig->GetBinContent(ibinx);
00270 NSigErrSq += hSig->GetBinError(ibinx) * hSig->GetBinError(ibinx);
00271 NBG += hBG->GetBinContent(ibinx);
00272 NBGErrSq += hBG->GetBinError(ibinx) * hBG->GetBinError(ibinx);
00273 if(NSig <= 0) continue;
00274 else if (NBG <= 0) {
00275 FOMOut->SetBinContent(ibinx, -0.);
00276 FOMOut->SetBinError(ibinx, -0.);
00277 }
00278 else {
00279 FOMOut->SetBinContent(ibinx, NSig/sqrt(NBG));
00280 FOMOut->SetBinError(ibinx, (NSig/((NSig+NBG)*(NSig+NBG))) *
00281 TMath::Sqrt((NSig+2*NBG)*(NSig+2*NBG)*NSigErrSq +
00282 NSig*NSig*NBGErrSq));
00283 }
00284 }
00285
00286 return(FOMOut);
00287 }
|
|
||||||||||||||||
|
Definition at line 210 of file UtilHist.cxx. References Form(), HistMatch(), and NBins. 00211 {
00212 if(HistMatch(hSig, hBG) != 0) return 0;
00213
00214 Int_t NBins = hSig->GetNbinsX();
00215
00216 TH1 *FOMOut = dynamic_cast<TH1*>
00217 (hSig->Clone(Form("FOMCutLow%d%s", iter, hSig->GetName())));
00218 FOMOut->SetLineColor(kBlack);
00219 FOMOut->GetYaxis()->SetTitle("FOM Low Cut");
00220 FOMOut->SetBit(TH1::kCanRebin, false);
00221 FOMOut->Reset("ICE");
00222
00223 //Start with the overflow bin
00224 double NSig = hSig->GetBinContent(NBins+1);
00225 double NSigErrSq = hSig->GetBinError(NBins+1) * hSig->GetBinError(NBins+1);
00226 double NBG = hBG->GetBinContent(NBins+1);
00227 double NBGErrSq = hBG->GetBinError(NBins+1) * hBG->GetBinError(NBins+1);
00228 for (int ibinx=NBins; ibinx>0; ibinx--) {
00229 NSig += hSig->GetBinContent(ibinx);
00230 NSigErrSq += hSig->GetBinError(ibinx) * hSig->GetBinError(ibinx);
00231 NBG += hBG->GetBinContent(ibinx);
00232 NBGErrSq += hBG->GetBinError(ibinx) * hBG->GetBinError(ibinx);
00233 if(NSig <= 0) continue;
00234 else if (NBG <= 0) {
00235 FOMOut->SetBinContent(ibinx, -0.);
00236 FOMOut->SetBinError(ibinx, -0.);
00237 }
00238 else {
00239 FOMOut->SetBinContent(ibinx, NSig/sqrt(NBG));
00240 //Fix This line
00241 FOMOut->SetBinError(ibinx, (NSig/((NSig+NBG)*(NSig+NBG))) *
00242 TMath::Sqrt((NSig+2*NBG)*(NSig+2*NBG)*NSigErrSq +
00243 NSig*NSig*NBGErrSq));
00244 }
00245 }
00246
00247 return(FOMOut);
00248 }
|
|
||||||||||||||||||||
|
Definition at line 781 of file UtilHist.cxx. References HistMatch(), and NBins. 00782 {
00783 if(HistMatch(h1, h2) != 0) return;
00784
00785 if(h1->GetSumw2N() == 0) h1->Sumw2();
00786 if(h2->GetSumw2N() == 0) h2->Sumw2();
00787
00788 TArrayD *h1sw2 = h1->GetSumw2();
00789 TArrayD *h2sw2 = h2->GetSumw2();
00790
00791 int NBins = h1->GetNbinsX();
00792 double b1(0.), b2(0.), e1(0.), e2(0.);
00793 for (int i=0; i<NBins; i++) {
00794 b1 = h1->GetBinContent(i);
00795 b2 = h2->GetBinContent(i);
00796 h1->SetBinContent(i, b1 + SF*b2);
00797
00798 e1 = h1sw2->fArray[i];
00799 e2 = h2sw2->fArray[i];
00800 h1sw2->fArray[i] = e1 + b2*b2*ErrSqSF + SF*SF*e2;
00801 }
00802 }
|
|
||||||||||||||||||||
|
Definition at line 765 of file UtilHist.cxx. Referenced by FOMCut2DHighXorHighY(), FOMCut2DHighXorLowY(), FOMCut2DLowXorHighY(), FOMCut2DLowXorLowY(), and FullIntegral(). 00767 {
00768 if(!hist) return(0.);
00769 if(IntErrSq) *IntErrSq = 0.;
00770 double Integral(0.);
00771 for (int ibinx=ibinx1; ibinx<=ibinx2; ibinx++) {
00772 Integral += hist->GetBinContent(ibinx);
00773 if(IntErrSq) *IntErrSq += hist->GetBinError(ibinx) *
00774 hist->GetBinError(ibinx);
00775 }
00776 return(Integral);
00777 }
|
|
||||||||||||
|
Definition at line 736 of file UtilHist.cxx. 00737 {
00738 if(!hist) return(0.);
00739
00740 if(IntErrSq) *IntErrSq = 0.;
00741
00742 int NBinsX = hist->GetNbinsX();
00743 int StartBinX(1), EndBinX(NBinsX);
00744 if(NBinsX>1) {StartBinX=0; EndBinX=NBinsX+1;}
00745
00746 int NBinsY = hist->GetNbinsY();
00747 int StartBinY(1), EndBinY(NBinsY);
00748 if(NBinsY>1) {StartBinY=0; EndBinY=NBinsY+1;}
00749
00750 int NBinsZ = hist->GetNbinsZ();
00751 int StartBinZ(1), EndBinZ(NBinsZ);
00752 if(NBinsZ>1) {StartBinZ=0; EndBinZ=NBinsZ+1;}
00753
00754 double Integral(0.);
00755 for (int ibinx=StartBinX; ibinx<=EndBinX; ibinx++)
00756 for (int ibiny=StartBinY; ibiny<=EndBinY; ibiny++)
00757 for (int ibinz=StartBinZ; ibinz<=EndBinZ; ibinz++) {
00758 Integral += hist->GetBinContent(ibinx, ibiny, ibinz);
00759 if(IntErrSq) *IntErrSq += hist->GetBinError(ibinx, ibiny, ibinz) *
00760 hist->GetBinError(ibinx, ibiny, ibinz);
00761 }
00762 return(Integral);
00763 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 718 of file UtilHist.cxx. 00721 {
00722 if(!hist) return(0.);
00723 if(IntErrSq) *IntErrSq = 0.;
00724 double Integral(0.);
00725 for (int ibinx=ibinx1; ibinx<=ibinx2; ibinx++)
00726 for (int ibiny=ibiny1; ibiny<=ibiny2; ibiny++) {
00727 Integral += hist->GetBinContent(ibinx, ibiny);
00728 if(IntErrSq) *IntErrSq += hist->GetBinError(ibinx, ibiny) *
00729 hist->GetBinError(ibinx, ibiny);
00730 }
00731 return(Integral);
00732 }
|
|
||||||||||||
|
Definition at line 713 of file UtilHist.cxx. References FullIntegral(). 00714 {
00715 return(FullIntegral(dynamic_cast<const TH1*>(hist), IntErrSq));
00716 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 695 of file UtilHist.cxx. 00699 {
00700 if(!hist) return(0.);
00701 if(IntErrSq) *IntErrSq = 0.;
00702 double Integral(0.);
00703 for (int ibinx=ibinx1; ibinx<=ibinx2; ibinx++)
00704 for (int ibiny=ibiny1; ibiny<=ibiny2; ibiny++)
00705 for (int ibinz=ibinz1; ibinz<=ibinz2; ibinz++) {
00706 Integral += hist->GetBinContent(ibinx, ibiny, ibinz);
00707 if(IntErrSq) *IntErrSq += hist->GetBinError(ibinx, ibiny, ibinz) *
00708 hist->GetBinError(ibinx, ibiny, ibinz);
00709 }
00710 return(Integral);
00711 }
|
|
||||||||||||
|
Definition at line 690 of file UtilHist.cxx. References FullIntegral(). 00691 {
00692 return(FullIntegral(dynamic_cast<const TH1*>(hist), IntErrSq));
00693 }
|
|
||||||||||||||||
|
Definition at line 806 of file UtilHist.cxx. References NBins. 00807 {
00808 if(h1->GetSumw2N() == 0) h1->Sumw2();
00809 TArrayD *h1sw2 = h1->GetSumw2();
00810
00811 int NBins = h1->GetNbinsX();
00812 double b1(0.), e1(0.);
00813 for (int i=0; i<NBins; i++) {
00814 b1 = h1->GetBinContent(i);
00815 h1->SetBinContent(i, SF*b1);
00816
00817 e1 = h1sw2->fArray[i];
00818 h1sw2->fArray[i] = b1*b1*ErrSqSF + SF*SF*e1;
00819 }
00820 }
|
|
||||||||||||||||
|
Definition at line 870 of file UtilHist.cxx. References MaxX, MinX, UtilMath::sameValue(), and SumEff(). Referenced by HistAdd(). 00871 {
00872 if(hvec.size() == 0) return 0;
00873
00874 double MinX = hvec[0]->GetBinLowEdge(1);
00875 double MaxX = hvec[0]->GetBinLowEdge(hvec[0]->GetNbinsX() + 1);
00876 double BinWidthX = hvec[0]->GetBinWidth(1);
00877
00878 for (unsigned int ihist=0; ihist<hvec.size(); ihist++) {
00879 TH1 *h1 = hvec[ihist];
00880
00881 //Only one dimensional (for now)
00882 if(h1->GetDimension() != 1) return 0;
00883
00884 if(h1->GetBinLowEdge(1) < MinX) MinX = h1->GetBinLowEdge(1);
00885 if(h1->GetBinLowEdge(h1->GetNbinsX()+1) > MaxX)
00886 MaxX = h1->GetBinLowEdge(h1->GetNbinsX()+1);
00887
00888 for(int ibinx=1; ibinx<=h1->GetNbinsX(); ibinx++)
00889 if(h1->GetBinWidth(ibinx) < BinWidthX)
00890 BinWidthX = h1->GetBinWidth(ibinx);
00891 }
00892
00893 //Create the outgoing histogram
00894 double DBinsX = (MaxX-MinX)/BinWidthX;
00895 if (!UtilMath::sameValue(UtilHist::Round(DBinsX), DBinsX)) {
00896 MaxX = MinX + ceil(DBinsX) * BinWidthX;
00897 }
00898 TH1F *hreturn = new TH1F(hname, "", (int)DBinsX, MinX, MaxX);
00899
00900 for (unsigned int ihist=0; ihist<hvec.size(); ihist++) {
00901 TH1 *h1 = hvec[ihist];
00902
00903 //Make the errors array
00904 if(h1->GetSumw2N() == 0) h1->Sumw2();
00905
00906 //iterate over the x bins (skip over and underflow bins)
00907 for (int ibinx=1; ibinx<=h1->GetNbinsX(); ibinx++) {
00908 double tBinWidth = h1->GetBinWidth(ibinx);
00909 double XLow = h1->GetBinLowEdge(ibinx);
00910 double XHigh = XLow + h1->GetBinWidth(ibinx);
00911
00912 double BinCon = h1->GetBinContent(ibinx);
00913 double BinErr = h1->GetBinError(ibinx);
00914
00915 int LowBin = hreturn->FindBin(XLow + 0.001*h1->GetBinWidth(ibinx));
00916 int HighBin = hreturn->FindBin(XHigh - 0.001*h1->GetBinWidth(ibinx));
00917
00918 //If the Low and HighBins are same, easy
00919 if (LowBin == HighBin) {
00920 double hretCon = hreturn->GetBinContent(LowBin);
00921 double hretErr = hreturn->GetBinError(LowBin);
00922 if (BinErrors) {
00923 double OutCon(0), OutErr(0);
00924 UtilHist::SumEff(hretCon, hretErr, BinCon, BinErr, OutCon,
00925 OutErr);
00926 hreturn->SetBinContent(LowBin, OutCon);
00927 hreturn->SetBinError(LowBin, OutErr);
00928 }
00929 else {
00930 hreturn->SetBinContent(LowBin, hretCon + BinCon);
00931 hreturn->SetBinError(LowBin,
00932 sqrt(hretErr*hretErr + BinErr*BinErr));
00933 }
00934 continue;
00935 }
00936 else {
00937 for (int jbinx=LowBin; jbinx<=HighBin; jbinx++) {
00938 double hretCon = hreturn->GetBinContent(jbinx);
00939 double hretErr = hreturn->GetBinError(jbinx);
00940
00941 double XLowEdge = TMath::Max(
00942 hreturn->GetBinLowEdge(jbinx), h1->GetBinLowEdge(ibinx));
00943 double XHighEdge = TMath::Min(
00944 hreturn->GetBinLowEdge(jbinx)+hreturn->GetBinWidth(jbinx),
00945 h1->GetBinLowEdge(ibinx)+h1->GetBinWidth(ibinx));
00946 double RBin = (XHighEdge - XLowEdge)/tBinWidth;
00947
00948 if (BinErrors) {
00949 double OutCon(0), OutErr(0);
00950 UtilHist::SumEff(hretCon, hretErr, BinCon, BinErr/sqrt(RBin),
00951 OutCon, OutErr);
00952 hreturn->SetBinContent(LowBin, OutCon);
00953 hreturn->SetBinError(LowBin, OutErr);
00954 }
00955 else {
00956 hreturn->SetBinContent(jbinx, hretCon + RBin*BinCon);
00957 hreturn->SetBinError(jbinx,
00958 sqrt(hretErr*hretErr + RBin*BinErr*BinErr));
00959 }
00960 }
00961 }
00962 }
00963 }
00964
00965 return hreturn;
00966 }
|
|
||||||||||||||||||||
|
Definition at line 859 of file UtilHist.cxx. References HistAdd(). 00860 {
00861 if(!h1 || !h2) return 0;
00862
00863 vector<TH1*> hvec;
00864 hvec.push_back(h1);
00865 hvec.push_back(h2);
00866
00867 return HistAdd(hvec, hname, BinErrors);
00868 }
|
|
||||||||||||
|
Definition at line 598 of file UtilHist.cxx. Referenced by FOMCut2DHighXandHighY(), FOMCut2DHighXandLowY(), FOMCut2DHighXorHighY(), FOMCut2DHighXorLowY(), FOMCut2DLowXandHighY(), FOMCut2DLowXandLowY(), FOMCut2DLowXorHighY(), FOMCut2DLowXorLowY(), FOMCutHigh(), FOMCutLow(), FullAdd(), and HistMatch(). 00599 {
00600 // Make sure two histograms match for comparison
00601 // writes detailed warnings to cout if there's a problem.
00602 // Status flag:
00603 // 0 = OK
00604 // 1 = One or both of the histograms do not exist
00605 // 2 = Different histogram types
00606 // 3 = Different number of bins
00607 // 4 = Different axes ranges
00608 // 5 = One of both of the histograms has no entries
00609 //
00610
00611 //One or both histograms do not exist
00612 if(!H1 || !H2) return(1);
00613
00614 TClass* cl1 = H1->Class();
00615 TClass* cl2 = H2->Class();
00616 //Different types of histogram
00617 if(!(cl1->InheritsFrom(cl2)) || !(cl2->InheritsFrom(cl1))) return(2);
00618
00619 //Different number of bins in each histogram
00620 if((H1->GetNbinsX() != H2->GetNbinsX()) ||
00621 (H1->GetNbinsY()!=H2->GetNbinsY()) ||
00622 (H1->GetNbinsZ()!=H2->GetNbinsZ()) ) return(3);
00623
00624 //Histogram range mis-match
00625 if((H1->GetXaxis()->GetXmin() != H2->GetXaxis()->GetXmin()) ||
00626 (H1->GetXaxis()->GetXmax() != H2->GetXaxis()->GetXmax()) ||
00627 (H1->GetYaxis()->GetXmin() != H2->GetYaxis()->GetXmin()) ||
00628 (H1->GetYaxis()->GetXmax() != H2->GetYaxis()->GetXmax()) ||
00629 (H1->GetZaxis()->GetXmin() != H2->GetZaxis()->GetXmin()) ||
00630 (H1->GetZaxis()->GetXmax() != H2->GetZaxis()->GetXmax()))
00631 return(4);
00632
00633 //One or both of the histograms are empty
00634 if(H1->GetEntries() <= 0. || H2->GetEntries() <= 0.) return(5);
00635
00636 //Checks out
00637 return 0;
00638 }
|
|
||||||||||||
|
Definition at line 593 of file UtilHist.cxx. References HistMatch(). 00594 {
00595 return(HistMatch(dynamic_cast<const TH1*>(H1), dynamic_cast<const TH1*>(H2)));
00596 }
|
|
||||||||||||
|
Definition at line 588 of file UtilHist.cxx. References HistMatch(). 00589 {
00590 return(HistMatch(dynamic_cast<const TH1*>(H1), dynamic_cast<const TH1*>(H2)));
00591 }
|
|
||||||||||||||||
|
Referenced by HMax(). |
|
||||||||||||||||
|
Definition at line 679 of file UtilHist.cxx. 00680 {
00681 if(hists.size() == 0) return(max);
00682 double lmax = -DBL_MAX;
00683 for (unsigned int i=0; i<hists.size(); i++) {
00684 double llmax = HMax(hists[i], max, IncErr);
00685 if(llmax > lmax) lmax = llmax;
00686 }
00687 return lmax;
00688 }
|
|
||||||||||||||||
|
Definition at line 656 of file UtilHist.cxx. Referenced by UtilCanvas::FixPad(). 00657 {
00658 if(!hist) return(max);
00659 double lmax = -DBL_MAX;
00660 for (int i=1; i<=hist->GetNbinsX(); i++) {
00661 double bcon = hist->GetBinContent(i);
00662 if(IncErr) bcon += hist->GetBinError(i);
00663 if(bcon > lmax && bcon < max) lmax = bcon;
00664 }
00665 return lmax;
00666 }
|
|
||||||||||||||||
|
Referenced by HMin(). |
|
||||||||||||||||
|
Definition at line 668 of file UtilHist.cxx. 00669 {
00670 if(hists.size() == 0) return(min);
00671 double lmin = DBL_MAX;
00672 for (unsigned int i=0; i<hists.size(); i++) {
00673 double llmin = HMin(hists[i], min, IncErr);
00674 if(llmin < lmin) lmin = llmin;
00675 }
00676 return lmin;
00677 }
|
|
||||||||||||||||
|
Definition at line 642 of file UtilHist.cxx. References UtilMath::sameValue(). Referenced by UtilCanvas::FixPad(). 00643 {
00644 if(!hist) return(min);
00645 double lmin = DBL_MAX;
00646 for (int i=1; i<=hist->GetNbinsX(); i++) {
00647 double bcon = hist->GetBinContent(i);
00648 if(! UtilMath::sameValue(hist->GetBinContent(i),
00649 hist->GetBinError(i)) && IncErr)
00650 bcon -= hist->GetBinError(i);
00651 if(bcon < lmin && bcon > min) lmin = bcon;
00652 }
00653 return lmin;
00654 }
|
|
||||||||||||
|
Definition at line 854 of file UtilHist.cxx. References digit(). 00855 {
00856 return floor((value*pow(10.0,digit)) + 0.5) / pow(10.0, digit);
00857 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 822 of file UtilHist.cxx. References UtilMath::sameValue(). Referenced by HistAdd(). 00824 {
00825 if(Eff1 < 0.0 || Eff1 > 1.0) return 1;
00826 if(Eff2 < 0.0 || Eff2 > 1.0) return 1;
00827
00828 //Crappy approximation for 1 or 0 effs
00829 if (UtilMath::sameValue(Eff1, 0.0) ||
00830 UtilMath::sameValue(Eff1, 1.0)) {
00831 EffC = Eff2;
00832 SigmaEffC = SigmaEff2;
00833 }
00834 else if (UtilMath::sameValue(Eff2, 0.0) ||
00835 UtilMath::sameValue(Eff2, 1.0)) {
00836 EffC = Eff1;
00837 SigmaEffC = SigmaEff1;
00838 }
00839 else {
00840 EffC =
00841 ((Eff1*Eff1*(1.0-Eff1)*SigmaEff2*SigmaEff2) +
00842 (Eff2*Eff2*(1.0-Eff2)*SigmaEff1*SigmaEff1)) /
00843 ((Eff1*(1.0-Eff1)*SigmaEff2*SigmaEff2) +
00844 (Eff2*(1.0-Eff2)*SigmaEff1*SigmaEff1));
00845
00846 SigmaEffC = sqrt(EffC * (1.0-EffC) /
00847 ((Eff1*(1.0-Eff1)/(SigmaEff1*SigmaEff1)) +
00848 (Eff2*(1.0-Eff2)/(SigmaEff2*SigmaEff2))) );
00849 }
00850
00851 return 0;
00852 }
|
|
||||||||||||||||||||||||
|
Definition at line 38 of file UtilHist.cxx. 00040 {
00041 double *XBins;
00042 XBins = new double[NBinsX+1];
00043
00044 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00045
00046 for (int i=0; i<=NBinsX; i++) {
00047 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00048 }
00049
00050 TH1D *htemp = new TH1D(Name, Title, NBinsX, XBins);
00051
00052 delete [] XBins;
00053 return htemp;
00054 }
|
|
||||||||||||||||||||||||
|
Definition at line 20 of file UtilHist.cxx. 00022 {
00023 double *XBins;
00024 XBins = new double[NBinsX+1];
00025
00026 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00027
00028 for (int i=0; i<=NBinsX; i++) {
00029 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00030 }
00031
00032 TH1F *htemp = new TH1F(Name, Title, NBinsX, XBins);
00033
00034 delete [] XBins;
00035 return htemp;
00036 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 189 of file UtilHist.cxx. 00192 {
00193 double *YBins;
00194 YBins = new double[NBinsY+1];
00195
00196 double YBinW = (TMath::Log10(YHigh)-TMath::Log10(YLow))/NBinsY;
00197
00198 for (int i=0; i<=NBinsY; i++) {
00199 YBins[i]=YLow*TMath::Power(10., (i*YBinW));
00200 }
00201
00202 TH2D *htemp = new TH2D(Name, Title, NBinsX, XLow, XHigh, NBinsY, YBins);
00203
00204 delete [] YBins;
00205 return htemp;
00206 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 170 of file UtilHist.cxx. 00173 {
00174 double *XBins;
00175 XBins = new double[NBinsX+1];
00176
00177 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00178
00179 for (int i=0; i<=NBinsX; i++) {
00180 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00181 }
00182
00183 TH2D *htemp = new TH2D(Name, Title, NBinsX, XBins, NBinsY, YLow, YHigh);
00184
00185 delete [] XBins;
00186 return htemp;
00187 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 141 of file UtilHist.cxx. 00144 {
00145 double *XBins;
00146 XBins = new double[NBinsX+1];
00147
00148 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00149
00150 for (int i=0; i<=NBinsX; i++) {
00151 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00152 }
00153
00154 double *YBins;
00155 YBins = new double[NBinsY+1];
00156
00157 double YBinW = (TMath::Log10(YHigh)-TMath::Log10(YLow))/NBinsY;
00158
00159 for (int i=0; i<=NBinsY; i++) {
00160 YBins[i]=YLow*TMath::Power(10., (i*YBinW));
00161 }
00162
00163 TH2D *htemp = new TH2D(Name, Title, NBinsX, XBins, NBinsY, YBins);
00164
00165 delete [] XBins;
00166 delete [] YBins;
00167 return htemp;
00168 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 122 of file UtilHist.cxx. 00125 {
00126 double *YBins;
00127 YBins = new double[NBinsY+1];
00128
00129 double YBinW = (TMath::Log10(YHigh)-TMath::Log10(YLow))/NBinsY;
00130
00131 for (int i=0; i<=NBinsY; i++) {
00132 YBins[i]=YLow*TMath::Power(10., (i*YBinW));
00133 }
00134
00135 TH2F *htemp = new TH2F(Name, Title, NBinsX, XLow, XHigh, NBinsY, YBins);
00136
00137 delete [] YBins;
00138 return htemp;
00139 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 103 of file UtilHist.cxx. 00106 {
00107 double *XBins;
00108 XBins = new double[NBinsX+1];
00109
00110 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00111
00112 for (int i=0; i<=NBinsX; i++) {
00113 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00114 }
00115
00116 TH2F *htemp = new TH2F(Name, Title, NBinsX, XBins, NBinsY, YLow, YHigh);
00117
00118 delete [] XBins;
00119 return htemp;
00120 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 74 of file UtilHist.cxx. 00077 {
00078 double *XBins;
00079 XBins = new double[NBinsX+1];
00080
00081 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00082
00083 for (int i=0; i<=NBinsX; i++) {
00084 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00085 }
00086
00087 double *YBins;
00088 YBins = new double[NBinsY+1];
00089
00090 double YBinW = (TMath::Log10(YHigh)-TMath::Log10(YLow))/NBinsY;
00091
00092 for (int i=0; i<=NBinsY; i++) {
00093 YBins[i]=YLow*TMath::Power(10., (i*YBinW));
00094 }
00095
00096 TH2F *htemp = new TH2F(Name, Title, NBinsX, XBins, NBinsY, YBins);
00097
00098 delete [] XBins;
00099 delete [] YBins;
00100 return htemp;
00101 }
|
|
||||||||||||||||||||||||
|
Definition at line 56 of file UtilHist.cxx. 00058 {
00059 double *XBins;
00060 XBins = new double[NBinsX+1];
00061
00062 double XBinW = (TMath::Log10(XHigh)-TMath::Log10(XLow))/NBinsX;
00063
00064 for (int i=0; i<=NBinsX; i++) {
00065 XBins[i]=XLow*TMath::Power(10., (i*XBinW));
00066 }
00067
00068 TProfile *htemp = new TProfile(Name, Title, NBinsX, XBins);
00069
00070 delete [] XBins;
00071 return htemp;
00072 }
|
1.3.9.1