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


C++ TProfile::SetLineWidth方法代码示例

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


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

示例1: overlayTProfiles

TProfile* overlayTProfiles(TH2F* hdata, TH2F* hdy, float ymin, float ymax, TString savename)
{
  // See how the mean of the dimumass changes vs some variable by making TProfiles of a 2D histogram with the Dimu mass as the y axis.
  // Compare data to MC and save the results as png files.

  TString dataname  = TString("Golden_JSON_DoubleMuon_Data");
  TString dyname    = TString("Drell_Yan_Monte_Carlo_2015");

  // Make TProfiles from them to see how the mean changes vs the x variable.
  TProfile* pdata = hdata->ProfileX();
  pdata->SetLineColor(1);
  pdata->SetLineWidth(3);
  pdata->SetTitle(hdata->GetTitle());
  pdata->GetYaxis()->SetTitle(hdata->GetYaxis()->GetTitle());

  TProfile* pdy = hdy->ProfileX();
  pdy->SetLineColor(2);
  pdy->SetLineWidth(3);
  pdy->SetTitle(hdy->GetTitle());
  pdy->GetYaxis()->SetTitle(hdy->GetYaxis()->GetTitle());

  std::cout<< "hdata: " << hdata << std::endl;
  std::cout<< "hdy: " << hdy << std::endl;
  std::cout<< "pdata: " << pdata << std::endl;
  std::cout<< "pdy: " << pdy << std::endl;

  TCanvas* c = new TCanvas();
  c->SetGridx(kTRUE);
  c->SetGridy(kTRUE);

  // Draw data and MC on the same plot
  // Have to draw the same plots twice to get error bars and a curve through the error bars.
  c->cd();
  //    hdata->Draw("colz");
  pdata->SetAxisRange(ymin,ymax,"Y");
  pdata->Draw("hist c");
  pdata->Draw("E X0 same");
  pdy->Draw("hist c same");
  pdy->Draw("E X0 same");

  // Stat box alignment
  DiMuPlottingSystem* dps = new DiMuPlottingSystem();
  dps->arrangeStatBox(c);

  // Legend
  TLegend* l = new TLegend(0.15, 0.15, 0.7, 0.25, "", "brNDC");
  l->AddEntry(pdata, dataname, "l");
  l->AddEntry(pdy, dyname, "l");
  l->Draw("same");
  c->Print(savename);

  return pdata;
}
开发者ID:acarnes,项目名称:h2muPlotting,代码行数:53,代码来源:explore_zmass_boost.C

示例2: plotAndProfileXSpread

