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: 2 additions & 0 deletions roofit/roofit/inc/RooDstD0BG.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class RooDstD0BG : public RooAbsPdf {
RooRealProxy C,A,B ;

Double_t evaluate() const;
RooSpan<double> evaluateBatch(std::size_t begin, std::size_t batchSize) const;


private:

Expand Down
3 changes: 2 additions & 1 deletion roofit/roofit/inc/RooLognormal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class RooLognormal : public RooAbsPdf {
RooRealProxy k ;

Double_t evaluate() const ;

RooSpan<double> evaluateBatch(std::size_t begin, std::size_t batchSize) const;

private:

ClassDef(RooLognormal,1) // log-normal PDF
Expand Down
4 changes: 3 additions & 1 deletion roofit/roofit/inc/RooNovosibirsk.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ class RooNovosibirsk : public RooAbsPdf {

protected:
RooRealProxy x;
RooRealProxy width;
RooRealProxy peak;
RooRealProxy width;
RooRealProxy tail;
Double_t evaluate() const;
RooSpan<double> evaluateBatch(std::size_t begin, std::size_t batchSize) const;


private:
ClassDef(RooNovosibirsk,1) // Novosibirsk PDF
Expand Down
3 changes: 3 additions & 0 deletions roofit/roofit/inc/RooUniform.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class RooUniform : public RooAbsPdf {
RooListProxy x ;

Double_t evaluate() const ;
inline RooSpan<double> evaluateBatch(std::size_t, std::size_t ) const {
return {};
}

private:

Expand Down
5 changes: 3 additions & 2 deletions roofit/roofit/inc/RooVoigtian.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ class RooVoigtian : public RooAbsPdf {
RooRealProxy sigma ;

Double_t evaluate() const ;
RooSpan<double> evaluateBatch(std::size_t begin, std::size_t batchSize) const;


private:

Double_t _invRootPi;
Bool_t _doFast;
ClassDef(RooVoigtian,1) // Voigtian PDF (Gauss (x) BreitWigner)
ClassDef(RooVoigtian,2) // Voigtian PDF (Gauss (x) BreitWigner)
};

#endif
Expand Down
33 changes: 16 additions & 17 deletions roofit/roofit/src/RooArgusBG.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ RooArgusBG is a RooAbsPdf implementation describing the ARGUS background shape.
*/

#include "RooArgusBG.h"
#include "RooFit.h"
#include "RooRealVar.h"
#include "RooRealConstant.h"
#include "RooMath.h"
Expand Down Expand Up @@ -91,7 +90,7 @@ Double_t RooArgusBG::evaluate() const {

////////////////////////////////////////////////////////////////////////////////

namespace ArgusBatchEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 19 AUGUST 2019

template<class Tm, class Tm0, class Tc, class Tp>
Expand All @@ -113,26 +112,26 @@ void compute( size_t batchSize,

RooSpan<double> RooArgusBG::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
using namespace BatchHelpers;
using namespace ArgusBatchEvaluate;

EvaluateInfo info = getInfo( {&m,&m0,&c,&p}, begin, batchSize );
auto output = _batchData.makeWritableBatchUnInit(begin, info.size);
auto mData = m.getValBatch(begin, info.size);

EvaluateInfo info = getInfo( {&m, &m0, &c, &p}, begin, batchSize );
if (info.nBatches == 0) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
return {};
}
else if (info.nBatches==1 && !mData.empty()) {
compute(info.size, output.data(), mData.data(),
BracketAdapter<double> (m0),
BracketAdapter<double> (c),
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
auto mData = m.getValBatch(begin, info.size);

if (info.nBatches==1 && !mData.empty()) {
compute(info.size, output.data(), mData.data(),
BracketAdapter<double> (m0),
BracketAdapter<double> (c),
BracketAdapter<double> (p));
}
else {
compute(info.size, output.data(),
BracketAdapterWithMask (m,m.getValBatch(begin,batchSize)),
BracketAdapterWithMask (m0,m0.getValBatch(begin,batchSize)),
BracketAdapterWithMask (c,c.getValBatch(begin,batchSize)),
BracketAdapterWithMask (p,p.getValBatch(begin,batchSize)));
compute(info.size, output.data(),
BracketAdapterWithMask (m,m.getValBatch(begin,info.size)),
BracketAdapterWithMask (m0,m0.getValBatch(begin,info.size)),
BracketAdapterWithMask (c,c.getValBatch(begin,info.size)),
BracketAdapterWithMask (p,p.getValBatch(begin,info.size)));
}
return output;
}
Expand Down
18 changes: 8 additions & 10 deletions roofit/roofit/src/RooBernstein.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Double_t RooBernstein::evaluate() const

////////////////////////////////////////////////////////////////////////////////

namespace BernsteinEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 16 AUGUST 2019

void compute( size_t batchSize, double xmax, double xmin,
Expand Down Expand Up @@ -192,17 +192,15 @@ void compute( size_t batchSize, double xmax, double xmin,

RooSpan<double> RooBernstein::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
auto xData = _x.getValBatch(begin, batchSize);
batchSize = xData.size();
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);

if (xData.empty()) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
}
else {
const double xmax = _x.max();
const double xmin = _x.min();
BernsteinEvaluate::compute(batchSize, xmax, xmin, output.data(), xData.data(), _coefList);
return {};
}

batchSize = xData.size();
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
const double xmax = _x.max();
const double xmin = _x.min();
compute(batchSize, xmax, xmin, output.data(), xData.data(), _coefList);
return output;
}

Expand Down
32 changes: 16 additions & 16 deletions roofit/roofit/src/RooBifurGauss.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Double_t RooBifurGauss::evaluate() const {

////////////////////////////////////////////////////////////////////////////////

namespace BifurGaussBatchEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 20 AUGUST 2019

template<class Tx, class Tm, class Tsl, class Tsr>
Expand All @@ -107,26 +107,26 @@ void compute( size_t batchSize,

RooSpan<double> RooBifurGauss::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
using namespace BatchHelpers;
using namespace BifurGaussBatchEvaluate;

EvaluateInfo info = getInfo( {&x,&mean,&sigmaL,&sigmaR}, begin, batchSize );
auto output = _batchData.makeWritableBatchUnInit(begin, info.size);
auto xData = x.getValBatch(begin, info.size);

EvaluateInfo info = getInfo( {&x, &mean, &sigmaL, &sigmaR}, begin, batchSize );
if (info.nBatches == 0) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
return {};
}
else if (info.nBatches==1 && !xData.empty()) {
compute(info.size, output.data(), xData.data(),
BracketAdapter<double> (mean),
BracketAdapter<double> (sigmaL),
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
auto xData = x.getValBatch(begin, info.size);

if (info.nBatches==1 && !xData.empty()) {
compute(info.size, output.data(), xData.data(),
BracketAdapter<double> (mean),
BracketAdapter<double> (sigmaL),
BracketAdapter<double> (sigmaR));
}
else {
compute(info.size, output.data(),
BracketAdapterWithMask (x,x.getValBatch(begin,batchSize)),
BracketAdapterWithMask (mean,mean.getValBatch(begin,batchSize)),
BracketAdapterWithMask (sigmaL,sigmaL.getValBatch(begin,batchSize)),
BracketAdapterWithMask (sigmaR,sigmaR.getValBatch(begin,batchSize)));
compute(info.size, output.data(),
BracketAdapterWithMask (x,x.getValBatch(begin,info.size)),
BracketAdapterWithMask (mean,mean.getValBatch(begin,info.size)),
BracketAdapterWithMask (sigmaL,sigmaL.getValBatch(begin,info.size)),
BracketAdapterWithMask (sigmaR,sigmaR.getValBatch(begin,info.size)));
}
return output;
}
Expand Down
16 changes: 7 additions & 9 deletions roofit/roofit/src/RooBreitWigner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Double_t RooBreitWigner::evaluate() const

////////////////////////////////////////////////////////////////////////////////

namespace BreitWignerBatchEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 21 August 2019

template<class Tx, class Tmean, class Twidth>
Expand All @@ -85,17 +85,19 @@ void compute( size_t batchSize,

RooSpan<double> RooBreitWigner::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
using namespace BatchHelpers;
using namespace BreitWignerBatchEvaluate;
auto xData = x.getValBatch(begin, batchSize);
auto meanData = mean.getValBatch(begin, batchSize);
auto widthData = width.getValBatch(begin, batchSize);
const bool batchX = !xData.empty();
const bool batchMean = !meanData.empty();
const bool batchWidth = !widthData.empty();

if (!batchX && !batchMean && !batchWidth) {
return {};
}
batchSize = findSize({ xData, meanData, widthData });
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);

const bool batchX = !xData.empty();
const bool batchMean = !meanData.empty();
const bool batchWidth = !widthData.empty();
if (batchX && !batchMean && !batchWidth ) {
compute(batchSize, output.data(), xData, BracketAdapter<double>(mean), BracketAdapter<double>(width));
}
Expand All @@ -117,10 +119,6 @@ RooSpan<double> RooBreitWigner::evaluateBatch(std::size_t begin, std::size_t bat
else if (batchX && batchMean && batchWidth ) {
compute(batchSize, output.data(), xData, meanData, widthData);
}
else{
throw std::logic_error("Requested a batch computation, but no batch data available.");
}

return output;
}

Expand Down
40 changes: 20 additions & 20 deletions roofit/roofit/src/RooBukinPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Double_t RooBukinPdf::evaluate() const

////////////////////////////////////////////////////////////////////////////////////////

namespace BukinBatchEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 26 JULY 2019

template<class Tx, class TXp, class TSigp, class Txi, class Trho1, class Trho2>
Expand Down Expand Up @@ -192,30 +192,30 @@ void compute( size_t batchSize,

RooSpan<double> RooBukinPdf::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
using namespace BatchHelpers;
using namespace BukinBatchEvaluate;

EvaluateInfo info = getInfo( {&x,&Xp,&sigp,&xi,&rho1,&rho2}, begin, batchSize );
auto output = _batchData.makeWritableBatchUnInit(begin, info.size);
auto xData = x.getValBatch(begin, info.size);

EvaluateInfo info = getInfo( {&x, &Xp, &sigp, &xi, &rho1, &rho2}, begin, batchSize );
if (info.nBatches == 0) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
return {};
}
else if (info.nBatches==1 && !xData.empty()) {
compute(info.size, output.data(), xData.data(),
BracketAdapter<double> (Xp),
BracketAdapter<double> (sigp),
BracketAdapter<double> (xi),
BracketAdapter<double> (rho1),
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
auto xData = x.getValBatch(begin, info.size);

if (info.nBatches==1 && !xData.empty()) {
compute(info.size, output.data(), xData.data(),
BracketAdapter<double> (Xp),
BracketAdapter<double> (sigp),
BracketAdapter<double> (xi),
BracketAdapter<double> (rho1),
BracketAdapter<double> (rho2));
}
else {
compute(info.size, output.data(),
BracketAdapterWithMask (x,x.getValBatch(begin,batchSize)),
BracketAdapterWithMask (Xp,Xp.getValBatch(begin,batchSize)),
BracketAdapterWithMask (sigp,sigp.getValBatch(begin,batchSize)),
BracketAdapterWithMask (xi,xi.getValBatch(begin,batchSize)),
BracketAdapterWithMask (rho1,rho1.getValBatch(begin,batchSize)),
BracketAdapterWithMask (rho2,rho2.getValBatch(begin,batchSize)));
compute(info.size, output.data(),
BracketAdapterWithMask (x,x.getValBatch(begin,info.size)),
BracketAdapterWithMask (Xp,Xp.getValBatch(begin,info.size)),
BracketAdapterWithMask (sigp,sigp.getValBatch(begin,info.size)),
BracketAdapterWithMask (xi,xi.getValBatch(begin,info.size)),
BracketAdapterWithMask (rho1,rho1.getValBatch(begin,info.size)),
BracketAdapterWithMask (rho2,rho2.getValBatch(begin,info.size)));
}
return output;
}
23 changes: 11 additions & 12 deletions roofit/roofit/src/RooCBShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Double_t RooCBShape::evaluate() const {

////////////////////////////////////////////////////////////////////////////////

namespace CBShapeBatchEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 21 August 2019

template<class Tm, class Tm0, class Tsigma, class Talpha, class Tn>
Expand Down Expand Up @@ -121,16 +121,15 @@ void compute( size_t batchSize,

RooSpan<double> RooCBShape::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
using namespace BatchHelpers;
using namespace CBShapeBatchEvaluate;

EvaluateInfo info = getInfo( {&m, &m0, &sigma, &alpha, &n}, begin, batchSize );
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);

auto mData = m.getValBatch(begin, info.size);
if (info.nBatches == 0) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
return {};
}
else if (info.nBatches==1 && !mData.empty()) {
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
auto mData = m.getValBatch(begin, info.size);

if (info.nBatches==1 && !mData.empty()) {
compute(info.size, output.data(), mData.data(),
BracketAdapter<double> (m0),
BracketAdapter<double> (sigma),
Expand All @@ -139,11 +138,11 @@ RooSpan<double> RooCBShape::evaluateBatch(std::size_t begin, std::size_t batchSi
}
else {
compute(info.size, output.data(),
BracketAdapterWithMask (m,m.getValBatch(begin,batchSize)),
BracketAdapterWithMask (m0,m0.getValBatch(begin,batchSize)),
BracketAdapterWithMask (sigma,sigma.getValBatch(begin,batchSize)),
BracketAdapterWithMask (alpha,alpha.getValBatch(begin,batchSize)),
BracketAdapterWithMask (n,n.getValBatch(begin,batchSize)));
BracketAdapterWithMask (m,m.getValBatch(begin,info.size)),
BracketAdapterWithMask (m0,m0.getValBatch(begin,info.size)),
BracketAdapterWithMask (sigma,sigma.getValBatch(begin,info.size)),
BracketAdapterWithMask (alpha,alpha.getValBatch(begin,info.size)),
BracketAdapterWithMask (n,n.getValBatch(begin,info.size)));
}
return output;
}
Expand Down
18 changes: 8 additions & 10 deletions roofit/roofit/src/RooChebychev.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Double_t RooChebychev::evaluate() const

////////////////////////////////////////////////////////////////////////////////

namespace ChebychevEvaluate {
namespace {
//Author: Emmanouil Michalainas, CERN 12 AUGUST 2019

void compute( size_t batchSize, double xmax, double xmin,
Expand Down Expand Up @@ -223,17 +223,15 @@ void compute( size_t batchSize, double xmax, double xmin,

RooSpan<double> RooChebychev::evaluateBatch(std::size_t begin, std::size_t batchSize) const {
auto xData = _x.getValBatch(begin, batchSize);
batchSize = xData.size();
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);

if (xData.empty()) {
throw std::logic_error("Requested a batch computation, but no batch data available.");
}
else {
const Double_t xmax = _x.max(_refRangeName?_refRangeName->GetName() : nullptr);
const Double_t xmin = _x.min(_refRangeName?_refRangeName->GetName() : nullptr);
ChebychevEvaluate::compute(batchSize, xmax, xmin, output.data(), xData.data(), _coefList);
return {};
}

batchSize = xData.size();
auto output = _batchData.makeWritableBatchUnInit(begin, batchSize);
const Double_t xmax = _x.max(_refRangeName?_refRangeName->GetName() : nullptr);
const Double_t xmin = _x.min(_refRangeName?_refRangeName->GetName() : nullptr);
compute(batchSize, xmax, xmin, output.data(), xData.data(), _coefList);
return output;
}
////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading