43 inline double a(
int p,
int l,
int m) {
46 return p%2==0 ?
r : -
r ;
49 void throwIfNoMathMore() {
50#ifndef R__HAS_MATHMORE
51 throw std::runtime_error(
"RooLegendre needs functions from MathMore. It is not available in this root build.");
55 void checkCoeffs(
int m1,
int l1,
int m2,
int l2) {
56 if (m1 < 0 ||
m2 < 0) {
57 throw std::invalid_argument(
"RooLegendre: m coefficients need to be >= 0.");
59 if (l1 < m1 || l2 <
m2) {
60 throw std::invalid_argument(
"RooLegendre: m coefficients need to be smaller than corresponding l.");
68 _l1(1),_m1(1),_l2(0),_m2(0)
79 , _ctheta(
"ctheta",
"ctheta", this, ctheta)
80 , _l1(
l),_m1(
m),_l2(0),_m2(0)
91 , _ctheta(
"ctheta",
"ctheta", this, ctheta)
92 , _l1(l1),_m1(m1),_l2(l2),_m2(
m2)
103 , _ctheta(
"ctheta", this, other._ctheta)
104 , _l1(other._l1), _m1(other._m1)
105 , _l2(other._l2), _m2(other._m2)
114#ifdef R__HAS_MATHMORE
116 double ctheta = std::max(-1., std::min((
double)
_ctheta, +1.));
133void compute(
size_t batchSize,
const int l1,
const int m1,
const int l2,
const int m2,
134 double * __restrict
output,
135 double const * __restrict TH)
137#ifdef R__HAS_MATHMORE
138 double legendre1=1.0, legendreMinus1=1.0;
148 for (
size_t i=0; i<batchSize; i++) {
150 output[i] = legendreMinus1;
151 }
else if (TH[i] >= 1.0) {
175 if (cthetaData.empty()) {
179 batchSize = cthetaData.size();
193 return range == 0 || strlen(range) == 0
226 for (
int p1=0; 2*p1 <=
_l1-
_m1 ;++p1) {
228 for (
int p2=0; 2*p2 <=
_l2-
_m2 ; ++p2) {
242 if (
_m1==0&&
_m2==0)
return 1;
244 if (
_l1<3&&
_l2<3)
return 1;
249 inline double maxSingle(
int i,
int j) {
257 static const double m2[3] = { 3,3 };
double pow(double, double)
typedef void((*Func_t)())
RooSpan< double > makeWritableBatchUnInit(std::size_t begin, std::size_t batchSize, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified)
Make a batch and return a span pointing to the pdf-local memory.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
BatchHelpers::BatchData _batchData
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Compute the associated Legendre polynomials using ROOT::Math::assoc_legendre().
RooSpan< double > evaluateBatch(std::size_t begin, std::size_t batchSize) const
Evaluate function for a batch of input data points.
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Double_t evaluate() const
Note: P_0^0 = 1, so P_l^m = P_l^m P_0^0.
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
this was verified to match mathematica for l1 in [0,2], m1 in [0,l1], l2 in [l1,4],...
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
virtual Int_t getMaxVal(const RooArgSet &vars) const
Advertise capability to determine maximum value of function for given set of observables.
A simple container to hold a batch of data values.
RooSpan< const typename T::value_type > getValBatch(std::size_t begin, std::size_t batchSize) const
Retrieve a batch of real or category data.
double assoc_legendre(unsigned l, unsigned m, double x)
Computes the associated Legendre polynomials.
double legendre(unsigned l, unsigned m, double x)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
static constexpr double m2
Double_t Factorial(Int_t i)
Compute factorial(n).
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
static void output(int code)