本文整理汇总了C++中THStack::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ THStack::Clear方法的具体用法?C++ THStack::Clear怎么用?C++ THStack::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THStack
的用法示例。
在下文中一共展示了THStack::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stack_upgrade_42X
//.........这里部分代码省略.........
h_1d[iHist][iFile]->SetLineWidth(0);
h_1d[iHist][iFile]->SetFillStyle(3244);
if(iFile == 1){ h_1d[iHist][iFile]->SetFillColor(ZZ_Color); }
else if(iFile == 2){ h_1d[iHist][iFile]->SetFillColor(WZ_Color); }
else if(iFile == 3){ h_1d[iHist][iFile]->SetFillColor(TTbar_Color); }
else if(iFile == 4){ h_1d[iHist][iFile]->SetFillColor(Zjet_Color); }
else if(iFile == 5){
signal[iHist]->Add(h_1d[iHist][iFile+1]);
signal[iHist]->SetLineColor(kRed);
signal[iHist]->SetLineWidth(2.0);
}
if(iFile < 5) hs->Add(h_1d[iHist][iFile],"hist");
}
//hs->Add(signal[iHist],"hist");
h_1d[iHist][0]->SetMarkerStyle(21);
h_1d[iHist][0]->SetMarkerSize(0.7);
TLegend* leg = new TLegend(0.65,0.70,0.88,0.88,NULL,"brNDC");
leg->SetFillColor(0);
leg->SetTextSize(0.035);
leg->SetBorderSize(0);
leg->AddEntry(h_1d[iHist][0],"data 2011","p");
leg->AddEntry(h_1d[iHist][1],"ZZ","f");
leg->AddEntry(h_1d[iHist][2],"WZ","f");
leg->AddEntry(h_1d[iHist][3],"t#bar{t}","f");
leg->AddEntry(h_1d[iHist][4],"Zjet","f");
leg->AddEntry(signal[iHist],"ZH(120)#times 5","f");
TString lumist="4.9 fb^{-1}";
TPaveText *ll = new TPaveText(0.25, 0.95, 0.95, 0.99, "NDC");
ll->SetTextSize(0.03);
ll->SetTextFont(62);
ll->SetFillColor(0);
ll->SetBorderSize(0);
ll->SetMargin(0.01);
ll->SetTextAlign(12); // align left
TString text = PaveText[iHist];
ll->AddText(0.01,0.5,text);
text = "#sqrt{s} = 7 TeV L = ";
text = text + lumist;
// ll->SetTextAlign(32); // align right
ll->AddText(0.5, 0.5, text);
/*double max_dy = h_1d[iHist][4]->GetMaximum();
double max_data = h_1d[iHist][0]->GetMaximum();
double max = 0;
if (max_dy > max_data){
max = max_dy;}
else {
max = max_data;}
if (max != 0) hs->SetMaximum(max);
cout << "max data: " << max_data << endl;
cout << "max dy: " << max_dy << endl;
*/
h_1d[iHist][0]->Draw("PE01");
double max = h_1d[iHist][0]->GetMaximum();
h_1d[iHist][0]->GetYaxis()->SetRangeUser(1e-2,200*max);
// if(iHist > 0 && iHist < 4) h_1d[iHist][0]->GetXaxis()->SetRangeUser(0,150);
h_1d[iHist][0]->GetXaxis()->SetTitle(histTitles[iHist]);
hs->Draw("same");
signal[iHist]->Scale(10.);
signal[iHist]->Draw("histsame");
h_1d[iHist][0]->Draw("samePE01");
leg->Draw("same");
ll->Draw("same");
gPad->RedrawAxis();
c1->SetLogy();
c1->Print("NewCuts/Mu_"+histNames1[iHist]+"_all.png");
c1->Print("NewCuts/Mu_"+histNames1[iHist]+"_all.eps");
c1->SetLogy(0);
h_1d[iHist][0]->GetYaxis()->SetRangeUser(0,1.5*max);
c1->Print("NewCuts/Mu_"+histNames1[iHist]+"_all_normal.png");
c1->Print("NewCuts/Mu_"+histNames1[iHist]+"_all_normal.eps");
leg->Clear();
hs->Clear();
}
return 0;
}