本文整理汇总了C++中TH1F::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1F::Clear方法的具体用法?C++ TH1F::Clear怎么用?C++ TH1F::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1F
的用法示例。
在下文中一共展示了TH1F::Clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refill
TH1F* refill(TH1F* hin, const char* sample)
/*
refill histograms, for MC histograms set bin errors to zero.
*/
{
if(hin==0){
std::cout << "hist not found: " << sample << " -- this may happen for samples of type signal." << std::endl;
bool skip = false;
if(std::string(sample).find("ggH")==std::string::npos ){ skip == true; }
if(std::string(sample).find("Zmm")==std::string::npos ){ skip == true; }
if(std::string(sample).find("Zee")==std::string::npos ){ skip == true; }
if(std::string(sample).find("Fakes/QCD")==std::string::npos ){ skip == true; }
if(skip){
std::cout << "hist is not of type signal, Fakes/QCD or Zmm in mumu, Zee in ee, close here" << std::endl;
exit(1);
}
else{
return hin;
}
}
TH1F* hout = (TH1F*)hin->Clone(); hout->Clear();
for(int i=0; i<hout->GetNbinsX(); ++i){
// simple refill, histograms are already devided by bin width
// but for a useful lotting the bin errors for MC need to be
// set to zero.
hout->SetBinContent(i+1, hin->GetBinContent(i+1));
hout->SetBinError(i+1, 0.);
}
return hout;
}
示例2: refill
TH1F* refill(TH1F* hin, const char* sample, bool data=false)
/*
refill histograms, divide by bin width and correct bin errors. For MC histograms set
bin errors to zero.
*/
{
if(hin==0){
std::cout << "hist not found: " << sample << " -- close here" << std::endl;
exit(1);
}
TH1F* hout = (TH1F*)hin->Clone(); hout->Clear();
for(int i=0; i<hout->GetNbinsX(); ++i){
if(data){
#if defined MSSM
hout->SetBinContent(i+1, BLIND_DATA && blinding_MSSM(hin->GetBinCenter(i+1)) ? 0. : hin->GetBinContent(i+1)/hin->GetBinWidth(i+1));
hout->SetBinError (i+1, BLIND_DATA && blinding_MSSM(hin->GetBinCenter(i+1)) ? 0. : hin->GetBinError(i+1)/hin->GetBinWidth(i+1));
#else
hout->SetBinContent(i+1, BLIND_DATA && blinding_SM(hin->GetBinCenter(i+1)) ? 0. : hin->GetBinContent(i+1)/hin->GetBinWidth(i+1));
hout->SetBinError (i+1, BLIND_DATA && blinding_SM(hin->GetBinCenter(i+1)) ? 0. : hin->GetBinError(i+1)/hin->GetBinWidth(i+1));
#endif
}
else{
hout->SetBinContent(i+1, hin->GetBinContent(i+1)/hin->GetBinWidth(i+1));
hout->SetBinError(i+1, 0.);
}
}
return hout;
}
示例3: shape_histos
TH1F* shape_histos(TH1F* hin, const TString datacard, const TString name)
/*
use the proper histograms and errors including shpae uncertainties as provided by combine
*/
{
TH1F* hout = (TH1F*)hin->Clone(); hout->Clear();
TFile* mlfit = new TFile("fitresults/mlfit.root", "READ");
TH1F* shape = (TH1F*)mlfit->Get(TString("shapes_fit_s/").Append(datacard).Append("/").Append(name)); // currently problems with data and hioggsprocesses -> different name
if(shape==0) std::cout << " No histogram found for " << name << std::endl;
// for(int i=0; i<hout->GetNbinsX(); ++i)
for(int i=1; i<hout->GetNbinsX()+1; i++)
{
Float_t Norig = hin->GetBinContent(i)*hin->GetBinWidth(i);
Float_t Nshape = shape->GetBinContent(i);
Float_t scale_err = (Nshape==0) ? 1 : Norig/Nshape;
// hout->SetBinContent(i,shape->GetBinContent(i));
hout->SetBinContent(i,hin->GetBinContent(i)*hin->GetBinWidth(i));
hout->SetBinError(i,shape->GetBinError(i)*scale_err);
}
mlfit->Close();
return hout;
}
示例4: refill
// re-fill histograms (this is only a little helper for the example histogram)
TH1F* refill(TH1F* hin)
{
TH1F* hout = (TH1F*)hin->Clone(); hout->Clear();
for(int i=0; i<hout->GetNbinsX(); ++i){
hout->SetBinContent(i+1, hin->GetBinContent(i+1));
hout->SetBinError (i+1, 0.);
}
return hout;
}
示例5: SetStyle
//.........这里部分代码省略.........
$ERROR_LEGEND
leg->Draw();
//#ifdef MSSM
// TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("(m_{A}=120, tan#beta=10)");
// mssm->Draw();
//#else
// TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("m_{H}=125");
// mssm->Draw();
//#endif
/*
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* zero = (TH1F*)ref->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat");
rat1->Divide(Ztt);
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
zero->SetBinContent(ibin+1, 0.);
}
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+0.5);
rat1->SetMinimum(-0.5);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}");
rat1->Draw();
zero->SetLineColor(kBlack);
zero->Draw("same");
canv0->RedrawAxis();
/*
Ratio After fit over Prefit
*/
TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400);
canv1->SetGridx();
canv1->SetGridy();
canv1->cd();
TH1F* rat2 = (TH1F*) Ztt->Clone("rat2");
rat2->Divide(ref);
for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){
示例6: if
//.........这里部分代码省略.........
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* model;
if(CONSERVATIVE_CHI2){
if(std::string(extra) == std::string("#mu#mu")){
model = (TH1F*)Zmm ->Clone("model");
}
else if(std::string(extra) == std::string("ee")){
model = (TH1F*)Zee ->Clone("model");
}
else if(std::string(extra) == std::string("e#mu") && HWWBG){
model = (TH1F*)ggH_hww ->Clone("model");
}
else{
model = (TH1F*)Ztt ->Clone("model");
}
}
else{
model = (TH1F*)errorBand->Clone("model");
}
TH1F* test1 = (TH1F*)data->Clone("test1");
for(int ibin=0; ibin<test1->GetNbinsX(); ++ibin){
//the small value in case of 0 entries in the model is added to prevent the chis2 test from failing
model->SetBinContent(ibin+1, model->GetBinContent(ibin+1)>0 ? model->GetBinContent(ibin+1)*model->GetBinWidth(ibin+1) : 0.01);
model->SetBinError (ibin+1, CONSERVATIVE_CHI2 ? 0. : model->GetBinError (ibin+1)*model->GetBinWidth(ibin+1));
test1->SetBinContent(ibin+1, test1->GetBinContent(ibin+1)*test1->GetBinWidth(ibin+1));
test1->SetBinError (ibin+1, test1->GetBinError (ibin+1)*test1->GetBinWidth(ibin+1));
}
double chi2prob = test1->Chi2Test (model,"PUW"); std::cout << "chi2prob:" << chi2prob << std::endl;
double chi2ndof = test1->Chi2Test (model,"CHI2/NDFUW"); std::cout << "chi2ndf :" << chi2ndof << std::endl;
double ksprob = test1->KolmogorovTest(model); std::cout << "ksprob :" << ksprob << std::endl;
double ksprobpe = test1->KolmogorovTest(model,"DX"); std::cout << "ksprobpe:" << ksprobpe << std::endl;
std::vector<double> edges;
TH1F* zero = (TH1F*)Ztt->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat");
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
rat1->SetBinContent(ibin+1, errorBand->GetBinContent(ibin+1)>0 ? data->GetBinContent(ibin+1)/errorBand->GetBinContent(ibin+1) : 0);
rat1->SetBinError (ibin+1, errorBand->GetBinContent(ibin+1)>0 ? data->GetBinError (ibin+1)/errorBand->GetBinContent(ibin+1) : 0);
zero->SetBinContent(ibin+1, 0.);
zero->SetBinError (ibin+1, errorBand->GetBinContent(ibin+1)>0 ? errorBand ->GetBinError (ibin+1)/errorBand->GetBinContent(ibin+1) : 0);
}
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
edges.push_back(TMath::Abs(rat1->GetBinContent(ibin+1)-1.)+TMath::Abs(rat1->GetBinError(ibin+1)));
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
zero->SetBinContent(ibin+1, 0.);
}
float range = 0.1;
std::sort(edges.begin(), edges.end());
if (edges[edges.size()-2]>0.1) { range = 0.2; }
if (edges[edges.size()-2]>0.2) { range = 0.5; }
if (edges[edges.size()-2]>0.5) { range = 1.0; }
if (edges[edges.size()-2]>1.0) { range = 1.5; }
if (edges[edges.size()-2]>1.5) { range = 2.0; }
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+range);
rat1->SetMinimum(-range);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
if((std::string(extra) == std::string("#mu#mu") || std::string(extra) == std::string("ee")) && !MSSM){
rat1->GetXaxis()->SetTitle("#bf{D}");
}
else{
rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}");
}
rat1->Draw();
zero->SetFillStyle( 3013);
zero->SetFillColor(kBlack);
zero->SetLineColor(kBlack);
zero->SetMarkerSize(0.1);
zero->Draw("e2histsame");
canv0->RedrawAxis();
TPaveText* stat1 = new TPaveText(0.20, 0.76+0.061, 0.32, 0.76+0.161, "NDC");
stat1->SetBorderSize( 0 );
stat1->SetFillStyle( 0 );
stat1->SetTextAlign( 12 );
stat1->SetTextSize ( 0.05 );
stat1->SetTextColor( 1 );
stat1->SetTextFont ( 62 );
stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f", chi2ndof, chi2prob));
//stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f, P(KS)=%.3f", chi2ndof, chi2prob, ksprob));
stat1->Draw();
/*
prepare output
*/
newName = std::string(inputfile).substr(0, std::string(inputfile).find(".root")) + "_datamc";
canv0->Print(TString::Format("%s.png", newName.c_str()));
canv0->Print(TString::Format("%s.pdf", newName.c_str()));
canv0->Print(TString::Format("%s.eps", newName.c_str()));
}
示例7: SetStyle
//.........这里部分代码省略.........
$ERROR_LEGEND
leg->Draw();
//#ifdef MSSM
// TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("(m_{A}=250, tan#beta=5)");
// mssm->Draw();
//#else
// TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("m_{H}=125");
// mssm->Draw();
//#endif
/*
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat");
rat1->Divide(Bbb);
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
zero->SetBinContent(ibin+1, 0.);
}
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+1.5);
rat1->SetMinimum(-1.5);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
rat1->GetXaxis()->SetTitle("#bf{m_{b#bar{b}} [GeV]}");
rat1->Draw();
zero->SetLineColor(kBlack);
zero->Draw("same");
canv0->RedrawAxis();
/*
Ratio After fit over Prefit
*/
TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400);
canv1->SetGridx();
canv1->SetGridy();
canv1->cd();
TH1F* rat2 = (TH1F*) Bbb->Clone("rat2");
rat2->Divide(ref);
for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){
示例8: SetStyle
//.........这里部分代码省略.........
leg->AddEntry(data , "Observed" , "LP");
#endif
leg->AddEntry(Ztt , "Z#rightarrow#tau#tau" , "F" );
leg->AddEntry(EWK , "Z#rightarrow ee" , "F" );
leg->AddEntry(EWK1 , "W+jets" , "F" );
leg->AddEntry(ttbar, "t#bar{t}" , "F" );
leg->AddEntry(Fakes, "QCD" , "F" );
$ERROR_LEGEND
leg->Draw();
/*
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* model = (TH1F*)Ztt ->Clone("model");
TH1F* test1 = (TH1F*)data->Clone("test1");
for(int ibin=0; ibin<test1->GetNbinsX(); ++ibin){
//the small value in case of 0 entries in the model is added to prevent the chis2 test from failing
model->SetBinContent(ibin+1, model->GetBinContent(ibin+1)>0 ? model->GetBinContent(ibin+1)*model->GetBinWidth(ibin+1) : 0.01);
model->SetBinError (ibin+1, CONVERVATIVE_CHI2 ? 0. : model->GetBinError (ibin+1)*model->GetBinWidth(ibin+1));
test1->SetBinContent(ibin+1, test1->GetBinContent(ibin+1)*test1->GetBinWidth(ibin+1));
test1->SetBinError (ibin+1, test1->GetBinError (ibin+1)*test1->GetBinWidth(ibin+1));
}
double chi2prob = test1->Chi2Test (model,"PUW"); std::cout << "chi2prob:" << chi2prob << std::endl;
double chi2ndof = test1->Chi2Test (model,"CHI2/NDFUW"); std::cout << "chi2ndf :" << chi2ndof << std::endl;
double ksprob = test1->KolmogorovTest(model); std::cout << "ksprob :" << ksprob << std::endl;
double ksprobpe = test1->KolmogorovTest(model,"DX"); std::cout << "ksprobpe:" << ksprobpe << std::endl;
std::vector<double> edges;
TH1F* zero = (TH1F*)ref->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat1");
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
rat1->SetBinContent(ibin+1, Ztt->GetBinContent(ibin+1)>0 ? data->GetBinContent(ibin+1)/Ztt->GetBinContent(ibin+1) : 0);
rat1->SetBinError (ibin+1, Ztt->GetBinContent(ibin+1)>0 ? data->GetBinError (ibin+1)/Ztt->GetBinContent(ibin+1) : 0);
zero->SetBinContent(ibin+1, 0.);
zero->SetBinError (ibin+1, Ztt->GetBinContent(ibin+1)>0 ? Ztt ->GetBinError (ibin+1)/Ztt->GetBinContent(ibin+1) : 0);
}
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
edges.push_back(TMath::Abs(rat1->GetBinContent(ibin+1)-1.)+TMath::Abs(rat1->GetBinError(ibin+1)));
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
}
float range = 0.1;
std::sort(edges.begin(), edges.end());
if (edges[edges.size()-2]>0.1) { range = 0.2; }
if (edges[edges.size()-2]>0.2) { range = 0.5; }
if (edges[edges.size()-2]>0.5) { range = 1.0; }
if (edges[edges.size()-2]>1.0) { range = 1.5; }
if (edges[edges.size()-2]>1.5) { range = 2.0; }
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+range);
rat1->SetMinimum(-range);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}");
rat1->Draw();
zero->SetFillStyle( 3013);
zero->SetFillColor(kBlack);
zero->SetLineColor(kBlack);
示例9: SetStyle
//.........这里部分代码省略.........
#endif
leg->AddEntry(ZEE , "Z#rightarrowee" , "F" );
leg->AddEntry(ZTT , "Z#rightarrow#tau#tau" , "F" );
leg->AddEntry(TTJ , "t#bar{t}" , "F" );
leg->AddEntry(QCD , "QCD" , "F" );
leg->AddEntry(WJets, "electroweak" , "F" );
//leg->AddEntry(Dibosons , "Dibosons" , "F" );
$ERROR_LEGEND
leg->Draw();
/*
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* model = (TH1F*)ZEE ->Clone("model");
TH1F* test1 = (TH1F*)data->Clone("test1");
for(int ibin=0; ibin<test1->GetNbinsX(); ++ibin){
//the small value in case of 0 entries in the model is added to prevent the chis2 test from failing
model->SetBinContent(ibin+1, model->GetBinContent(ibin+1)>0 ? model->GetBinContent(ibin+1)*model->GetBinWidth(ibin+1) : 0.01);
model->SetBinError (ibin+1, CONVERVATIVE_CHI2 ? 0. : model->GetBinError (ibin+1)*model->GetBinWidth(ibin+1));
test1->SetBinContent(ibin+1, test1->GetBinContent(ibin+1)*test1->GetBinWidth(ibin+1));
test1->SetBinError (ibin+1, test1->GetBinError (ibin+1)*test1->GetBinWidth(ibin+1));
}
double chi2prob = test1->Chi2Test (model,"PUW"); std::cout << "chi2prob:" << chi2prob << std::endl;
double chi2ndof = test1->Chi2Test (model,"CHI2/NDFUW"); std::cout << "chi2ndf :" << chi2ndof << std::endl;
double ksprob = test1->KolmogorovTest(model); std::cout << "ksprob :" << ksprob << std::endl;
double ksprobpe = test1->KolmogorovTest(model,"DX"); std::cout << "ksprobpe:" << ksprobpe << std::endl;
std::vector<double> edges;
TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat1");
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
rat1->SetBinContent(ibin+1, ZEE->GetBinContent(ibin+1)>0 ? data->GetBinContent(ibin+1)/ZEE->GetBinContent(ibin+1) : 0);
rat1->SetBinError (ibin+1, ZEE->GetBinContent(ibin+1)>0 ? data->GetBinError (ibin+1)/ZEE->GetBinContent(ibin+1) : 0);
zero->SetBinContent(ibin+1, 0.);
zero->SetBinError (ibin+1, ZEE->GetBinContent(ibin+1)>0 ? ZEE ->GetBinError (ibin+1)/ZEE->GetBinContent(ibin+1) : 0);
}
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
edges.push_back(TMath::Abs(rat1->GetBinContent(ibin+1)-1.)+TMath::Abs(rat1->GetBinError(ibin+1)));
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
}
float range = 0.1;
std::sort(edges.begin(), edges.end());
if (edges[edges.size()-2]>0.1) { range = 0.2; }
if (edges[edges.size()-2]>0.2) { range = 0.5; }
if (edges[edges.size()-2]>0.5) { range = 1.0; }
if (edges[edges.size()-2]>1.0) { range = 1.5; }
if (edges[edges.size()-2]>1.5) { range = 2.0; }
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+range);
rat1->SetMinimum(-range);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
#ifdef MSSM
rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}");
#else
rat1->GetXaxis()->SetTitle("#bf{D}");
#endif
示例10: SetStyle
//.........这里部分代码省略.........
$ERROR_LEGEND
leg->Draw();
//#ifdef MSSM
// TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("(m_{A}=250, tan#beta=5)");
// mssm->Draw();
//#else
// TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC");
// mssm->SetBorderSize( 0 );
// mssm->SetFillStyle( 0 );
// mssm->SetTextAlign( 12 );
// mssm->SetTextSize ( 0.03 );
// mssm->SetTextColor( 1 );
// mssm->SetTextFont ( 62 );
// mssm->AddText("m_{H}=125");
// mssm->Draw();
//#endif
/*
Ratio Data over MC
*/
TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400);
canv0->SetGridx();
canv0->SetGridy();
canv0->cd();
TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear();
TH1F* rat1 = (TH1F*)data->Clone("rat");
rat1->Divide(bkgBBB);
for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){
if(rat1->GetBinContent(ibin+1)>0){
// catch cases of 0 bins, which would lead to 0-alpha*0-1
rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.);
}
zero->SetBinContent(ibin+1, 0.);
}
rat1->SetLineColor(kBlack);
rat1->SetFillColor(kGray );
rat1->SetMaximum(+1.5);
rat1->SetMinimum(-1.5);
rat1->GetYaxis()->CenterTitle();
rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}");
rat1->GetXaxis()->SetTitle("#bf{m_{b#bar{b}} [GeV]}");
rat1->Draw();
zero->SetLineColor(kBlack);
zero->Draw("same");
canv0->RedrawAxis();
/*
Ratio After fit over Prefit
*/
TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400);
canv1->SetGridx();
canv1->SetGridy();
canv1->cd();
TH1F* rat2 = (TH1F*) bkgBBB->Clone("rat2");
rat2->Divide(ref);
for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){