38static inline double fast_fma(
39 const double x,
const double y,
const double z)
noexcept
41#if defined(FP_FAST_FMA)
42 return std::fma(
x,
y, z);
46#pragma STDC FP_CONTRACT ON
53enum class Kind :
int { First = 1, Second = 2 };
60template <
typename T, Kind KIND>
61class ChebychevIterator {
69 constexpr ChebychevIterator() =
default;
71 ChebychevIterator(
const ChebychevIterator &) =
default;
73 ChebychevIterator(ChebychevIterator &&) =
default;
75 constexpr ChebychevIterator(
const T &
x)
76 : _curr(static_cast<
int>(KIND) *
x), _twox(2 *
x)
80 ChebychevIterator &
operator=(
const ChebychevIterator &) =
default;
82 ChebychevIterator &
operator=(ChebychevIterator &&) =
default;
85 constexpr inline T operator*() const noexcept {
return _last; }
87 constexpr inline T lookahead() const noexcept {
return _curr; }
89 inline ChebychevIterator &operator++() noexcept
92 T newval = _twox*_curr -_last;
98 inline ChebychevIterator operator++(
int)
noexcept
100 ChebychevIterator retVal(*
this);
119 _x(
"x",
"Dependent", this,
x),
120 _coefList(
"coefficients",
"List of coefficients",this),
123 for (
const auto coef : coefList) {
125 coutE(InputArguments) <<
"RooChebychev::ctor(" <<
GetName() <<
126 ") ERROR: coefficient " << coef->
GetName() <<
127 " is not of type RooAbsReal" << std::endl ;
128 throw std::invalid_argument(
"Wrong input arguments for RooChebychev");
138 _x(
"x", this, other._x),
139 _coefList(
"coefList",this,other._coefList),
140 _refRangeName(other._refRangeName)
168 using size_type =
typename RooListProxy::Storage_t::size_type;
172 ChebychevIterator<double, Kind::First> chit(
x);
174 for (size_type i = 0; iend != i; ++i, ++chit) {
209 assert(1 == code); (void)code;
215 const double b = (
_x.
max(rangeName) - mid) / halfrange;
216 const double a = (
_x.
min(rangeName) - mid) / halfrange;
232 using size_type =
typename RooListProxy::Storage_t::size_type;
241 ChebychevIterator<double, Kind::First> bit(
b), ait(
a);
244 for (size_type i = 1; iend != i; ++i) {
247 const double term2 = (*bit - *ait) / nminus1;
248 ++bit, ++ait, ++nminus1;
249 const double term1 = (bit.lookahead() - ait.lookahead()) / (nminus1 + 1.);
250 const double intTn = 0.5 * (term1 - term2);
Binding & operator=(OUT(*fun)(void))
TTime operator*(const TTime &t1, const TTime &t2)
Storage_t::size_type size() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual void compute(cudaStream_t *, Computer, RestrictArr, size_t, const VarVector &, ArgVector &)=0
Chebychev polynomial p.d.f.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
void selectNormalizationRange(const char *rangeName=nullptr, bool force=false) override
Interface function to force use of a given normalization range to interpret function value.
double evalAnaInt(const double a, const double b) const
void computeBatch(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Compute multiple values of Chebychev.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
RooSpan< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
const TNamed * constPtr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
static RooNameReg & instance()
Return reference to singleton instance.
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
R__EXTERN RooBatchComputeInterface * dispatchCUDA
R__EXTERN RooBatchComputeInterface * dispatchCPU
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
std::vector< double > ArgVector
static uint64_t sum(uint64_t i)