本文整理汇总了C++中RooRealVar::setBinning方法的典型用法代码示例。如果您正苦于以下问题:C++ RooRealVar::setBinning方法的具体用法?C++ RooRealVar::setBinning怎么用?C++ RooRealVar::setBinning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooRealVar
的用法示例。
在下文中一共展示了RooRealVar::setBinning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustBinning
void THSEventsPDF::adjustBinning(Int_t* offset1) const
{
RooRealVar* xvar = fx_off ;
if (!dynamic_cast<RooRealVar*>(xvar)) {
coutE(InputArguments) << "RooDataHist::adjustBinning(" << GetName() << ") ERROR: dimension " << xvar->GetName() << " must be real" << endl ;
assert(0) ;
}
Double_t xlo = xvar->getMin() ;
Double_t xhi = xvar->getMax() ;
//adjust bin range limits with new scale parameter
//cout<<scale<<" "<<fMean<<" "<<xlo<<" "<<xhi<<endl;
xlo=(xlo-fMean)/scale+fMean;
xhi=(xhi-fMean)/scale+fMean;
if(xvar->getBinning().lowBound()==xlo&&xvar->getBinning().highBound()==xhi) return;
xvar->setRange(xlo,xhi) ;
// Int_t xmin(0) ;
// cout<<"THSEventsPDF::adjustBinning( "<<xlo <<" "<<xhi<<endl;
//now adjust fitting range to bin limits??Possibly not
if (fRHist->GetXaxis()->GetXbins()->GetArray()) {
RooBinning xbins(fRHist->GetNbinsX(),fRHist->GetXaxis()->GetXbins()->GetArray()) ;
Double_t tolerance = 1e-6*xbins.averageBinWidth() ;
// Adjust xlo/xhi to nearest boundary
Double_t xloAdj = xbins.binLow(xbins.binNumber(xlo+tolerance)) ;
Double_t xhiAdj = xbins.binHigh(xbins.binNumber(xhi-tolerance)) ;
xbins.setRange(xloAdj,xhiAdj) ;
xvar->setBinning(xbins) ;
if (fabs(xloAdj-xlo)>tolerance||fabs(xhiAdj-xhi)<tolerance) {
coutI(DataHandling) << "RooDataHist::adjustBinning(" << GetName() << "): fit range of variable " << xvar->GetName() << " expanded to nearest bin boundaries: ["
<< xlo << "," << xhi << "] --> [" << xloAdj << "," << xhiAdj << "]" << endl ;
}
} else {
RooBinning xbins(fRHist->GetXaxis()->GetXmin(),fRHist->GetXaxis()->GetXmax()) ;
xbins.addUniform(fRHist->GetNbinsX(),fRHist->GetXaxis()->GetXmin(),fRHist->GetXaxis()->GetXmax()) ;
Double_t tolerance = 1e-6*xbins.averageBinWidth() ;
// Adjust xlo/xhi to nearest boundary
Double_t xloAdj = xbins.binLow(xbins.binNumber(xlo+tolerance)) ;
Double_t xhiAdj = xbins.binHigh(xbins.binNumber(xhi-tolerance)) ;
xbins.setRange(xloAdj,xhiAdj) ;
xvar->setRange(xloAdj,xhiAdj) ;
//xvar->setRange(xlo,xhi) ;
}
return;
}