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


C++ TVirtualPad::SetGrid方法代码示例

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


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

示例1: pHitSpecPos

TCanvas* pHitSpecPos( )
{
  TCanvas* c = new TCanvas("cHitSpecPos","cHitSpecPos",1000,1100);
  c->Divide(2,2);
  TVirtualPad* p; TH2D *h;
  TText t; t.SetTextColor(4);

  p =c->cd(1); p->SetLogy(); p->SetGrid(1,0);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhi_BarMinus"); 
  h->GetYaxis()->SetRange(4,33);
  h->DrawCopy("box");
  t.DrawTextNDC(0.17,0.15, "BARREL MU MINUS");

  p =c->cd(2); p->SetLogy(); p->SetGrid(1,0);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhi_BarPlus"); 
  h->GetYaxis()->SetRange(4,32);
  h->DrawCopy("box");
  t.DrawTextNDC(0.17,0.15, "BARREL MU PLUS");

  p =c->cd(3); p->SetLogy(); p->SetGrid(1,0);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhi_EndMinus"); 
  h->GetYaxis()->SetRange(4,32);
  h->DrawCopy("box");
  t.DrawTextNDC(0.17,0.15, "ENDCAP MU MINUS");

  p =c->cd(4); p->SetLogy(); p->SetGrid(1,0);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhi_EndPlus"); 
  h->GetYaxis()->SetRange(4,32);
  h->DrawCopy("box");
  t.DrawTextNDC(0.17,0.15, "ENDCAP MU PLUS");

  return c;
}
开发者ID:konec,项目名称:usercode-L1RpcTriggerAnalysis,代码行数:33,代码来源:plotsHitSpec.C

示例2: pHitSpecPosGen

TCanvas* pHitSpecPosGen( )
{
  TCanvas* c = new TCanvas("cHitSpecPosGen","cHitSpecPosGen",1200,600);
  c->Divide(2,1);
  TVirtualPad* p; TH2D *h; TH2D *hAtPhi0;
  TText t; t.SetTextColor(4);

  p =c->cd(1); p->SetLogy(); p->SetGrid(0,1);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhiGen_Minus"); 
  hAtPhi0 = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhiGenAtPhi0_Minus"); 
  h->GetYaxis()->SetRange(4,33);
  h->GetXaxis()->SetNdivisions(505); h->GetXaxis()->SetLabelSize(0.04);
  h->DrawCopy("box");
  hAtPhi0->SetLineColor(2);
  hAtPhi0->DrawCopy("box same");
  t.DrawTextNDC(0.17,0.15, "BARREL MU MINUS");
  std::cout <<h->GetTitle() << std::endl;
  for (int iy = 1; iy <=h->GetNbinsY(); iy++) {
  std::cout <<" pt: " << h->GetYaxis()->GetBinLowEdge(iy);
  double xmin=100.;
  double xAtMax = 0.; double valAtMax = 0.;
  double xmax=-100.;
  for (int ix = 1; ix <=h->GetNbinsX(); ix++) {
     double val = h->GetBinContent(ix,iy); 
     double xbmin = h->GetXaxis()->GetBinLowEdge(ix);
     double xcent = h->GetXaxis()->GetBinCenter(ix);
     double xbmax = h->GetXaxis()->GetBinUpEdge(ix);
     if (val > valAtMax) { valAtMax = val; xAtMax = xcent; }
     if (val > 1 && (xbmin < xmin)) xmin = xbmin;    
     if (val > 1 && (xbmax > xmax)) xmax = xbmax;    
  }
  std::cout <<"  set DPHI0 = "<<1.025-xAtMax 
            <<"; set DPHI_MARGIN = " <<std::max( (xAtMax-xmin), (xmax-xAtMax))
<<";" << std::endl;
  }

  p =c->cd(2); p->SetLogy(); p->SetGrid(1,1);
  h = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhiGen_Plus"); 
  hAtPhi0 = (TH2D*)gROOT->FindObject("hHitSpec_PtVsPhiGenAtPhi0_Plus"); 
  h->GetYaxis()->SetRange(4,32);
  h->GetXaxis()->SetNdivisions(505); h->GetXaxis()->SetLabelSize(0.04);
  h->DrawCopy("box");
  hAtPhi0->SetLineColor(2);
  hAtPhi0->DrawCopy("box same");
  t.DrawTextNDC(0.17,0.15, "BARREL MU PLUS");
  std::cout <<h->GetTitle() << std::endl;
  for (int iy = 1; iy <=h->GetNbinsY(); iy++) {
  std::cout <<" pt: " << h->GetYaxis()->GetBinLowEdge(iy);
  double xmin=100.;
  double xAtMax = 0.; double valAtMax = 0.;
  double xmax=-100.;
  for (int ix = 1; ix <=h->GetNbinsX(); ix++) {
     double val = h->GetBinContent(ix,iy); 
     double xbmin = h->GetXaxis()->GetBinLowEdge(ix);
     double xcent = h->GetXaxis()->GetBinCenter(ix);
     double xbmax = h->GetXaxis()->GetBinUpEdge(ix);
     if (val > valAtMax) { valAtMax = val; xAtMax = xcent; }
     if (val > 1 && (xbmin < xmin)) xmin = xbmin;    
     if (val > 1 && (xbmax > xmax)) xmax = xbmax;    
  }
  std::cout <<"  set DPHI0 = "<<1.025-xAtMax 
            <<"; set DPHI_MARGIN = " <<std::max( (xAtMax-xmin), (xmax-xAtMax))
<<";" << std::endl;
  }

  return c;
}
开发者ID:konec,项目名称:usercode-L1RpcTriggerAnalysis,代码行数:67,代码来源:plotsHitSpec.C

