本文整理汇总了C++中TGraph2D::SetNpx方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph2D::SetNpx方法的具体用法?C++ TGraph2D::SetNpx怎么用?C++ TGraph2D::SetNpx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph2D
的用法示例。
在下文中一共展示了TGraph2D::SetNpx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetInterpolatingGraph
TGraph2D* GetInterpolatingGraph(TH2F *hold){
float binsize = hold->GetXaxis()->GetBinWidth(1)/2.;
TString name = hold->GetName();
name.ReplaceAll("Org","");
TGraph2D *g = new TGraph2D(hold);
g->SetNpx(int(g->GetXmax()-g->GetXmin())/binsize);
g->SetNpy(int(g->GetYmax()-g->GetYmin())/binsize);
//cout << "name " << g->GetN() << " " << hold->Integral() << endl;
return g;
}
示例2: InterpolateThisHistogram
TH2F* InterpolateThisHistogram(TH2F *hold/*, TH2F* hnew*/){
float binsize = hold->GetXaxis()->GetBinWidth(1)/2.;
TString name = hold->GetName();
name.ReplaceAll("Org","");
TGraph2D *g = new TGraph2D(hold);
//cout << g->GetXmax() << " " << g->GetXmin() << " " << g->GetYmax() << " " << g->GetYmin() << " " << binsize << endl;
g->SetNpx(int(g->GetXmax()-g->GetXmin())/binsize);
g->SetNpy(int(g->GetYmax()-g->GetYmin())/binsize);
TH2F *hnew = (TH2F*)g->GetHistogram();
//TH2F *htemp = (TH2F*)hnew->Clone(name);
//name.ReplaceAll("YXZ","");
TH2F *h = new TH2F(name.Data(),hold->GetTitle(),hnew->GetNbinsX(),g->GetXmin()-binsize,g->GetXmax()-binsize,hnew->GetNbinsY(),g->GetYmin()-binsize,g->GetYmax()-binsize);
for(unsigned int x = 1; x<=hnew->GetNbinsX(); ++x){
for(unsigned int y = 1; y<=hnew->GetNbinsY(); ++y){
h->SetBinContent(x,y,hnew->GetBinContent(x,y));
}
}
delete g;
return h;
}