ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C (file contents):
Revision 1.13 by buchmann, Fri Jun 8 14:28:07 2012 UTC vs.
Revision 1.14 by buchmann, Mon Jun 18 12:22:43 2012 UTC

# Line 1334 | Line 1334 | void save_with_ratio(TH1F *nominator, TH
1334  
1335  
1336    TGraphAsymmErrors *eratio;
1337 <  TGraphAsymmErrors *sysratio;
1337 >  TH1F *SystDown;
1338 >  TH1F *SystUp;
1339 >  
1340    if(!do_bpred_ratio) eratio = produce_ratio_graph(ratio);
1341    else {
1342       bool using_data=false;
1343       if((int)savemeas.find("Data")>0) using_data=true;
1344       eratio = histRatio(nominator,denominator,using_data,PlottingSetup::global_ratio_binning,false);
1345       if(syshisto!=0) {
1346 <       sysratio = SysAndStatRatio(nominator,denominator,syshisto,using_data,PlottingSetup::global_ratio_binning,false);
1347 <       sysratio->SetFillColor(TColor::GetColor("#006DE1"));
1346 >       SystDown = (TH1F*)syshisto->Clone("SystDown");
1347 >       SystUp = (TH1F*)syshisto->Clone("SystUp");
1348 >       for(int i=1;i<=syshisto->GetNbinsX();i++) {
1349 >         SystDown->SetBinContent(i,1-syshisto->GetBinContent(i));
1350 >         SystUp->SetBinContent(i,1+syshisto->GetBinContent(i));
1351 >       }
1352 >       SystDown->SetLineColor(TColor::GetColor("#006DE1"));
1353 >       SystUp->SetLineColor(TColor::GetColor("#006DE1"));
1354       }
1355       for(int i=1;i<=ratio->GetNbinsX();i++) {
1356          ratio->SetBinContent(i,0);
# Line 1375 | Line 1383 | void save_with_ratio(TH1F *nominator, TH
1383   //    sysratio->Draw("2");
1384   //    eratio->Draw("2,same");
1385      eratio->Draw("2");
1386 +    SystDown->Draw("histo,same");
1387 +    SystUp->Draw("histo,same");
1388    } else {
1389      eratio->Draw("2");
1390    }
# Line 1560 | Line 1570 | void process_directory(TString directory
1570                  perror ("Couldn't open the directory");
1571   }
1572  
1573 < void ClearHisto(TH1F *histo) {
1573 > void ClearHisto(TH1* histo) {
1574      for(int ix=0;ix<=histo->GetNbinsX()+1;ix++) {//also reset over- and underflow
1575          histo->SetBinContent(ix,0);
1576          histo->SetBinContent(ix,0);
# Line 1568 | Line 1578 | void ClearHisto(TH1F *histo) {
1578   }
1579  
1580   void AddSquared(TH1F *histo, TH1F *addthis, float weight) {
1581 <    for(int ix=0;ix<=histo->GetNbinsX()+1;ix++) {//also include over- and underflow
1582 <        histo->SetBinContent(ix,histo->GetBinContent(ix)+(addthis->GetBinContent(ix))*(addthis->GetBinContent(ix))*weight);
1581 >    for(int ix=1;ix<=addthis->GetNbinsX()+1;ix++) {//also include over- and underflow
1582 >        float bincenter=addthis->GetBinCenter(ix);
1583 >        int nBinHisto= histo->FindBin(bincenter);
1584 >        float old_content=histo->GetBinContent(nBinHisto);
1585 >        histo->SetBinContent(nBinHisto,old_content+((addthis->GetBinContent(ix))*(addthis->GetBinContent(ix))*weight));
1586      }
1587   }
1588  
1589 < void SQRT(TH1F *histo) {
1589 > void SQRT(TH1* histo) {
1590      for(int ix=0;ix<=histo->GetNbinsX()+1;ix++) {//also include over- and underflow
1591          histo->SetBinContent(ix,TMath::Sqrt(histo->GetBinContent(ix)));
1592      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines