本文整理汇总了C++中TGraph2D::GetNpx方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph2D::GetNpx方法的具体用法?C++ TGraph2D::GetNpx怎么用?C++ TGraph2D::GetNpx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph2D
的用法示例。
在下文中一共展示了TGraph2D::GetNpx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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