Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roofit/hs3/src/RooJSONFactoryWSTool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ inline bool checkRegularBins(const TAxis &ax)
double w = ax.GetXmax() - ax.GetXmin();
double bw = w / ax.GetNbins();
for (int i = 0; i <= ax.GetNbins(); ++i) {
if (fabs(ax.GetBinUpEdge(i) - (ax.GetXmin() + (bw * i))) > w * 1e-6)
if (std::abs(ax.GetBinUpEdge(i) - (ax.GetXmin() + (bw * i))) > w * 1e-6)
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions roofit/multiprocess/test/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ generate_ND_gaussian_pdf_nll(RooWorkspace &w, unsigned int n, unsigned long N_ev
double mean[n], sigma[n];
for (unsigned ix = 0; ix < n; ++ix) {
mean[ix] = RooRandom::randomGenerator()->Gaus(0, 2);
sigma[ix] = 0.1 + abs(RooRandom::randomGenerator()->Gaus(0, 2));
sigma[ix] = 0.1 + std::abs(RooRandom::randomGenerator()->Gaus(0, 2));
}

// create gaussians and also the observables and parameters they depend on
Expand Down Expand Up @@ -126,7 +126,7 @@ generate_ND_gaussian_pdf_nll(RooWorkspace &w, unsigned int n, unsigned long N_ev
std::ostringstream os;
os << "s" << ix;
dynamic_cast<RooRealVar *>(w.arg(os.str().c_str()))
->setVal(0.1 + abs(RooRandom::randomGenerator()->Gaus(0, 2)));
->setVal(0.1 + std::abs(RooRandom::randomGenerator()->Gaus(0, 2)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion roofit/roofit/src/RooBCPEffDecay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void RooBCPEffDecay::generateEvent(Int_t code)
// Accept event if T is in generated range
double maxDil = 1.0 ;
double al2 = _absLambda*_absLambda ;
double maxAcceptProb = (1+al2) + fabs(maxDil*_CPeigenval*_absLambda*_argLambda) + fabs(maxDil*(1-al2)/2);
double maxAcceptProb = (1+al2) + std::abs(maxDil*_CPeigenval*_absLambda*_argLambda) + std::abs(maxDil*(1-al2)/2);
double acceptProb = (1+al2)/2*(1-_tag*_delMistag)
- (_tag*(1-2*_avgMistag))*(_CPeigenval*_absLambda*_argLambda)*sin(_dm*tval)
- (_tag*(1-2*_avgMistag))*(1-al2)/2*cos(_dm*tval);
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofit/src/RooBCPGenDecay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void RooBCPGenDecay::generateEvent(Int_t code)
// Accept event if T is in generated range
double maxDil = 1.0 ;
// 2 in next line is conservative and inefficient - allows for delMistag=1!
double maxAcceptProb = 2 + fabs(maxDil*_avgS) + fabs(maxDil*_avgC);
double maxAcceptProb = 2 + std::abs(maxDil*_avgS) + std::abs(maxDil*_avgC);
double acceptProb = (1-_tag*_delMistag + _mu*_tag*(1. - 2.*_avgMistag))
+ (_tag*(1-2*_avgMistag) + _mu*(1. - _tag*_delMistag))*_avgS*sin(_dm*tval)
- (_tag*(1-2*_avgMistag) + _mu*(1. - _tag*_delMistag))*_avgC*cos(_dm*tval);
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofit/src/RooBDecay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void RooBDecay::generateEvent(Int_t code)

double dgt = _dgamma*t/2;
double dmt = _dm*t;
double ft = fabs(t);
double ft = std::abs(t);
double f = exp(-ft/_tau)*(_f0*cosh(dgt)+_f1*sinh(dgt)+_f2*cos(dmt)+_f3*sin(dmt));
if(f < 0) {
cout << "RooBDecay::generateEvent(" << GetName() << ") ERROR: PDF value less than zero" << endl;
Expand Down
6 changes: 3 additions & 3 deletions roofit/roofit/src/RooBukinPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ double RooBukinPdf::evaluate() const
r4=sqrt(xi*xi+1);
r1=xi/r4;

if(fabs(xi) > exp(-6.)){
if(std::abs(xi) > exp(-6.)){
r5=xi/log(r4+xi);
}
else
Expand All @@ -113,7 +113,7 @@ double RooBukinPdf::evaluate() const

//--- Center
else if(x < x2) {
if(fabs(xi) > exp(-6.)) {
if(std::abs(xi) > exp(-6.)) {
r2=log(1 + 4 * xi * r4 * (x-Xp)/hp)/log(1+2*xi*(xi-r4));
r2=-r3*r2*r2;
}
Expand All @@ -128,7 +128,7 @@ double RooBukinPdf::evaluate() const
r2=rho2*(x-x2)*(x-x2)/(Xp-x2)/(Xp-x2)-r3 - 4 * r3 * (x-x2)/hp * r5 * r4/(r4+xi)/(r4+xi);
}

if(fabs(r2) > 100){
if(std::abs(r2) > 100){
fit_result = 0;
}
else{
Expand Down
8 changes: 4 additions & 4 deletions roofit/roofit/src/RooCBShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ double RooCBShape::evaluate() const {
double t = (m-m0)/sigma;
if (alpha < 0) t = -t;

double absAlpha = fabs((double)alpha);
double absAlpha = std::abs((double)alpha);

if (t >= -absAlpha) {
return exp(-0.5*t*t);
Expand Down Expand Up @@ -119,10 +119,10 @@ double RooCBShape::analyticalIntegral(Int_t code, const char* rangeName) const
double result = 0.0;
bool useLog = false;

if( fabs(n-1.0) < 1.0e-05 )
if( std::abs(n-1.0) < 1.0e-05 )
useLog = true;

double sig = fabs((double)sigma);
double sig = std::abs((double)sigma);

double tmin = (m.min(rangeName)-m0)/sig;
double tmax = (m.max(rangeName)-m0)/sig;
Expand All @@ -133,7 +133,7 @@ double RooCBShape::analyticalIntegral(Int_t code, const char* rangeName) const
tmax = -tmp;
}

double absAlpha = fabs((double)alpha);
double absAlpha = std::abs((double)alpha);

if( tmin >= -absAlpha ) {
result += sig*sqrtPiOver2*( ApproxErf(tmax/sqrt2)
Expand Down
8 changes: 4 additions & 4 deletions roofit/roofit/src/RooGExpModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace {
double logErfC(double xx)
{
double t,z,ans;
z=fabs(xx);
z=std::abs(xx);
t=1.0/(1.0+0.5*z);

if(xx >= 0.0)
Expand Down Expand Up @@ -469,10 +469,10 @@ double RooGExpModel::calcDecayConv(double sign, double tau, double sig, double r
sign *= fsign ; // modified FMV,08/13/03

double cFly;
if ((sign<0)&&(fabs(tau-rtau)<tau/260)) {
if ((sign<0)&&(std::abs(tau-rtau)<tau/260)) {

double MeanTau=0.5*(tau+rtau);
if (fabs(xp/MeanTau)>300) {
if (std::abs(xp/MeanTau)>300) {
return 0 ;
}

Expand Down Expand Up @@ -848,7 +848,7 @@ double RooGExpModel::calcSinConvNorm(double sign, double tau, double sig, double
double term2 = evalCerfInt(-fsign, rtau, fsign*umin2, fsign*umax2, c2)*fsign*sign;

// WVE Handle 0/0 numeric divergence
if (fabs(tau-rtau)<1e-10 && fabs(term1+term2)<1e-10) {
if (std::abs(tau-rtau)<1e-10 && std::abs(term1+term2)<1e-10) {
cout << "epsilon method" << endl ;
static double epsilon = 1e-4 ;
return calcSinConvNorm(sign,tau+epsilon,sig,rtau-epsilon,fsign,rangeName) ;
Expand Down
8 changes: 4 additions & 4 deletions roofit/roofit/src/RooIntegralMorph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void RooIntegralMorph::MorphCacheElem::calculate(TIterator* dIter)
// Calculate additional offset to apply if bin ixlo does not have X value calculated at bin center
double xBinC = xmin + (i+0.5)*binw ;
double xOffset = xBinC-_calcX[i] ;
if (fabs(xOffset/binw)>1e-3) {
if (std::abs(xOffset/binw)>1e-3) {
double slope = (_yatX[i+1]-_yatX[i-1])/(_calcX[i+1]-_calcX[i-1]) ;
double newY = _yatX[i] + slope*xOffset ;
//cout << "bin " << i << " needs to be re-centered " << xOffset/binw << " slope = " << slope << " origY = " << _yatX[i] << " newY = " << newY << endl ;
Expand Down Expand Up @@ -481,7 +481,7 @@ void RooIntegralMorph::MorphCacheElem::fillGap(Int_t ixlo, Int_t ixhi, double sp


// Policy: If centration quality is better than 1% OR better than 1/10 of a bin, fill interval with linear interpolation
if (fabs(cq)<0.01 || fabs(cq*(ixhi-ixlo))<0.1 || ymid<_ycutoff ) {
if (std::abs(cq)<0.01 || std::abs(cq*(ixhi-ixlo))<0.1 || ymid<_ycutoff ) {

// Fill remaining gaps on either side with linear interpolation
if (iX-ixlo>1) {
Expand Down Expand Up @@ -584,7 +584,7 @@ void RooIntegralMorph::MorphCacheElem::findRange()

// Terminate if value of X no longer moves by >0.1 bin size
double X = _alpha->getVal()*x1 + (1-_alpha->getVal())*x2 ;
if (fabs(X-Xlast)/(xmax-xmin)<0.0001) {
if (std::abs(X-Xlast)/(xmax-xmin)<0.0001) {
break ;
}
Xlast=X ;
Expand Down Expand Up @@ -621,7 +621,7 @@ void RooIntegralMorph::MorphCacheElem::findRange()

// Terminate if value of X no longer moves by >0.1 bin size
double X = _alpha->getVal()*x1 + (1-_alpha->getVal())*x2 ;
if (fabs(X-Xlast)/(xmax-xmin)<0.0001) {
if (std::abs(X-Xlast)/(xmax-xmin)<0.0001) {
break ;
}
Xlast=X ;
Expand Down
6 changes: 3 additions & 3 deletions roofit/roofit/src/RooLagrangianMorphFunc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ inline double invertMatrix(const Matrix &matrix, Matrix &inverse)
// sanitize numeric problems
for (size_t i = 0; i < n; ++i)
for (size_t j = 0; j < n; ++j)
if (fabs(inverse(i, j)) < 1e-9)
if (std::abs(inverse(i, j)) < 1e-9)
inverse(i, j) = 0;
return condition;
}
Expand Down Expand Up @@ -1060,8 +1060,8 @@ inline void inverseSanity(const Matrix &matrix, const Matrix &inverse, double &u
if (inverse(i, j) > largestWeight) {
largestWeight = (double)inverse(i, j);
}
if (fabs(unity(i, j) - static_cast<int>(i == j)) > unityDeviation) {
unityDeviation = fabs((double)unity(i, j)) - static_cast<int>(i == j);
if (std::abs(unity(i, j) - static_cast<int>(i == j)) > unityDeviation) {
unityDeviation = std::abs((double)unity(i, j)) - static_cast<int>(i == j);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions roofit/roofit/src/RooNDKeysPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1242,9 +1242,9 @@ double RooNDKeysPdf::analyticalIntegral(Int_t code, const char* rangeName) const
chi[j] = (bi->xVarHi[j]-x[j])/weight[j];

if (chi[j]>0) // inVarRange
prob *= (0.5 + TMath::Erf(fabs(chi[j])/sqrt(2.))/2.);
prob *= (0.5 + TMath::Erf(std::abs(chi[j])/sqrt(2.))/2.);
else // outside Var range
prob *= (0.5 - TMath::Erf(fabs(chi[j])/sqrt(2.))/2.);
prob *= (0.5 - TMath::Erf(std::abs(chi[j])/sqrt(2.))/2.);
}

norm += prob * _wMap.at(_idx[bi->sIdcs[i]]);
Expand Down
4 changes: 2 additions & 2 deletions roofit/roofit/test/testRooBernstein.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void IntegrationChecker(double a0, double a1, double a2, double a3)
auto numInt_full = bern.createIntegral(x, "FULL");

// closure
EXPECT_LT(fabs(int_full->getVal() - int_range1->getVal() - int_range2->getVal() - int_range3->getVal()), 1e-10);
EXPECT_LT(fabs(numInt_full->getVal() - numInt_range1->getVal() - numInt_range2->getVal() - numInt_range3->getVal()), 1e-10);
EXPECT_LT(std::abs(int_full->getVal() - int_range1->getVal() - int_range2->getVal() - int_range3->getVal()), 1e-10);
EXPECT_LT(std::abs(numInt_full->getVal() - numInt_range1->getVal() - numInt_range2->getVal() - numInt_range3->getVal()), 1e-10);

// comparision with polynomial
double accAnaVsNum = 1.;
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooAbsCategory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ bool RooAbsCategory::isSignType(bool mustHaveZero) const
if (mustHaveZero && theStateNames.size() != 3) return false;

for (const auto& type : theStateNames) {
if (abs(type.second)>1)
if (std::abs(type.second)>1)
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooAbsPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ RooDataHist *RooAbsPdf::generateBinned(const RooArgSet &whatVars, double nEvents
// Second pass for regular mode - Trim/Extend dataset to exact number of entries

// Calculate difference between what is generated so far and what is requested
Int_t nEvtExtra = abs(Int_t(nEvents)-histOutSum) ;
Int_t nEvtExtra = std::abs(Int_t(nEvents)-histOutSum) ;
Int_t wgt = (histOutSum>nEvents) ? -1 : 1 ;

// Perform simple binned accept/reject procedure to get to exact event count
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooAbsReal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4822,7 +4822,7 @@ void RooAbsReal::checkBatchComputation(const RooBatchCompute::RunContext& evalDa
const double batchVal = batch.size() == 1 ? batch[0] : batch[evtNo];
const double relDiff = value != 0. ? (value - batchVal)/value : value - batchVal;

if (fabs(relDiff) > relAccuracy && fabs(value) > 1.E-300) {
if (std::abs(relDiff) > relAccuracy && std::abs(value) > 1.E-300) {
FormatPdfTree formatter;
formatter << "--> (Batch computation wrong:)\n";
printStream(formatter.stream(), kName | kClassName | kArgs | kExtras | kAddress, kInline);
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooAbsRealLValue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ bool RooAbsRealLValue::fitRangeOKForPlotting() const
bool RooAbsRealLValue::inRange(const char* name) const
{
const double val = getVal() ;
const double epsilon = 1e-8 * fabs(val) ;
const double epsilon = 1e-8 * std::abs(val) ;
if (!name || name[0] == '\0') {
const auto minMax = getRange(nullptr);
return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofitcore/src/RooBinnedGenContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ RooDataSet *RooBinnedGenContext::generate(double nEvt, bool /*skipInit*/, bool e
// Second pass for regular mode - Trim/Extend dataset to exact number of entries

// Calculate difference between what is generated so far and what is requested
Int_t nEvtExtra = abs(Int_t(nEvents)-histOutSum) ;
Int_t nEvtExtra = std::abs(Int_t(nEvents)-histOutSum) ;
Int_t wgt = (histOutSum>nEvents) ? -1 : 1 ;

// Perform simple binned accept/reject procedure to get to exact event count
Expand Down
14 changes: 7 additions & 7 deletions roofit/roofitcore/src/RooBrentRootFinder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool RooBrentRootFinder::findRoot(double &result, double xlo, double xhi, double
e = b - a;
}

if (fabs (fc) < fabs (fb)) {
if (std::abs(fc) < std::abs(fb)) {
ac_equal = true;
a = b;
b = c;
Expand All @@ -90,18 +90,18 @@ bool RooBrentRootFinder::findRoot(double &result, double xlo, double xhi, double
fc = fa;
}

double tol = 0.5 * _tol * fabs(b);
double tol = 0.5 * _tol * std::abs(b);
double m = 0.5 * (c - b);


if (fb == 0 || fabs(m) <= tol) {
if (fb == 0 || std::abs(m) <= tol) {
//cout << "RooBrentRootFinder: iter = " << iter << " m = " << m << " tol = " << tol << endl ;
result= b;
_function->restoreXVec() ;
return true;
}

if (fabs (e) < tol || fabs (fa) <= fabs (fb)) {
if (std::abs(e) < tol || std::abs(fa) <= std::abs(fb)) {
// Bounds decreasing too slowly: use bisection
d = m;
e = m;
Expand Down Expand Up @@ -129,8 +129,8 @@ bool RooBrentRootFinder::findRoot(double &result, double xlo, double xhi, double
p = -p;
}

double min1= 3 * m * q - fabs (tol * q);
double min2= fabs (e * q);
double min1= 3 * m * q - std::abs(tol * q);
double min2= std::abs(e * q);
if (2 * p < (min1 < min2 ? min1 : min2)) {
// Accept the interpolation
e = d;
Expand All @@ -146,7 +146,7 @@ bool RooBrentRootFinder::findRoot(double &result, double xlo, double xhi, double
a = b;
fa = fb;
// Evaluate new trial root
if (fabs (d) > tol) {
if (std::abs(d) > tol) {
b += d;
}
else {
Expand Down
12 changes: 6 additions & 6 deletions roofit/roofitcore/src/RooCurve.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void RooCurve::addRange(const RooAbsFunc& func, double x1, double x2,
Int_t numee, bool doEEVal, double eeVal)
{
// Explicitly skip empty ranges to eliminate point duplication
if (fabs(x2-x1)<1e-20) {
if (std::abs(x2-x1)<1e-20) {
return ;
}

Expand All @@ -449,7 +449,7 @@ void RooCurve::addRange(const RooAbsFunc& func, double x1, double x2,

// test if the midpoint is sufficiently close to a straight line across this interval
double dy= ymid - 0.5*(y1+y2);
if((xmid - x1 >= minDx) && fabs(dy)>0 && fabs(dy) >= minDy) {
if((xmid - x1 >= minDx) && std::abs(dy)>0 && std::abs(dy) >= minDy) {
// fill in each subrange
addRange(func,x1,xmid,y1,ymid,minDy,minDx,numee,doEEVal,eeVal);
addRange(func,xmid,x2,ymid,y2,minDy,minDx,numee,doEEVal,eeVal);
Expand Down Expand Up @@ -671,8 +671,8 @@ Int_t RooCurve::findPoint(double xvalue, double tolerance) const
Int_t ibest(-1) ;
for (i=0 ; i<n ; i++) {
GetPoint(i,x,y);
if (fabs(xvalue-x)<delta) {
delta = fabs(xvalue-x) ;
if (std::abs(xvalue-x)<delta) {
delta = std::abs(xvalue-x) ;
ibest = i ;
}
}
Expand All @@ -697,7 +697,7 @@ double RooCurve::interpolate(double xvalue, double tolerance) const
const_cast<RooCurve*>(this)->GetPoint(ibest,xbest,ybest) ;

// Handle trivial case of being dead on
if (fabs(xbest-xvalue)<tolerance) {
if (std::abs(xbest-xvalue)<tolerance) {
return ybest ;
}

Expand Down Expand Up @@ -897,7 +897,7 @@ bool RooCurve::isIdentical(const RooCurve& other, double tol, bool verbose) cons
bool ret(true) ;
for(Int_t i= 2; i < n-2; i++) {
double yTest = interpolate(other.fX[i],1e-10) ;
double rdy = fabs(yTest-other.fY[i])/Yrange ;
double rdy = std::abs(yTest-other.fY[i])/Yrange ;
if (rdy>tol) {
ret = false;
if(!verbose) continue;
Expand Down
6 changes: 3 additions & 3 deletions roofit/roofitcore/src/RooDataHist.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ void RooDataHist::_adjustBinning(RooRealVar &theirVar, const TAxis &axis,

theirVar.setBinning(xbins);

if (true || fabs(xloAdj - xlo) > tolerance || fabs(xhiAdj - xhi) > tolerance) {
if (true || std::abs(xloAdj - xlo) > tolerance || std::abs(xhiAdj - xhi) > tolerance) {
coutI(DataHandling) << "RooDataHist::adjustBinning(" << ownName << "): fit range of variable " << ourVarName
<< " expanded to nearest bin boundaries: [" << xlo << "," << xhi << "] --> [" << xloAdj
<< "," << xhiAdj << "]"
Expand All @@ -708,7 +708,7 @@ void RooDataHist::_adjustBinning(RooRealVar &theirVar, const TAxis &axis,
xbins.setRange(xloAdj, xhiAdj);
theirVar.setRange(xloAdj, xhiAdj);

if (fabs(xloAdj - xlo) > tolerance || fabs(xhiAdj - xhi) > tolerance) {
if (std::abs(xloAdj - xlo) > tolerance || std::abs(xhiAdj - xhi) > tolerance) {
coutI(DataHandling) << "RooDataHist::adjustBinning(" << ownName << "): fit range of variable " << ourVarName
<< " expanded to nearest bin boundaries: [" << xlo << "," << xhi << "] --> [" << xloAdj
<< "," << xhiAdj << "]"
Expand Down Expand Up @@ -2228,7 +2228,7 @@ bool RooDataHist::isNonPoissonWeighted() const
for (Int_t i=0; i < _arrSize; ++i) {
const double wgt = _wgt[i];
double intpart;
if (fabs(std::modf(wgt, &intpart)) > 1.E-10)
if (std::abs(std::modf(wgt, &intpart)) > 1.E-10)
return true;
}

Expand Down
Loading