本文整理汇总了C++中TProfile::GetBinCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ TProfile::GetBinCenter方法的具体用法?C++ TProfile::GetBinCenter怎么用?C++ TProfile::GetBinCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TProfile
的用法示例。
在下文中一共展示了TProfile::GetBinCenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoEvolutions
//.........这里部分代码省略.........
sprintf(hName,"hDen1D");
hDen1D = (TH1F*) gROOT->FindObject(hName);
if(hDen1D) delete hDen1D;
if(ThreeD) {
hDen1D = pData->GetH1SliceZ3D(pData->GetChargeFileName(1)->c_str(),"charge",-1,Nbins,-1,Nbins,opth1.Data());
} else if(CYL) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0).
hDen1D = pData->GetH1SliceZ(pData->GetChargeFileName(1)->c_str(),"charge",1,Nbins,opth1.Data());
} else { // 2D cartesian
hDen1D = pData->GetH1SliceZ(pData->GetChargeFileName(1)->c_str(),"charge",-1,Nbins,opth1.Data());
}
hDen1D->SetName(hName);
if(opt.Contains("comov"))
hDen1D->GetXaxis()->SetTitle("k_{p}#zeta");
else
hDen1D->GetXaxis()->SetTitle("k_{p}z");
hDen1D->GetYaxis()->SetTitle("n_{b}/n_{0}");
}
// On-axis beam density vs \zeta vs time! _________________________________
TH2F *hDen1DvsTime = NULL;
if(hDen1D) {
char hName[24];
sprintf(hName,"hDen1DvsTime");
TH2F *hDen1DvsTimeOld = (TH2F*) ifile->Get(hName);
Int_t nBins = 1;
Float_t edge0 = Time-0.5;
Float_t edge1 = Time+0.5;
if(hDen1DvsTimeOld!=NULL) {
nBins = hDen1DvsTimeOld->GetNbinsX()+1;
Float_t binwidth = (Time - hDen1DvsTimeOld->GetXaxis()->GetBinCenter(1))/(nBins-1);
edge0 = hDen1DvsTimeOld->GetXaxis()->GetBinCenter(1) - binwidth/2.;
edge1 = Time + binwidth/2.;
}
hDen1DvsTime = new TH2F("temp","",nBins,edge0,edge1,
hDen1D->GetNbinsX(),
hDen1D->GetBinLowEdge(1),
hDen1D->GetBinLowEdge(hDen1D->GetNbinsX()+1));
for(Int_t ix=1;ix<hDen1DvsTime->GetNbinsX();ix++) {
for(Int_t iy=1;iy<hDen1DvsTime->GetNbinsY();iy++) {
hDen1DvsTime->SetBinContent(ix,iy,hDen1DvsTimeOld->GetBinContent(ix,iy));
}
}
delete hDen1DvsTimeOld;
// Fill last bin with the newest values.
for(Int_t iy=1;iy<=hDen1D->GetNbinsX();iy++) {
hDen1DvsTime->SetBinContent(nBins,iy,hDen1D->GetBinContent(iy));
}
hDen1DvsTime->GetZaxis()->SetTitle("n_{b}/n_{0}");
hDen1DvsTime->GetYaxis()->SetTitle("k_{p}#zeta");
hDen1DvsTime->GetXaxis()->SetTitle("k_{p}z");
hDen1DvsTime->GetZaxis()->CenterTitle();
hDen1DvsTime->GetYaxis()->CenterTitle();
hDen1DvsTime->GetXaxis()->CenterTitle();
hDen1DvsTime->SetName(hName);
// Change the range of z axis
Float_t Denmax = hDen1DvsTime->GetMaximum();
hDen1DvsTime->GetZaxis()->SetRangeUser(0,Denmax);
hDen1DvsTime->Write(hName,TObject::kOverwrite);