本文整理汇总了C++中TPad::GetNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ TPad::GetNumber方法的具体用法?C++ TPad::GetNumber怎么用?C++ TPad::GetNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPad
的用法示例。
在下文中一共展示了TPad::GetNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
TCanvas *drawRatioPlot(TH1D *prediction, TH1D *sr, TH1D *data, TString xTitle, TString filename, double ecaloCut){
gStyle -> SetPadLeftMargin(0.20);
data->SetMarkerStyle(20);
data->SetMarkerColor(kGreen);
data->SetLineColor(kGreen);
TCanvas *c = new TCanvas("c"+filename,"c",0,0,500,500);
float y = 0.3;
TPad *pad1 = new TPad("pad1", "Control Plots 1", 0.01, y, 0.99, 0.99);
TPad *padRatio = new TPad("rp1", "Ratio1", 0.01, 0.01, 0.99, y-0.01);
pad1->SetNumber(100);
pad1->SetTicks(0,1);
cout<<"number pad1 = "<<pad1->GetNumber()<<endl;
cout<<"number padRatio = "<<padRatio->GetNumber()<<endl;
TH1D *ratio = 0;
//ratio = (TH1D*) sr->Clone();
//ratio->Divide(prediction);
ratio = (TH1D*) prediction->Clone();
ratio->Divide(data);
for(int i=1; i<=ratio->GetNbinsX();i++){
if(ratio->GetBinContent(i) != 0){
cout<<"N in CR in "<<i<<". bin ="<<prediction->GetBinContent(i)<<endl;
cout<<"N in SR in "<<i<<". bin ="<<sr->GetBinContent(i)<<endl;
cout<<"Rel. difference in "<<i<<". bin ="<<(1./ratio->GetBinContent(i)-1.)*100<<"%"<<endl;
}
else if(sr->GetBinContent(i) == 0 && prediction->GetBinContent(i) !=0) cout<<"Scaling Factor in "<<i<<". bin <"<<prediction->GetBinContent(i)/1.15<<" +/- "<<ratio->GetBinError(i)<<endl;
else if(sr->GetBinContent(i) != 0 && prediction->GetBinContent(i) ==0) cout<<"Scaling Factor in "<<i<<". bin <"<<(sr->GetEntries()/prediction->GetEntries())/sr->GetBinContent(i)<<" +/- "<<ratio->GetBinError(i)<<endl;
}
ratio->GetYaxis()->SetTitle("#frac{CR (MC)}{CR (data)}");
ratio->SetTitle("");
ratio->SetLabelSize(0.1,"X");
ratio->SetLabelSize(0.1,"Y");
ratio->SetTitleOffset(0.5,"Y");
ratio->SetTitleSize(0.15,"Y");
padRatio->cd();
//ratio->GetYaxis()->SetRangeUser(0,2);
ratio->Draw("e");
// Draw line at one!
float xmin = ratio->GetXaxis()->GetXmin();
float xmax = ratio->GetXaxis()->GetXmax();
TLine *line = new TLine(xmin,1,xmax,1);
line->SetLineWidth(2);
line->Draw("same");
padRatio->Modified();
TLegend *leg = new TLegend(0.5,0.7,0.9,0.9);
leg->AddEntry(sr,"SR (MC)","l");
leg->AddEntry(prediction,"lepton CR (MC)","pel");
pad1->cd();
pad1->SetLogy();
// pad1->SetLogx();
sr->SetLineColor(kRed);
sr->SetMarkerColor(kRed);
sr->SetMarkerStyle(20);
sr->SetTitle("");
prediction->SetMarkerStyle(20);
prediction->SetTitle("");
prediction->GetXaxis()->SetTitle(xTitle);
sr->GetXaxis()->SetTitle(xTitle);
prediction->SetTitleSize(0.07,"X");
prediction->GetXaxis()->SetTitleOffset(0.7);
sr->SetTitleSize(0.07,"X");
sr->GetXaxis()->SetTitleOffset(0.7);
double maximum = 0;
double minimum = 1000000;
if(sr->GetMinimum()!=0 && sr->GetMinimum()<minimum){
minimum=sr->GetMinimum()*0.5;
}
if(prediction->GetMinimum()!=0 && prediction->GetMinimum()<minimum){
minimum=prediction->GetMinimum()*0.5;
}
if(data->GetMinimum()!=0 && data->GetMinimum()<minimum){
minimum=data->GetMinimum()*0.5;
}
//.........这里部分代码省略.........