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


C++ TGraph2D::GetZmax方法代码示例

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


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

示例1: fillGraphsFromFiles

void fillGraphsFromFiles( const TString& par1,
			  const TString& par2,
			  const vector<TString>& fnames,
			  vector<string>&  keys,
			  map<string,TGraph2D *>& m_graphs)
{
  keys.push_back("-2s");
  keys.push_back("-1s");
  keys.push_back("median");
  keys.push_back("+1s");
  keys.push_back("+2s");
  keys.push_back("obs");

  for (int i=0; i<6; i++) {
    m_graphs[keys[i]] = new TGraph2D();
    m_graphs[keys[i]]->SetName(Form("graph2D%s",keys[i].c_str()));
  }

  int nobs=0, nexp=0;
  for( size_t i=0; i<fnames.size(); i++) {
    
    double par1val = extractParValue(par1,fnames[i]);
    double par2val = extractParValue(par2,fnames[i]);

    //cout << par1val << "\t" << par2val << endl;

    if (par1val == -9e99 ||
	par2val == -9e99)
      continue;
    
    TFile *f = new TFile(fnames[i]);

    double obs,median,s68hi,s68lo,s95hi,s95lo;
    int num = getBands(f,1,0,obs,median,s68hi,s68lo,s95hi,s95lo);

    switch (num) {
    case 0: break;
    case 1:
      //cout << "SetPoint(i="<<nobs<<",par1="<<par1val<<",par2="<<par2val<<",obs="<<obs<<");"<<endl;
      m_graphs["obs"]->SetPoint(nobs,par1val,par2val,obs);
      nobs++;
      break;
    default:
      m_graphs["+2s"]->SetPoint(nexp,par1val,par2val,s95hi);
      m_graphs["-2s"]->SetPoint(nexp,par1val,par2val,s95lo);
      m_graphs["+1s"]->SetPoint(nexp,par1val,par2val,s68hi);
      m_graphs["-1s"]->SetPoint(nexp,par1val,par2val,s68lo);
      m_graphs["median"]->SetPoint(nexp,par1val,par2val,median);
      nexp++;
      break;
    }
        
    f->Close();

    delete f;

    //if (!(i%10)) cout << i << " " << std::flush;


  } // file loop

#if 0
  TGraph2D *gobs = m_graphs["obs"];
  cout << "obs has " << gobs->GetN() << " points" << endl;
  cout << "npx = " << gobs->GetNpx() << endl;
  cout << "npy = " << gobs->GetNpy() << endl;
  cout << "xmin = " << gobs->GetXmin() << endl;
  cout << "xmax = " << gobs->GetXmax() << endl;
  cout << "ymin = " << gobs->GetYmin() << endl;
  cout << "ymax = " << gobs->GetYmax() << endl;
  cout << "zmin = " << gobs->GetZmin() << endl;
  cout << "zmax = " << gobs->GetZmax() << endl;

  double *xvec = gobs->GetX();
  double *yvec = gobs->GetY();
  double *zvec = gobs->GetZ();
  for (int i=0; i<gobs->GetN(); i++)
    printf("%lf\t%lf\t%lf\n",xvec[i],yvec[i],zvec[i]);
#endif
}                                                 // fillGraphsFromFiles
开发者ID:senka,项目名称:CombinedEWKAnalysis_forMingshui,代码行数:80,代码来源:atgcplotLimit.C

示例2: calculatePadBoundaries

  PadBoundaries PlotBundle::calculatePadBoundaries() const {
    PadBoundaries union_pad_boundaries;
    bool nothing_drawn(true);

    std::vector<DrawableDataObjectDrawOptionPair<TH1*> >::const_iterator hist_it;

    for (hist_it = histograms.begin(); hist_it != histograms.end(); hist_it++) {
      TH1* hist = hist_it->data_object;
      std::string draw_option(hist_it->draw_option);
      if (hist) {
        hist->Draw(draw_option.c_str());
        if (plot_axis.x_axis_range.active)
          hist->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low,
              plot_axis.x_axis_range.high);
        PadBoundaries current_pad_boundaries(*hist);

        if (nothing_drawn) {
          union_pad_boundaries = current_pad_boundaries;
          nothing_drawn = false;
        } else {
          union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
              current_pad_boundaries);
        }
      }
    }

    std::vector<DrawableDataObjectDrawOptionPair<TGraph*> >::const_iterator graph_it;

    for (graph_it = graphs.begin(); graph_it != graphs.end(); graph_it++) {
      TGraph* graph = graph_it->data_object;
      std::string draw_option("A");
      draw_option.append(graph_it->draw_option);
      if (graph) {
        graph->Draw(draw_option.c_str());
        if (plot_axis.x_axis_range.active)
          graph->GetXaxis()->SetRangeUser(plot_axis.x_axis_range.low,
              plot_axis.x_axis_range.high);
        PadBoundaries current_pad_boundaries(*graph->GetHistogram());
        if (nothing_drawn) {
          union_pad_boundaries = current_pad_boundaries;
          nothing_drawn = false;
        } else {
          union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
              current_pad_boundaries);
        }
      }
    }

    std::vector<DrawableDataObjectDrawOptionPair<TGraph2D*> >::const_iterator graph2d_it;

    for (graph2d_it = graphs2d.begin(); graph2d_it != graphs2d.end();
        graph2d_it++) {
      TGraph2D* graph = graph2d_it->data_object;
      std::string draw_option("A");
      draw_option.append(graph2d_it->draw_option);
      if (graph) {
        graph->Draw(draw_option.c_str());
        PadBoundaries current_pad_boundaries(*(TH1*) graph->GetHistogram());
        current_pad_boundaries.is_2d = true;
        current_pad_boundaries.z_min = graph->GetZmin();
        current_pad_boundaries.z_max = graph->GetZmax();
        if (nothing_drawn) {
          union_pad_boundaries = current_pad_boundaries;
          nothing_drawn = false;
        } else {
          union_pad_boundaries = union_pad_boundaries.getUnionBoundaries(
              current_pad_boundaries);
        }
      }
    }

    return union_pad_boundaries;
  }
开发者ID:spflueger,项目名称:ROOTNeatPlotting,代码行数:73,代码来源:PlotBundle.cpp


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