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


C++ TLine::DrawLineNDC方法代码示例

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


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

示例1: myBoxText

void myBoxText(Double_t x, Double_t y,Double_t boxsize,Int_t mcolor,char *text) 
{
  Double_t tsize=0.06;

  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); 
  l.SetNDC();
  l.DrawLatex(x,y,text);

  Double_t y1=y-0.25*tsize;
  Double_t y2=y+0.25*tsize;
  Double_t x2=x-0.3*tsize;
  Double_t x1=x2-boxsize;

  printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2);

  TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC");

  mbox->SetFillColor(mcolor);
  mbox->SetFillStyle(1001);
  mbox->Draw();

  TLine mline;
  mline.SetLineWidth(4);
  mline.SetLineColor(1);
  mline.SetLineStyle(1);
  Double_t y_new=(y1+y2)/2.;
  mline.DrawLineNDC(x1,y_new,x2,y_new);

}
开发者ID:tongbaojia,项目名称:MakePlot,代码行数:29,代码来源:AtlasLabels.C

示例2: 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();
}
开发者ID:manuelfs,项目名称:babar_code,代码行数:87,代码来源:higgs_plots.cpp

示例3: multiple_detector_fit


//.........这里部分代码省略.........
  }
  
  std::cout << "...Error Matrix Filled" << std::endl;


  TCanvas* c6 = new TCanvas("c6","",700,700);
  c6->SetLeftMargin(.1);
  c6->SetBottomMargin(.1);
  c6->SetTopMargin(.075);
  c6->SetRightMargin(.15);
  c6->cd();

  M6.Draw("COLZ");
  gStyle->SetPalette(56,0);
  TMatrixFBase->SetContour(999);
  //  TMatrixFBase->GetZaxis()->SetRangeUser(-0.05,0.4);
  TMatrixFBase->GetZaxis()->SetTitleFont(62);
  TMatrixFBase->GetZaxis()->SetLabelFont(62);
  TMatrixFBase->GetZaxis()->SetTitleSize(0.045);
  //  TMatrixFBase->GetZaxis()->SetTitle("Fractional Error Matrix");
  TMatrixFBase->GetZaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetXaxis()->SetTitle("");
  TMatrixFBase->GetXaxis()->SetLabelSize(0);
  TMatrixFBase->GetXaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetTitle("");
  TMatrixFBase->GetYaxis()->SetTitleOffset(1.5);
  TMatrixFBase->GetYaxis()->SetLabelSize(0);
  TMatrixFBase->SetStats(0);

  TLine *split = new TLine();
  split->SetLineStyle(2);
  split->SetLineWidth(5);
  split->SetLineColor(kBlue);
  split->DrawLineNDC(.1,.51,.849,.51);
  split->DrawLineNDC(.475,.101,.475,.930);
  add_plot_label("|            0.2 #minus 3.0 GeV            |            0.2 #minus 3.0 GeV            | ", 0.48,0.08,0.03);



  TLatex *ND = new TLatex(.15,.01,"LAr1-ND (100m) ");
  ND->SetNDC();
  ND->SetTextFont(62);
  ND->SetTextSize(0.04);
  ND->Draw();

  TLatex *MD = new TLatex(.5,.01,"T600 (600m, on axis)");
  MD->SetNDC();
  MD->SetTextFont(62);
  MD->SetTextSize(0.04);
  MD->Draw();

  TLatex *ND45 = new TLatex(.05,.15,"LAr1-ND (100m) ");
  ND45->SetNDC();
  ND45->SetTextAngle(90);
  ND45->SetTextFont(62);
  ND45->SetTextSize(0.04);
  ND45->Draw();

  TLatex *MD45 = new TLatex(.05,.54,"T600 (600m, on axis)");
  MD45->SetNDC();
  MD45->SetTextAngle(90);
  MD45->SetTextFont(62);
  MD45->SetTextSize(0.04);
  MD45->Draw();

  TLatex *Total = new TLatex(.2,.96,"#nu#lower[0.3]{#mu} Flux Fractional Error Matrix");
开发者ID:jzennamo,项目名称:LAr1_ND_numu,代码行数:67,代码来源:Matrix.C


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