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


C++ Graph::GetN方法代码示例

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


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

示例1: DrawPileupCorr

bool DrawPileupCorr(Str jetAlgo) {
  JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile,false);
  bool residual = theJES->JetAreaJES();

  TH1D *temp = new TH1D("","",100,-5,5);
  temp->SetXTitle("Jet #eta"); temp->SetYTitle("Jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  if (residual) temp->SetYTitle("Residual jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  temp->SetMinimum(-20); temp->SetMaximum(15); temp->SetStats(0);
  if ( residual && theJES->ResidualOffsetCorr_Description() == "" ) return false;
  Can->Clear(); temp->Draw();
  for (int npv=0;npv<9;++npv) {
    double NPV=(npv%3)*10, mu=(npv/3)*10;
    if (NPV==0) NPV=1;
    Graph *g = new Graph();
    FormatGraph(g,npv);
    for (int ieta=-50;ieta<50;++ieta) {
      double eta=0.05 + 0.1*ieta;
      double O = residual ? theJES->GetResidualOffset(eta,mu,NPV)/1000 :
	theJES->GetOffset(eta,mu,NPV)/1000; // convert to GeV
      g->SetPoint(g->GetN(),eta,O);
    }
    if (npv<4) DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.18,0.35-0.04*npv,npv);
    else DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.48,0.35-0.04*(npv-4),npv);
    
    g->Draw("P");
  }
  tex->SetNDC(); tex->SetTextAlign(12);
  if (residual)
    tex->DrawLatex(0.18,0.975,theJES->ResidualOffsetCorr_Description());
  else 
    tex->DrawLatex(0.18,0.975,theJES->OffsetCorr_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
  return true;
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:34,代码来源:DrawJES.C

示例2: DrawPileupCorrVsMuNPV

void DrawPileupCorrVsMuNPV(Str jetAlgo) {
  JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile);
  bool residual = theJES->JetAreaJES();

  TH1D *tempNPV = new TH1D("","",12,0,20);
  TH1D *tempmu  = new TH1D("","",15,0,25);
  tempNPV->SetXTitle("Number of vertices, #it{N}_{PV}");
  tempmu->SetXTitle("Average number of interactions, #LT#it{#mu}#GT"); 
  double etaBins[] = {0, 0.3, 0.8, 1.2, 2.1, 2.8, 3.2, 3.6, 4.5};
  Str tit=residual?"Residual jet offset":"Jet offset";
  tempNPV->SetYTitle(tit+" at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  tempmu->SetYTitle(tit+" at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  tempNPV->SetMinimum(-8); tempNPV->SetMaximum(8); tempNPV->SetStats(0); 
  tempNPV->GetYaxis()->SetTitleOffset(1.0); tempNPV->GetXaxis()->SetTitleOffset(1.0);
  tempmu->SetMinimum(-8); tempmu->SetMaximum(8); tempmu->SetStats(0); 
  tempmu->GetYaxis()->SetTitleOffset(1.0); tempmu->GetXaxis()->SetTitleOffset(1.0);
  if (residual && theJES->ResidualOffsetCorr_Description()=="") return;

  Can->Clear(); tempNPV->Draw();
  for (int ei=0;ei<5;++ei) {
    double eta=0.5;
    if (ei==1) eta=1.0;
    if (ei==2) eta=2.0;
    if (ei==3) eta=3.0;
    if (ei==4) eta=4.0;
    Graph *g = new Graph();
    FormatGraph(g,ei);
    for (int npv=1;npv<=20;++npv)
      if (residual)
	g->SetPoint(g->GetN(),npv,theJES->GetResidualOffset(eta,0.0,npv)/1000);
      else
	g->SetPoint(g->GetN(),npv,theJES->GetOffset(eta,0.0,npv)/1000);
    g->Draw("PL");
  }
  DrawLabel("0.3 #leq |#eta| < 0.8",0.7,0.37,0);
  DrawLabel("0.8 #leq |#eta| < 1.2",0.7,0.37-0.05,1);
  DrawLabel("2.1 #leq |#eta| < 2.8",0.7,0.37-0.1,2);
  DrawLabel("2.8 #leq |#eta| < 3.2",0.7,0.37-0.15,3);
  DrawLabel("3.6 #leq |#eta| < 4.5",0.7,0.37-0.2,4);
  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->OffsetCorr_Description());
  int jetR=jetAlgo.Contains("Kt4")?4:6;
  tex->DrawLatex(0.18,0.9,Form("Anti-k_{t} #it{R} = 0.%d, %s+JES",jetR,GetConstScale(jetAlgo).Data()));
  Can->Print(ps); 
  
  Can->Clear(); tempmu->Draw();
  for (int ei=0;ei<5;++ei) {
    double eta=0.5;
    if (ei==1) eta=1.0;
    if (ei==2) eta=2.0;
    if (ei==3) eta=3.0;
    if (ei==4) eta=4.0;
    Graph *g = new Graph();
      FormatGraph(g,ei);
      for (int mu=0;mu<=25;++mu) 
	if (residual)
	  g->SetPoint(g->GetN(),mu,theJES->GetResidualOffset(eta,mu,1)/1000);
	else
	  g->SetPoint(g->GetN(),mu,theJES->GetOffset(eta,mu,1)/1000);
      g->Draw("PL");
  }
  DrawLabel("0.3 #leq |#eta| < 0.8",0.2,0.37,0);
  DrawLabel("0.8 #leq |#eta| < 1.2",0.2,0.37-0.05,1);
  DrawLabel("2.1 #leq |#eta| < 2.8",0.2,0.37-0.1,2);
  DrawLabel("2.8 #leq |#eta| < 3.2",0.2,0.37-0.15,3);
  DrawLabel("3.6 #leq |#eta| < 4.5",0.2,0.37-0.2,4);
  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->OffsetCorr_Description());
  tex->DrawLatex(0.18,0.9,Form("Anti-k_{t} #font[52]{R} = 0.%d, %s+JES",jetR,GetConstScale(jetAlgo).Data()));
  Can->Print(ps);
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:71,代码来源:DrawJES.C


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