当前位置: 首页>>代码示例>>C++>>正文


C++ TPaveText::SetY1方法代码示例

本文整理汇总了C++中TPaveText::SetY1方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveText::SetY1方法的具体用法?C++ TPaveText::SetY1怎么用?C++ TPaveText::SetY1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPaveText的用法示例。


在下文中一共展示了TPaveText::SetY1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: plot

// plot all used fits into one frame (with parameter box and chi^2)
RooPlot* ZPeakFit::plot() {
	data.plotOn(massframe, DataError(RooAbsData::SumW2));
	if (fit_VExpo) {
		pdf_VExpo->plotOn(massframe, LineColor(kBlue), LineStyle(2));
		double chi2 = massframe->chiSquare();
		std::string label = "VExpo (chi2 = " + lexical_cast<std::string>(chi2) + ")";
		pdf_VExpo->paramOn(massframe, Label("VExpo"), Layout(0.7, 0.9, 0.9), Label(label.c_str()));
		massframe->getAttText()->SetTextSize(0.02);
		TPaveText* box = (TPaveText*)massframe->findObject(Form("%s_paramBox",pdf_VExpo->GetName()));
		// do not use SetY1NDC, because NDC coordinates are not yet initialized. The y1 value will be used as the ndc value.
		box->SetY1(0.65); 
		massframe->getAttLine(Form("%s_paramBox",pdf_VExpo->GetName()))->SetLineColor(kBlue);
	}
	if (fit_2VExpo) {
		pdf_2VExpo->plotOn(massframe, LineColor(kRed));
		double chi2 = massframe->chiSquare();
		std::string label = "2VExpo (chi2 = " + lexical_cast<std::string>(chi2) + ")";
		pdf_2VExpo->paramOn(massframe, Layout(0.7, 0.9, 0.5), Label(label.c_str()));
		massframe->getAttText()->SetTextSize(0.02);
		TPaveText* box = (TPaveText*)massframe->findObject(Form("%s_paramBox",pdf_2VExpo->GetName()));
		box->SetY1(0.2);
		massframe->getAttLine(Form("%s_paramBox",pdf_2VExpo->GetName()))->SetLineColor(kRed);
	}
	if (fit_2VExpoMin70) {
		pdf_2VExpoMin70->plotOn(massframe, LineColor(kGreen), LineStyle(2));
		double chi2 = massframe->chiSquare();
		std::string label = "2VExpoMin70 (chi2 = " + lexical_cast<std::string>(chi2) + ")";
		pdf_2VExpoMin70->paramOn(massframe, Layout(0.15, 0.4, 0.9), Label(label.c_str()));
		massframe->getAttText()->SetTextSize(0.02);
		TPaveText* box = (TPaveText*)massframe->findObject(Form("%s_paramBox",pdf_2VExpoMin70->GetName()));
		box->SetY1(0.55);
		massframe->getAttLine(Form("%s_paramBox",pdf_2VExpoMin70->GetName()))->SetLineColor(kGreen);
	}

	return massframe;
}
开发者ID:cerminar,项目名称:UserCode,代码行数:37,代码来源:ZPeakFit.C

示例2: toyMC


//.........这里部分代码省略.........
  xframe->GetYaxis()->SetTitleOffset(1.4) ; xframe->Draw() ;
  drawText(Form("#Upsilon(2S)/#Upsilon(1S) = %.5f",(float)(wsinp->var("nSig2sInp")->getVal() / wsinp->var("nSig1sInp")->getVal())),0.2,0.54,1,16) ;
  
  if (inputOption==kChPol4 ) 
    drawText("4th order poly. Bkg.",0.2,0.62,2,15) ;
  if (inputOption==kErrExpExp ) 
    drawText("Erf*exp + exp Bkg.",0.2,0.62,2,15) ;
  
  if(collId == kAADATA)
    drawText("PbPb",0.4,0.45,1,15);
  if(collId == kPPDATA)
    drawText("pp", 0.4,0.45,1,15);

  drawText(Form("%.1f < p_{T}^{#mu#mu} < %.1f GeV",ptLow,ptHigh ),0.5,0.60,1,12);
  drawText(Form("%.1f < y^{#mu#mu} < %.1f",yLow,yHigh ), 0.5,0.55,1,12);
  TString perc = "%";
  if(collId == kAADATA)
    drawText(Form("Cent %d-%d%s",cLow/2,cHigh/2,perc.Data()),0.5,0.5,4,12);
  
  TLatex *tex = new TLatex(0.4,0.88,"Toy MC generated");
  tex->SetTextFont(43);
  tex->SetTextSize(15);
  tex->SetNDC();
  //  tex->SetTextAngle(180);
  tex->Draw();

  RooArgList paramListinp = fitResInput->floatParsFinal();
  paramListinp.Print("v");
  RooPlot* legFrameinp = wsinp->var("mass")->frame(Name("Fit Results"), Title("Fit Results"));
  wsinp->pdf("modelInput")->paramOn(legFrameinp,Layout(.6,.9, .5),Parameters(paramListinp));
  legFrameinp->getAttText()->SetTextAlign(11);
  legFrameinp->getAttText()->SetTextSize(0.028);
  TPaveText* hhinp = (TPaveText*)legFrameinp->findObject(Form("%s_paramBox",wsinp->pdf("modelInput")->GetName()));
  hhinp->SetY1(0.35); hhinp->SetY2(0.83);
  hhinp->Draw();
  // PULL

  TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 0.49, 0.25);
  c1->cd();
  pad2->Draw();
  pad2->cd();
  RooHist* hpull = xframe->pullHist("dataHist","inputModelHist");
  RooPlot* pullFrame = wsinp->var("mass")->frame(Title("Pull Distribution")) ;
  pullFrame->addPlotable(hpull,"P") ;
  pullFrame->SetTitleSize(2.57);
  pullFrame->GetYaxis()->SetTitleOffset(1.8) ;
  pullFrame->GetYaxis()->SetLabelSize(0.16) ;
  pullFrame->GetYaxis()->SetRange(-10,10) ;
  pullFrame->GetXaxis()->SetTitleOffset(0.7) ;
  pullFrame->GetXaxis()->SetLabelSize(0.1) ;
  pullFrame->GetXaxis()->SetTitleSize(0.13) ;
  pullFrame->Draw() ;


  TPad *pad3 = new TPad("pad3", "pad3", 0.51, 0.25, 0.99, 1);
  pad3->SetTicks(1,1);
  pad3->SetBottomMargin(0); // Upper and lower plot are joined
  c1->cd();
  pad3->Draw(); pad3->cd();

  xframe2->GetYaxis()->SetTitleOffset(1.4) ; xframe2->Draw() ;
  TLatex *tex2 = new TLatex(0.4,0.9,"Fitted by Nominal function");
  tex2->SetTextFont(43);
  tex2->SetTextSize(15);
  tex2->SetTextColor(2);
  tex2->SetNDC();
开发者ID:pjwinnetou,项目名称:quarkonia,代码行数:67,代码来源:toyMC_new.C


注:本文中的TPaveText::SetY1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。