// Draw a 2-D plot within the specified Y range and superimpose its X profile,
// setting as sigmas that of the fit (and not the error of the mean)
void plotAndProfileXSpread (TH2* h2, float min, float max, bool profile=false, float ymin=-5., float ymax=5.) {
  setStyle(h2);
  gPad->SetGrid(1,1);
  gStyle->SetGridColor(15);
  gStyle->SetOptStat(0);
  // h2->RebinX(3);
  // h2->RebinY(2);
  // h2->SetXTitle("distance from anode (cm)");
  // h2->SetYTitle("(d_{reco}-d_{sim})/#sigma_{reco}");
  h2->SetMarkerColor(2);
  h2->SetLineColor(2);
  h2->GetYaxis()->SetTitleOffset(1.4);
  h2->GetXaxis()->SetRangeUser(min,max);
  h2->GetYaxis()->SetRangeUser(ymin,ymax);
  h2->DrawCopy("box");
  if (profile) {
    TProfile* prof = h2->ProfileX("profile",-1,-1,"s");
    prof->SetMarkerStyle(20);
    prof->SetMarkerSize(1.2);
    prof->SetMarkerColor(1);
    prof->SetLineColor(1);
    prof->SetLineWidth(2);
    prof->DrawCopy("same e1");
    delete prof;
  }
  TLine * l = new TLine(h2->GetXaxis()->GetXmin(),0,h2->GetXaxis()->GetXmax(),0);
  l->SetLineColor(3);
  l->Draw();
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:31,代码来源:macros.C

示例3: QAoccupancy

void QAoccupancy(const Char_t *fdata, const Char_t *fmc)
{
  style();

  TFile *fdtin = TFile::Open(fdata);
  TList *ldtin = (TList *)fdtin->Get("clist");
  TH2 *hdtin = (TH2 *)ldtin->FindObject("NClustersSPD2");
  TProfile *pdtin = hdtin->ProfileY("pdtin_clusters");
  pdtin->SetMarkerStyle(20);
  pdtin->SetMarkerSize(2);
  pdtin->SetMarkerColor(kAzure-3);
  
  TFile *fmcin = TFile::Open(fmc);
  TList *lmcin = (TList *)fmcin->Get("clist");
  TH2 *hmcin = (TH2 *)lmcin->FindObject("NClustersSPD2");
  TProfile *pmcin = hmcin->ProfileY("pmcin_clusters");
  pmcin->SetMarkerStyle(25);
  pmcin->SetMarkerSize(2);
  pmcin->SetMarkerColor(kRed+1);

  TCanvas *c = new TCanvas("cOccupancy", "cOccupancy", 800, 800);
  c->SetLogy();
  TH1 * hfr = c->DrawFrame(-0.5, 2., 10.5, 500.);
  DrawBinLabelsX(hfr, kTRUE);
  hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT");
  pdtin->DrawCopy("same");
  pmcin->DrawCopy("same");
  TLegend *legend = new TLegend(0.20, 0.18, 0.50, 0.30);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(pdtin, "data", "pl");
  legend->AddEntry(pmcin, "Monte Carlo", "pl");
  legend->Draw("same");
  c->SaveAs(canvasPrefix+"occupancy.pdf");
  return;
  TCanvas *cr = new TCanvas("cOccupancyr", "cOccupancyr", 800, 800);
  // hfr = cr->DrawFrame(-0.5, 0.75, 10.5, 1.25);
  // DrawBinLabelsX(hfr, kTRUE);
  // hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT ratio");
  pdtin->SetLineColor(kAzure-3);
  pdtin->SetLineWidth(3);
  pdtin->Divide(pmcin);
  pdtin->Draw("same,histo"); 
  legend = new TLegend(0.505025, 0.760673, 0.805276, 0.930142);
  legend->SetFillColor(0);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->AddEntry(pdtin, "data / Monte Carlo", "l");
  legend->Draw("same");
  cr->SaveAs(canvasPrefix+"occupancyr.pdf");
  
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:55,代码来源:QA.C

示例4: plotIsoPerformance

TProfile* plotIsoPerformance( TFile* ftt, 
			      const char* signal,     // histogram name
			      const char* background, // histogram name
			      const char* name,       // unique name
			      bool reverse = false,   // normally signal near zero bin, reverse means signal is around max bin
			      double bkg_eff_min = 0,
			      double bkg_eff_max = 1,
			      double sig_eff_min = 0,
			      double sig_eff_max = 0
			      )
{ 
  TH1F* S = dynamic_cast<TH1F*>(ftt->Get(signal));
  if ( ! S ) {
    std::cout << "Error: histogram not found " << signal << std::endl;
    return 0;
  }
  TH1F* B = dynamic_cast<TH1F*>(ftt->Get(background));
  if ( ! B ) {
    std::cout << "Error: histogram not found " << background << std::endl;
    return 0;
  }
  char buf[1024];
  sprintf(buf,"c_%s",name);
  // TCanvas* c = new TCanvas(buf,buf,500,500);
  sprintf(buf,"p_%s",name);
  TProfile* p = new TProfile(buf,buf,50,bkg_eff_min,bkg_eff_max,sig_eff_min,sig_eff_max);
  p->SetLineColor(kBlue);
  p->SetLineWidth(2);
  p->SetMarkerStyle(20);
  p->SetMarkerSize(1);
  p->GetXaxis()->SetTitle("Background Efficiency");
  p->GetYaxis()->SetTitle("Signal Efficiency");
  p->SetStats(kFALSE);
  for( int i=0;i<=S->GetNbinsX()+1; ++i )
    if ( reverse ) 
      p->Fill(B->Integral(i,B->GetNbinsX()+1)/B->Integral(0,B->GetNbinsX()+1),
	      S->Integral(i,S->GetNbinsX()+1)/S->Integral(0,S->GetNbinsX()+1));
    else
      p->Fill(B->Integral(0,i)/B->Integral(0,B->GetNbinsX()+1),
	      S->Integral(0,i)/S->Integral(0,S->GetNbinsX()+1));
  // p->Draw();
  return p;
}
开发者ID:magania,项目名称:CMS2,代码行数:43,代码来源:doPlots.C


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