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


C++ TLegend::Delete方法代码示例

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


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

示例1: getCalibrationResults


//.........这里部分代码省略.........
	      statUncResults.Add(h);
	    }  
	}



      TH1D *pullH=(TH1D *)fin->Get(mpts[i]+"/pull");
      pullH->SetDirectory(0);
      pullResults.Add(pullH);
    }
  fin->Close();


  //plot results
  setStyle();
  gStyle->SetOptFit(0);

  TCanvas *c=new TCanvas("linc","linc",600,600);
  c->SetWindowSize(600,600);
  c->Divide(1,2);
  TPad *p=(TPad *)c->cd(1);
  p->SetPad(0,0.3,1.0,1.0);
  lingr->Draw("ap");
  lingr->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]");
  lingr->GetXaxis()->SetTitle("Fitted m_{top} [GeV/c^{2}]");

  TLine *l=new TLine(lingr->GetXaxis()->GetXmin(),lingr->GetYaxis()->GetXmin(),
		     lingr->GetXaxis()->GetXmax(),lingr->GetYaxis()->GetXmax());
  l->SetLineColor(kGray);
  l->SetLineStyle(6);
  l->Draw("same");
  TLegend *leg = p->BuildLegend();
  formatForCmsPublic(p,leg,"CMS simulation",3);
  leg->Delete();


  p=(TPad *)c->cd(2);
  p->SetPad(0,0.0,1.0,0.28);
  p->SetTopMargin(0);
  p->SetBottomMargin(0.5);
  float yscale = (1.0-0.3)/(0.28-0);
  biasgr->Draw("ap");
  biasgr->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]");
  biasgr->GetYaxis()->SetTitle("Bias");
  biasgr->GetYaxis()->SetRangeUser(-5.2,5.2);
  biasgr->GetXaxis()->SetTitleOffset(0.85);
  biasgr->GetXaxis()->SetLabelSize(0.04 * yscale);
  biasgr->GetXaxis()->SetTitleSize(0.05 * yscale);
  biasgr->GetXaxis()->SetTickLength( 0.03 * yscale );
  biasgr->GetYaxis()->SetTitleOffset(0.5);
  biasgr->GetYaxis()->SetLabelSize(0.04 * yscale);
  biasgr->GetYaxis()->SetTitleSize(0.04 * yscale);
  biasgr->Fit("pol1");
  float a=biasgr->GetFunction("pol1")->GetParameter(1);
  float b=biasgr->GetFunction("pol1")->GetParameter(0);
  report << "[Inclusive bias correction] resslope:" << (a+1.) << " resbias:" << b << endl;
  c->Modified();
  c->Update();
  c->SaveAs(outDir+"/TopMassCalibrationResults.C");
  c->SaveAs(outDir+"/TopMassCalibrationResults.png");
  c->SaveAs(outDir+"/TopMassCalibrationResults.pdf");
  //  delete c;
  
  //biases per category
  c=new TCanvas("biasc","biasc",600,600);
  c->SetWindowSize(600,600);
开发者ID:fedenguy,项目名称:LIPTop,代码行数:67,代码来源:getCalibrationResults.C

示例2: drawSpectra2D


//.........这里部分代码省略.........
        h_normInt[i]->SetTitleOffset(titleOffsetX,"X");
        h_normInt[i]->SetTitleOffset(titleOffsetY,"Y");
        h_normEvents[i]->SetTitleOffset(titleOffsetX,"X");
        h_normEvents[i]->SetTitleOffset(titleOffsetY,"Y");

        // default marker style and color
        h[i]->SetMarkerStyle(kFullCircle);
        h[i]->SetMarkerColor(kBlack);
        h_normInt[i]->SetMarkerStyle(kFullCircle);
        h_normInt[i]->SetMarkerColor(kBlack);
        h_normEvents[i]->SetMarkerStyle(kFullCircle);
        h_normEvents[i]->SetMarkerColor(kBlack);

        // no stats box in the final plots
        h[i]->SetStats(false);
        h_normInt[i]->SetStats(false);
        h_normEvents[i]->SetStats(false);
    }

    // write canvases
    TCanvas* c;
    for (int i=0; i<nHistos; ++i) {
        c = new TCanvas(Form("cnv_%d",i),"",windowWidth,windowHeight);
        c->SetTitle(h[i]->GetTitle());
        setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin);
        setCanvasFinal(c, setLogx, setLogy, setLogz);
        c->cd();

        h[i]->SetTitleOffset(titleOffsetX,"X");
        h[i]->SetTitleOffset(titleOffsetY,"Y");
        h[i]->SetStats(false);
        h[i]->Draw("colz");
        c->Write();
        c->Close();         // do not use Delete() for TCanvas.

        // normalized to 1.
        c = new TCanvas(Form("cnv_%d_normInt",i),"",windowWidth,windowHeight);
        c->SetTitle(h_normInt[i]->GetTitle());
        setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin);
        setCanvasFinal(c, setLogx, setLogy, setLogz);
        c->cd();

        h_normInt[i]->SetTitleOffset(titleOffsetX,"X");
        h_normInt[i]->SetTitleOffset(titleOffsetY,"Y");
        h_normInt[i]->SetStats(false);
        h_normInt[i]->Draw("colz");
        c->Write();
        c->Close();         // do not use Delete() for TCanvas.

        // normalized by number of events
        c = new TCanvas(Form("cnv_%d_normEvents",i),"",windowWidth,windowHeight);
        c->SetTitle(h_normEvents[i]->GetTitle());
        setCanvasMargin(c, leftMargin, rightMargin, bottomMargin, topMargin);
        setCanvasFinal(c, setLogx, setLogy, setLogz);
        c->cd();

        h_normEvents[i]->SetTitleOffset(titleOffsetX,"X");
        h_normEvents[i]->SetTitleOffset(titleOffsetY,"Y");
        h_normEvents[i]->SetStats(false);
        h_normEvents[i]->Draw("colz");
        c->Write();
        c->Close();         // do not use Delete() for TCanvas.
    }
    // canvases are written.

    // set style of the histograms for the canvases to be saved as picture
开发者ID:CmsHI,项目名称:ElectroWeak-Jet-Track-Analyses,代码行数:67,代码来源:drawSpectra2D.C


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