14 template<
class T,
class U>
T GetValAs(
const U&
x){
return x;}
22 #include <Eigen/Dense> 26 template<
class T> Eigen::Array<T, Eigen::Dynamic, 1>
_IOscCalc<T>:: 27 P(
int flavBefore,
int flavAfter,
const std::vector<double>&
E)
29 Eigen::Matrix<T,Eigen::Dynamic,1>
ret(E.size());
30 for(
auto i = 0
u;
i < E.size();
i++) {
31 ret(
i) = this->
P(flavBefore, flavAfter, E[
i]);
33 return ret.array().isNaN().select(0,
ret);
36 template<
class T> Eigen::Array<T, Eigen::Dynamic, 1>
_IOscCalc<T>:: 37 P(
int flavBefore,
int flavAfter,
const Eigen::ArrayXd&
E)
39 return P(flavBefore, flavAfter, std::vector<double>(&E[0], &E[0]+E.size()));
52 ret->Update((
unsigned char*)txt.c_str(), txt.size());
53 const int kNumParams = 8;
54 T buf[kNumParams] = {fRho, fL, fDmsq21, fDmsq32,
55 fTh12, fTh13, fTh23, fdCP};
56 ret->Update((
unsigned char*)buf,
sizeof(
T)*kNumParams);
61 template <
typename T,
typename U>
virtual void SetL(double L)=0
virtual void SetDmsq21(const T &dmsq21)=0
General interface to oscillation calculators.
virtual double GetL() const
virtual void SetTh13(const T &th13)=0
virtual T GetTh23() const
virtual void SetDmsq32(const T &dmsq32)=0
T GetValAs(const stan::math::var &val)
explicit specialization for double return value
TMD5 * GetParamsHashDefault(const std::string &txt) const
This is only a safe implementation if your calculator only depends on these eight parameters...
#define P(a, b, c, d, e, x)
void CopyParams(const osc::_IOscCalcAdjustable< T > *inCalc, osc::_IOscCalcAdjustable< U > *outCalc)
Copy parameters from one calculator to another, irrespective of their type.
virtual T GetDmsq32() const
virtual T GetTh12() const
Oscillation probability calculators.
virtual T GetTh13() const
virtual T P(int flavBefore, int flavAfter, double E)=0
E in GeV; flavors as PDG codes (so, neg==>antinu)
virtual T GetDmsq21() const
virtual void SetRho(double rho)=0
virtual Eigen::Array< T, Eigen::Dynamic, 1 > P(int flavBefore, int flavAfter, const std::vector< double > &E)
virtual ~_IOscCalcAdjustable()
virtual void SetTh23(const T &th23)=0
General interface to any calculator that lets you set the parameters.
assert(nhit_max >=nhit_nbins)
virtual double GetRho() const
virtual void SetTh12(const T &th12)=0
virtual void SetdCP(const T &dCP)=0