7 #include "Math/SpecFunc.h"
44 assert(!isinf(Ue4sq) && !isnan(Ue4sq));
45 const double sinsq2thetaee = 4.0*Ue4sq*(1-Ue4sq);
47 assert(sinsq2thetaee >= 0 && sinsq2thetaee <= 1);
87 assert(!isinf(Um4sq) && !isnan(Um4sq));
88 const double sinsq2thetamm = 4.0*Um4sq*(1-Um4sq);
90 assert(sinsq2thetamm >= 0 && sinsq2thetamm <= 1);
126 const double Ue4sq = 0.5 * (1.0 - std::sqrt(1.0 -
fSinSq2ThetaEE));
128 assert(!isinf(Um4sq) && !isnan(Um4sq));
129 assert(!isinf(Ue4sq) && !isnan(Ue4sq));
130 const double sinsq2thetame = 4.0*Um4sq*Ue4sq;
132 assert(sinsq2thetame >= 0 && sinsq2thetame <= 1);
134 return sinsq2thetame;
140 if(isinf(x))
return TMath::Pi()/2;
141 return ROOT::Math::sinint(x);
148 static std::map<std::tuple<double, double, double>,
double> cache;
149 const std::tuple<double, double, double> key = {
k,
a, b};
152 if(cache.size() > 100*100*10) cache.clear();
154 auto it = cache.find(key);
155 if(it != cache.end())
return it->second;
163 ret = k*(
Si(2*k/a)-
Si(2*k/b));
180 return P_range(from, to, E, E);
186 if(
abs(from) == 14 &&
abs(to) == 14){
189 else if(
abs(from) == 12 &&
abs(to) == 12){
192 else if(
abs(from) == 14 &&
abs(to) == 12){
195 else if(
abs(from) == 12 &&
abs(to) == 14){
199 else if(
abs(to) == 16){
204 else if (
abs(from) == 14 && to == 0) {
207 else if (
abs(from) == 12 && to == 0) {
211 std::cout <<
"OscCalcSterileApprox: P(" << from <<
", " << to <<
") not implemented" << std::endl;
218 if(Ehi <= 0)
return 0;
220 if(
fDmsq == 0)
return (from == to || to == 0) ? 1 : 0;
222 Elo = std::max(0., Elo);
226 assert(!isnan(Delta));
233 double LElo,
double LEhi)
235 if(
fDmsq == 0)
return (from == to || to == 0) ? 1 : 0;
237 LElo = std::max(0., LElo);
245 const double Delta = (.25*(sin(2*LElo) - sin(2*LEhi)) + .5*(LEhi - LElo))/(LEhi-LElo);
246 assert(!isnan(Delta));
274 TMD5* ret =
new TMD5;
275 const std::string txt =
"SterileApprox";
276 ret->Update((
unsigned char*)txt.c_str(), txt.size());
277 const int kNumParams = 4;
278 double angles[2] = {0, 0};
286 double buf[kNumParams] = {
fDmsq, angles[0], angles[1],
fL};
287 ret->Update((
unsigned char*)buf,
sizeof(
double)*kNumParams);
298 ret->calc.SetSinSq2ThetaMuMu(0);
300 ret->calc.SetSinSq2ThetaMuE(0);
302 ret->calc.SetSinSq2ThetaEE(0);
313 if(ret1)
return ret1;
317 if(ret2)
return &ret2->
calc;
319 if(allowFail)
return 0;
321 std::cout <<
"Calculator was not of type OscCalcSterileApprox." << std::endl;
331 if(ret1)
return ret1;
335 if(ret2)
return &ret2->
calc;
337 if(allowFail)
return 0;
339 std::cout <<
"Calculator was not of type OscCalcSterileApprox." << std::endl;
double P_LoverE(int from, int to, double LElo, double LEhi)
const OscCalcSterileApprox * DowncastToSterileApprox(const osc::IOscCalc *calc, bool allowFail)
process_name opflash particleana ie x
void SetSinSq2ThetaEE(double t)
process_name opflashCryoW ana
T sqr(T x)
More efficient square function than pow(x,2)
double GetSinSq2ThetaMuE() const
double PFromDelta(int from, int to, double Delta) const
void SetSinSq2ThetaMuE(double t)
OscCalcSterileApproxAdjustable * DefaultSterileApproxCalc(SterileOscAngles angles)
double GetSinSq2ThetaEE() const
virtual OscCalcSterileApprox * Copy() const override
double GetSinSq2ThetaMuMu() const
virtual double P(int from, int to, double E) override
OscCalcSterileApprox calc
double AvgSinSq(double k, double a, double b)
void SetSinSq2ThetaMuMu(double t)
double P_range(int from, int to, double Elo, double Ehi)
TMD5 * GetParamsHash() const override
BEGIN_PROLOG could also be cout