本文整理汇总了C++中TPad::GetRightMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ TPad::GetRightMargin方法的具体用法?C++ TPad::GetRightMargin怎么用?C++ TPad::GetRightMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPad
的用法示例。
在下文中一共展示了TPad::GetRightMargin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: can
void HiggsPlot::PlotChi2(){
styles style; style.setPadsStyle(1);
style.PadLeftMargin = 0.14; style.PadBottomMargin = 0.17;
style.yTitleOffset = 0.7; style.xTitleOffset = 0.7;
style.TitleSize = 0.1; style.LabelSize = 0.1;
style.setDefaultStyle();
TCanvas can("can","Likelihood scan");
TPad *cPad = static_cast<TPad *>(can.cd(0));
TString xTitle[] = {"R(D)", "R(D*)"};
double nSig = 4.2;
int nBins = 60;
_varyRD = 0;
double RD[2], RDs[2], frac=0.018;
Compute(0,RD,1); Compute(0,RDs,2);
double Limit[2][2] = {{Measurement[1][0]-nSig*Measurement[1][1], Measurement[1][0]+nSig*Measurement[1][1]},
{Measurement[2][0]-nSig*Measurement[2][1], Measurement[2][0]+nSig*Measurement[2][1]}};
TH2F hChi2("hChi2","",nBins, Limit[0][0],Limit[0][1], nBins, Limit[1][0],Limit[1][1]);
for(int iRD=1; iRD<=nBins; iRD++){
for(int iRDs=1; iRDs<=nBins; iRDs++){
RD[0] = hChi2.GetXaxis()->GetBinCenter(iRD);
RDs[0] = hChi2.GetYaxis()->GetBinCenter(iRDs);
hChi2.SetBinContent(iRD, iRDs, ProbChi2(3, 0, RD, RDs));
//cout<<1-ProbChi2(3, 0, RD, RDs)<<endl;
}
//cout<<endl;
}
hChi2.SetXTitle(xTitle[0]); hChi2.SetYTitle(xTitle[1]);
//int colors[] = {kBlue+2, kBlue+1, kBlue-4, kBlue-7, kBlue-9, kBlue-10, 0};
int colors[] = {kBlue-3, kBlue-4, kBlue-7, kBlue-9, kBlue-10, 0};
gStyle->SetPalette(Nsigma, colors);
double zCont[Nsigma];
for(int ns=1; ns<=Nsigma; ns++) zCont[ns] = IntG(0,1,-ns,ns);//cout<<endl<<zCont[ns]<<endl;}
hChi2.SetContour(Nsigma,zCont);
hChi2.GetXaxis()->CenterTitle(true); hChi2.GetYaxis()->CenterTitle(true);
hChi2.SetLabelOffset(0.009,"xy");
hChi2.SetLabelSize(0.09,"xy");
hChi2.SetTitleOffset(1,"x");
hChi2.SetTitleOffset(0.6,"y");
hChi2.Draw("cont4");
double padL[2][2] = {{cPad->GetLeftMargin(), 1-cPad->GetRightMargin()}, // Margins are reversed for x-y!
{cPad->GetBottomMargin(), 1-cPad->GetTopMargin()}};
double SMyield[2];
Compute(0,RD,1); Compute(0,RDs,2); RD[1] = RDs[0];
TLine line; line.SetLineWidth(2); line.SetLineColor(1);
for(int chan=0; chan<2; chan++){
double range = Limit[chan][1]-Limit[chan][0];
SMyield[chan] = padL[chan][0] + (padL[chan][1]-padL[chan][0])*(RD[chan]-Limit[chan][0])/range;
}
line.DrawLineNDC(SMyield[0]-frac, SMyield[1], SMyield[0]+frac, SMyield[1]);
line.DrawLineNDC(SMyield[0], SMyield[1]-2*frac, SMyield[0], SMyield[1]+2*frac);
TLatex latex; latex.SetNDC(kTRUE); latex.SetTextAlign(33); latex.SetTextSize(style.TitleSize);
latex.DrawLatex(SMyield[0]-frac,SMyield[1]-frac,"SM");
line.SetLineColor(0);
for(int chan=0; chan<2; chan++){
double range = Limit[chan][1]-Limit[chan][0];
SMyield[chan] = padL[chan][0] + (padL[chan][1]-padL[chan][0])*(Measurement[1+chan][0]-Limit[chan][0])/range;
}
line.DrawLineNDC(SMyield[0]-frac, SMyield[1], SMyield[0]+frac, SMyield[1]);
line.DrawLineNDC(SMyield[0], SMyield[1]-2*frac, SMyield[0], SMyield[1]+2*frac);
TH1F *histo[Nsigma];
double legW = 0.08, legH = 0.07*Nsigma;
double legX = 1-style.PadRightMargin-0.02, legY = 1-style.PadTopMargin-0.02;
TLegend *leg = new TLegend(legX-legW, legY-legH, legX, legY);
leg->SetTextSize(0.08); leg->SetFillColor(0); leg->SetTextFont(style.nFont);
for(int ileg=0; ileg<Nsigma-1; ileg++) {
TString label = "histo"; label += ileg+1;
histo[ileg] = new TH1F(label,"histo",10,0,10);
histo[ileg]->SetLineColor(colors[ileg]);histo[ileg]->SetFillColor(colors[ileg]);
label = " "; label += ileg+1; label += "#sigma";
leg->AddEntry(histo[ileg],label);
}
leg->Draw();
TString pName = "public_html/Higgs_Chi2.eps";
can.SaveAs(pName);
for(int ileg=0; ileg<Nsigma-1; ileg++) histo[ileg]->Delete();
}