示例3: EstimateBg_76X


//.........这里部分代码省略.........
          h_side_sum = h_side_temp_scaled;
          h_signal_sum = h_signal_temp_scaled;
        } else {
          h_side_sum->Add(h_side_temp_scaled);
          h_signal_sum->Add(h_signal_temp_scaled);
        }
      } else if (iMethod==2) {
        h_side = h_side_sum;
        h_signal = h_signal_sum;
      }
      TH1D *h_pred =(TH1D*)h_side->Clone();
      if (iMethod!=0&&rebin>1) { h_side->Rebin(rebin); h_signal->Rebin(rebin); h_pred->Rebin(rebin); }
      TLegend *leg = (TLegend*)can->GetListOfPrimitives()->At(can->GetListOfPrimitives()->GetEntries()-1);
      leg->SetX1(0.35); leg->SetX2(0.65); leg->SetY1(0.6);
      
      // Add ratio plot
      int y1 = 350;
      int y2 = 150;
      int mid2 = 10;
      can->Divide(1,2);
      // Pad 1 (80+500+20 x 40+500)
      TVirtualPad* p = can->cd(1);
      p->SetPad(0,(y2+60+mid2)/(y1+y2+100.0+mid2),1,1);
      p->SetTopMargin(40.0/(y1+40));
      p->SetBottomMargin(0);
      p->SetRightMargin(0.05);
      p->SetLogy(1);
      h_side->GetYaxis()->SetRangeUser(1.00001e-4,1e4);
      h_side->Draw("HIST");
      h_signal->Draw("SAMEHISTE1");
      leg->Draw();
      // Pad 2 (80+500+20 x 200+60)
      p = can->cd(2);
      p->SetGrid(0,1);
      p->SetPad(0,0,1,(y2+60+mid2)/(y1+y2+100.0+mid2));
      p->SetTopMargin(((float)mid2)/(y2+60+mid2));
      p->SetBottomMargin(60.0/(y2+60+mid2));
      p->SetRightMargin(0.05);
      TH1D* ratio = (TH1D*)h_signal->Clone();
      TH1D* div = (TH1D*)h_side->Clone();
      //ratio->Scale(1/ratio->GetSumOfWeights());
      double sum_bins_ratio = iMethod==0 ? ratio->Integral():
	ratio->Integral(ratio->FindBin(R_CUT_LOW),ratio->FindBin(Rranges_ABCD[iMethod][3]));
      ratio->Scale(1/sum_bins_ratio);
      ratio->SetTitleSize(32.0/(y2+60+mid2),"xyz");
      ratio->SetLabelSize(20.0/(y2+60+mid2),"xyz");
      //ratio->Scale(1/div->GetSumOfWeights());
      double sum_bins_div = iMethod==0 ? div->Integral():
	div->Integral(div->FindBin(R_CUT_LOW),div->FindBin(Rranges_ABCD[iMethod][3]));
      div->Scale(1/sum_bins_div);
      ratio->Divide(div);
      //ratio->GetYaxis()->SetRangeUser(0,2);
      ratio->GetXaxis()->SetTitleOffset(0.7);
      ratio->GetYaxis()->SetNdivisions(305);
      ratio->GetYaxis()->SetTitle("Ratio (Norm.)");
      ratio->GetYaxis()->SetTitleOffset(0.4);
      ratio->SetTitleSize(24.0/(y2+60+mid2),"y");
      ratio->SetTitle("");
      ratio->SetMarkerStyle(20);
      ratio->SetMarkerColor(1);
      ratio->SetLineColor(1);
      ratio->GetYaxis()->SetRangeUser(0,4);
      ratio->Draw("PE1");
      TLine* l = new TLine(ratio->GetXaxis()->GetXmin(), 1, ratio->GetXaxis()->GetXmax(), 1);
      l->SetLineWidth(2);
      //l->SetLineColor(2);
开发者ID:jkarancs,项目名称:BoostedRazorAnalysis,代码行数:67,代码来源:EstimateBg_76X.C


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