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


C++ TH2D::GetCellContent方法代码示例

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


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

示例1: Yield1S

void Yield1S(){
  
  TFile *f = new TFile("Upsilon_2D_10ptbins.root");
  TH2D *H;
  H = (TH2D*)gFile->Get("fS1Yield");
  double tot(0.); double totE(0.); 
  
  ofstream OUT("Yield_1S.tex");
  OUT << "% ----------------------------------------------------------------------" << endl;
  OUT << "% -- Yields" << endl;
  
  for ( int x = 1; x <= H->GetNbinsX(); ++x ){
    OUT << Form("\\vdef{%iS_Rap_bin%iLowEdge} {\\ensuremath{ {%.1f } } }",1, x, H->GetXaxis()->GetBinLowEdge(x) ) << endl;
    if ( x == H->GetNbinsX() ) OUT << Form("\\vdef{%iS_Rap_bin%iHighEdge} {\\ensuremath{ {%.1f } } }",1 , x, H->GetXaxis()->GetBinUpEdge(x) ) << endl;
    //OUT << Form("\\vdef{%iS_bin%iContent} {\\ensuremath{ {%.0f } } }",1, x, H->GetBinContent(x) ) << endl;
    //OUT << Form("\\vdef{%iS_bin%iError} {\\ensuremath{ {%.0f } } }",1, x, H->GetBinError(x) ) << endl;
  }	
  
  for ( int x = 1; x <= H->GetNbinsY(); ++x ){
    OUT << Form("\\vdef{%iS_Pt_bin%iLowEdge} {\\ensuremath{ {%.1f } } }",1, x, H->GetYaxis()->GetBinLowEdge(x) ) << endl;
    if ( x == H->GetNbinsY() ) OUT << Form("\\vdef{%iS_Pt_bin%iHighEdge} {\\ensuremath{ {%.1f } } }",1 , x, H->GetYaxis()->GetBinUpEdge(x) ) << endl;
  }  
  
  for ( int x = 1; x <= H->GetNbinsX(); ++x ){
    for ( int y = 1; y <= H->GetNbinsY(); ++y ){
      OUT << Form("\\vdef{Yield%iS_bin%i_%iContent} {\\ensuremath{ {%.0f } } }",1, x, y, H->GetCellContent(x,y) ) << endl;
      OUT << Form("\\vdef{Yield%iS_bin%i_%iError} {\\ensuremath{ {%.0f } } }",1, x, y, H->GetCellError(x,y) ) << endl;
    }  
  }
  
  OUT.close();
  
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:33,代码来源:table.C

示例2: XS1S

void XS1S(){
  
  TFile *f = new TFile("Upsilon_2D_10ptbins.root");
  TH2D *H;
  H = (TH2D*)gFile->Get("fXS");
  double tot(0.); double totE(0.); 
  
  ofstream OUT("XS_1S.tex");
  OUT << "% ----------------------------------------------------------------------" << endl;
  OUT << "% -- XSections" << endl;
  
  for ( int x = 1; x <= H->GetNbinsX(); ++x ){
    for ( int y = 1; y <= H->GetNbinsY(); ++y ){
      OUT << Form("\\vdef{XS%iS_bin%i_%iContent} {\\ensuremath{ {%.4f } } }",1, x, y, H->GetCellContent(x,y) ) << endl;
      OUT << Form("\\vdef{XS%iS_bin%i_%iError} {\\ensuremath{ {%.4f } } }",1, x, y, H->GetCellError(x,y) ) << endl;
    }  
  }
  
  OUT.close();
  
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:21,代码来源:table.C


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