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


C++ TPad::SetNumber方法代码示例

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


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

示例1: DisplayTracker

void DisplayTracker(TStrawTracker *trX_1, TStrawTracker *trX_2, TStrawTracker *trX_3,
                    TStrawTracker *trY_1, TStrawTracker *trY_2, TStrawTracker *trY_3)
{
  // all trackers
  if (gStrela->GetDisplay()) return;
  TStrelaDisplay *display = new TStrelaDisplay();

  Double_t xl[3] = {0.00, 0.20, 0.475}; // 0.00, 0.25, 0.75
  Double_t xu[3] = {0.20, 0.475, 1.00}; // 0.25, 0.75, 1.00
  Double_t yl[3] = {0.1072, 0.192, 0.000};
  Double_t yu[3] = {0.3929, 0.308, 0.500};
  TPad *pad;
  Int_t npad = 1; // must start from 1
  TPad *pad0 = display->GetPad();

  for (Int_t iy = 0; iy < 2; iy++) {
    for (Int_t ix = 0; ix < 3; ix++) {
      yl[ix] = iy*0.5 + yl[ix];
      yu[ix] = iy*0.5 + yu[ix];
      pad = new TPad(Form("%s_%d", pad0->GetName(), npad), "",
                     xl[ix], yl[ix], xu[ix], yu[ix]);
      pad->SetNumber(npad++);
      pad->Draw();
    }
  }
  // special pad_7
  pad = new TPad(Form("%s_%d", pad0->GetName(), npad), "",
                 0.30, yl[0], 0.50, yu[0]);
  pad->SetNumber(npad++);
  pad->Draw();

  if (trY_1) {
    pad0->cd(1);
    display->DrawTracker(trY_1);
  }
  if (trY_2) {
    pad0->cd(2);
    display->DrawTracker(trY_2);
  }
  if (trY_3) {
    pad0->cd(3);
    display->DrawTracker(trY_3);
  }
  if (trX_1) {
    pad0->cd(4);
    display->DrawTracker(trX_1);
  }
  if (trX_2) {
    pad0->cd(7);
    display->DrawTracker(trX_2);
    //    display->FindRange(0.006);
  }
  if (trX_3) {
    pad0->cd(6);
    display->DrawTracker(trX_3);
  }

  pad0->cd(0);
}
开发者ID:musinsky,项目名称:strela,代码行数:59,代码来源:DisplayTracker.C

示例2: compareplots_noRatio


//.........这里部分代码省略.........
    }
   
    for(size_t i=0;i<histos.size();i++){
      histos.at(i)->Sumw2();
      histos.at(i)->Scale(1./histos.at(i)->Integral(),"width");
    }

// Set axis title
histos.at(0)->GetYaxis()->SetTitle("Normalized units"); 
std::string const histogramName = histos.at(1)->GetName();
histos.at(0)->GetXaxis()->SetLabelSize(0.05);
histos.at(0)->GetXaxis()->SetLabelOffset(0.006);
histos.at(0)->GetYaxis()->SetLabelSize(0.05);
histos.at(0)->GetYaxis()->SetLabelOffset(0.006);
histos.at(0)->GetXaxis()->SetTitleSize(0.06);
histos.at(0)->GetXaxis()->SetTitleOffset(1.1);
histos.at(0)->GetYaxis()->SetTitleSize(0.06);
histos.at(0)->GetYaxis()->SetTitleOffset(1.15);
	

 histos.at(0)->GetXaxis()->SetTitle(titles.at(run));
 run = run+1;
 if(run == (3*8)){
   run = 0;
 }

// If only two histograms per plot make a ratio plot
if(histos.size() == 2)
{

//create main pad  
                                                                                                                                                          
           TPad *mainPad = new TPad("","",0.0,0.0,1.0,1.0);
           mainPad->SetNumber(1);
           mainPad->SetBottomMargin(0.15);
           mainPad->SetRightMargin(0.04);
	   mainPad->SetLeftMargin(0.13);
           mainPad->Draw();
	   gStyle->SetOptTitle(0);
           //create ratio pad                                                                                                                                                           
           /*TPad *ratioPad = new TPad("","",0.0,0.0,1.0,0.3);
           ratioPad->SetTopMargin(0.0);
           ratioPad->SetBottomMargin(0.4);
           ratioPad->SetLeftMargin(0.13);                                                                                                                                             
           ratioPad->SetRightMargin(0.04);
           gStyle->SetOptTitle(0);
           ratioPad->SetFillColor(0);
           ratioPad->SetNumber(2);
           ratioPad->SetGridy();                                                                                                                                                      
           ratioPad->Draw();*/

// Draw both histograms first
c->cd(1);

histos.at(0)->Draw("histo E");
histos.at(1)->Draw("histo same E");

// Show legend and statistical tests in first pad
    for(size_t i=0;i<histos.size()-1;i=i+2){

      double ksresult = histos.at(i)->KolmogorovTest(histos.at(i+1));
      ksresult=floor(ksresult*1000+0.5)/1000;
      double chi2result =histos.at(i)->Chi2Test(histos.at(i+1),"WW");
      chi2result=floor(chi2result*1000+0.5)/1000;

      stringstream ss;
开发者ID:hannes-kit,项目名称:plotscripts,代码行数:67,代码来源:compareplots_noRatio.C

示例3: makePlot


//.........这里部分代码省略.........
//    }
//  }

  TFile * signalInputFile3= new TFile (signal3+anaType+".root", "READ");
  TH1F * histoSignal3 = (TH1F*)signalInputFile3->Get(histoName);
  histoSignal3->SetStats(0);
  histoSignal3->Scale(lumi);

  //
  // BACKGROUND MC
  //

  THStack stack("Background MC","");
  setPlotTitle(stack, lumi);

  // Add all different background MC to this stack
  TLegend *legend= new TLegend(0.5,0.6,0.85,0.85);

  totalBkgMCIntegral = addBackgroundHistos(anaType, histoName, stack, legend, lumi, minIntegral, maxIntegral);


//  if ( histoName=="nMinus1_isolationLeptonH_removedLifetimeCuts" || histoName=="nMinus1_relIsolationLeptonH_removedLifetimeCuts" ) {
//    std::cout << "Integral of background between " << minIntegral << " and " << maxIntegral << " : " << totalBkgMCIntegral << std::endl;
//  }

  // Output histograms to file
  outputFile->cd();

  // Setup canvas
  TCanvas canvas(histoName);
  canvas.cd();
  // Draw one or two pads
  TPad * up = new TPad("u","u",0.01,0.25,0.99,0.99);
  up->SetNumber(1);
  up->Draw();
  TPad * dp = new TPad("d","d",0.01,0.01,0.99,0.25);

  if ( drawRatioPlot ) {
    dp->SetNumber(2);
    dp->UseCurrentStyle();
    dp->Draw();
  }
  else {
    up->SetPad(0.01,0.01,0.99,0.99);
    up->Draw();
  }

  if ( logY ) up->SetLogy();
  canvas.Draw();
  canvas.cd(1);
  up->cd();
  canvas.SetFillColor(kWhite);
  canvas.SetBorderMode(0);


  // Draw background MC
  // There may be zero entries, which will mess up drawing options
  // Not a good fix at the moment
  bool axesExist=false;
  if (totalBkgMCIntegral>0) {
    axesExist=true;

    stack.Draw("HISTE");

    stack.GetXaxis()->SetRangeUser(xMin, xMax);
    stack.SetMaximum(yMax);
开发者ID:TENorbert,项目名称:usercode-2,代码行数:67,代码来源:makeAllPlots.C


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