Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
osc::analytic::_OscCalc< T > Class Template Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-24/CAFAna/Core/StanTypedefs.h"

Inheritance diagram for osc::analytic::_OscCalc< T >:
osc::_IOscCalcAdjustable< T > osc::analytic::ProbCache< double, T > osc::analytic::ProbCache< Eigen::ArrayXd, Eigen::ArrayX< T > > osc::_IOscCalc< T >

Public Member Functions

 _OscCalc ()
 
virtual ~_OscCalc ()
 
virtual _IOscCalcAdjustable< T > * Copy () const override
 
virtual void SetL (double L) override
 
virtual void SetRho (double rho) override
 
virtual void SetDmsq21 (const T &dmsq21) override
 
virtual void SetDmsq32 (const T &dmsq32) override
 
virtual void SetTh12 (const T &th12) override
 
virtual void SetTh13 (const T &th13) override
 
virtual void SetTh23 (const T &th23) override
 
virtual void SetdCP (const T &dCP) override
 
virtual T P (int from, int to, double E) override
 E in GeV; flavors as PDG codes (so, neg==>antinu) More...
 
virtual Eigen::ArrayX< TP (int from, int to, const std::vector< double > &E) override
 
virtual Eigen::ArrayX< TP (int from, int to, const Eigen::ArrayXd &E) override
 
virtual TMD5 * GetParamsHash () const override
 Use to check two calculators are in the same state. More...
 
virtual double GetL () const
 
virtual double GetRho () const
 
virtual T GetDmsq21 () const
 
virtual T GetDmsq32 () const
 
virtual T GetTh12 () const
 
virtual T GetTh13 () const
 
virtual T GetTh23 () const
 
virtual T GetdCP () const
 
virtual void InvalidateCache ()
 Invalidate any caching used internally by the calculator. More...
 

Protected Member Functions

void ClearProbCaches ()
 
template<class VT , class KVT >
VT _P (int from, int to, const KVT &E)
 
 __attribute__ ((always_inline)) void UpdatePMNS()
 
 __attribute__ ((always_inline)) void UpdateHamiltonian()
 
 __attribute__ ((always_inline)) double Hmat()
 
TMD5 * GetParamsHashDefault (const std::string &txt) const
 This is only a safe implementation if your calculator only depends on these eight parameters. More...
 

Protected Attributes

bool fDirty12
 
bool fDirty13
 
bool fDirty23
 
bool fDirtyCP
 
bool fDirtyMasses
 
T s12
 
T c12
 
T s13
 
T c13
 
T s23
 
T c23
 
T sCP
 
T cCP
 
T Ue2
 
cmplx< TUe3
 
cmplx< TUm2
 
T Um3
 
cmplx< TUt2
 
T Ut3
 
T Hee
 
cmplx< THem
 
cmplx< THet
 
T Hmm
 
cmplx< THmt
 
T Htt
 
double fRho
 
double fL
 
T fDmsq21
 
T fDmsq32
 
T fTh12
 
T fTh13
 
T fTh23
 
T fdCP
 

Private Member Functions

 _OscCalc (const _OscCalc &)=default
 
_OscCalcoperator= (const _OscCalc &)=default
 

Detailed Description

template<class T>
class osc::analytic::_OscCalc< T >

Definition at line 34 of file StanTypedefs.h.

Constructor & Destructor Documentation

template<class T >
osc::analytic::_OscCalc< T >::_OscCalc ( )

Definition at line 100 of file OscCalcAnalytic.cxx.

template<class T >
osc::analytic::_OscCalc< T >::~_OscCalc ( )
virtual

Definition at line 108 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::Copy().

109  {
110  }
template<class T>
osc::analytic::_OscCalc< T >::_OscCalc ( const _OscCalc< T > &  )
privatedefault

Member Function Documentation

template<class T>
osc::analytic::_OscCalc< T >::__attribute__ ( (always_inline)  )
inlineprotected
template<class T>
osc::analytic::_OscCalc< T >::__attribute__ ( (always_inline)  )
inlineprotected
template<class T>
osc::analytic::_OscCalc< T >::__attribute__ ( (always_inline)  )
inlineprotected
template<class T >
template<class VT , class KVT >
VT osc::analytic::_OscCalc< T >::_P ( int  from,
int  to,
const KVT &  E 
)
protected

Actual implementation of P(). VT is potentially a vector type, if a vector of energies is passed in. KVT != VT in the case T is a stan type.

Definition at line 344 of file OscCalcAnalytic.cxx.

References ana::assert(), osc::analytic::_OscCalc< T >::c12, osc::analytic::_OscCalc< T >::c13, osc::analytic::_OscCalc< T >::c23, osc::analytic::_OscCalc< T >::cCP, osc::analytic::cmplx< T, U >::conj(), E, osc::analytic::Hermitian< T >::ee, osc::analytic::Hermitian< T >::em, osc::analytic::Hermitian< T >::et, osc::_IOscCalcAdjustable< T >::fdCP, osc::analytic::_OscCalc< T >::fDirty12, osc::analytic::_OscCalc< T >::fDirty13, osc::analytic::_OscCalc< T >::fDirty23, osc::analytic::_OscCalc< T >::fDirtyCP, osc::analytic::_OscCalc< T >::fDirtyMasses, osc::_IOscCalcAdjustable< T >::fL, osc::_IOscCalcAdjustable< T >::fTh12, osc::_IOscCalcAdjustable< T >::fTh13, osc::_IOscCalcAdjustable< T >::fTh23, osc::analytic::_OscCalc< T >::Hee, osc::analytic::_OscCalc< T >::Hem, osc::analytic::_OscCalc< T >::Het, osc::analytic::_OscCalc< T >::Hmm, osc::analytic::_OscCalc< T >::Hmt, osc::analytic::_OscCalc< T >::Htt, it, osc::analytic::Hermitian< T >::mm, osc::analytic::Hermitian< T >::mt, norm, osc::analytic::_OscCalc< T >::P(), nd_projection_maker::ps, osc::analytic::_OscCalc< T >::s12, osc::analytic::_OscCalc< T >::s13, osc::analytic::_OscCalc< T >::s23, osc::analytic::_OscCalc< T >::sCP, sincos(), osc::analytic::Eigenvalues< T >::sume, osc::analytic::Eigenvalues< T >::sumxe, osc::analytic::Eigenvalues< T >::sumxxe, and osc::analytic::Hermitian< T >::tt.

Referenced by osc::analytic::SolveCubic().

345  {
346  // -E effectively flips rho and conjugates H
347  if(from < 0) return P(-from, -to, -E);
348 
349  assert(from > 0 && to > 0);
350 
351  assert(from == 12 || from == 14 || from == 16);
352  assert(to == 12 || to == 14 || to == 16);
353 
354  const bool dirtyAngles = fDirty12 || fDirty13 || fDirty23 || fDirtyCP;
355 
356  if(dirtyAngles){
357  if(fDirty12) sincos(this->fTh12, &s12, &c12);
358  if(fDirty13) sincos(this->fTh13, &s13, &c13);
359  if(fDirty23) sincos(this->fTh23, &s23, &c23);
360  if(fDirtyCP) sincos(this->fdCP, &sCP, &cCP);
361  UpdatePMNS();
362  UpdateHamiltonian();
363  }
364  else{
365  if(fDirtyMasses){
366  UpdateHamiltonian();
367  }
368  else{
369  auto it = ProbCache<KVT, VT>::find(E);
370  if(it != ProbCache<KVT, VT>::end()) return it->second.P(from, to);
371  }
372  }
373 
375 
376  const KVT k = -this->fL * 2*1.267 / E;
377  Hermitian<VT> M;
378  M.ee = Hee * k - this->fL * Hmat();
379  M.em = Hem * k;
380  M.mm = Hmm * k;
381  M.et = Het * k;
382  M.mt = Hmt * k;
383  M.tt = Htt * k;
384 
385  // Matrix exponent is based on https://www.wolframalpha.com/input/?i=matrixExp+%5B%5Br%2Cs%2Ct%5D%2C%5Bu%2Cv%2Cw%5D%2C%5Bx%2Cy%2Cz%5D%5D
386 
387  const Eigenvalues<VT> es = M.GetEigenvalues();
388  const VT Aee = M.mm*M.tt - M.mt.norm();
389  const VT Amm = M.ee*M.tt - M.et.norm();
390  const cmplx<VT> Aem = M.et*M.mt.conj() - M.em*M.tt;
391 
392  const Probs<VT> ps((Aee *es.sume - (M.mm+M.tt) *es.sumxe + es.sumxxe).norm(),
393  (Aem.conj()*es.sume + M.em.conj()*es.sumxe ).norm(),
394  (Aem *es.sume + M.em *es.sumxe ).norm(),
395  (Amm *es.sume - (M.ee+M.tt) *es.sumxe + es.sumxxe).norm());
396 
397  ProbCache<KVT, VT>::emplace(E, ps);
398 
399  return ps.P(from, to);
400  }
set< int >::iterator it
void sincos(T &x, Eigen::ArrayX< U > *sx, Eigen::ArrayX< U > *cx)
Float_t E
Definition: plot.C:20
Float_t norm
assert(nhit_max >=nhit_nbins)
virtual T P(int from, int to, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
template<class T>
void osc::analytic::_OscCalc< T >::ClearProbCaches ( )
inlineprotected

Definition at line 132 of file OscCalcAnalytic.h.

References clear.

Referenced by osc::analytic::_OscCalc< T >::SetL(), osc::analytic::_OscCalc< T >::SetRho(), and osc::analytic::SolveCubic().

133  {
135  ProbCache<Eigen::ArrayXd, Eigen::ArrayX<T>>::clear();
136  }
vector< vector< double > > clear
template<class T >
_IOscCalcAdjustable< T > * osc::analytic::_OscCalc< T >::Copy ( ) const
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 114 of file OscCalcAnalytic.cxx.

Referenced by osc::analytic::_OscCalc< T >::~_OscCalc().

115  {
116  return new _OscCalc<T>(*this);
117  }
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetdCP ( ) const
inlinevirtualinherited
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetDmsq21 ( ) const
inlinevirtualinherited
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetDmsq32 ( ) const
inlinevirtualinherited
template<typename T>
virtual double osc::_IOscCalcAdjustable< T >::GetL ( ) const
inlinevirtualinherited
template<class T >
TMD5 * osc::analytic::_OscCalc< T >::GetParamsHash ( ) const
overridevirtual

Use to check two calculators are in the same state.

Returns
Null means not implemented for this calculator

Reimplemented from osc::_IOscCalc< T >.

Definition at line 192 of file OscCalcAnalytic.cxx.

References osc::_IOscCalcAdjustable< T >::fRho, osc::_IOscCalcAdjustable< T >::GetParamsHashDefault(), and std::sqrt().

193  {
195  }
TMD5 * GetParamsHashDefault(const std::string &txt) const
This is only a safe implementation if your calculator only depends on these eight parameters...
Definition: IOscCalc.cxx:49
template<typename T >
TMD5 * osc::_IOscCalcAdjustable< T >::GetParamsHashDefault ( const std::string txt) const
protectedinherited

This is only a safe implementation if your calculator only depends on these eight parameters.

Parameters
txtA string to uniquely identify your calculator class

Definition at line 49 of file IOscCalc.cxx.

References runNovaSAM::ret, and T.

Referenced by osc::_OscCalcPMNS< T >::GetParamsHash(), osc::_OscCalcPMNSOpt< T >::GetParamsHash(), and osc::analytic::_OscCalc< T >::GetParamsHash().

50  {
51  TMD5* ret = new TMD5;
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);
57  ret->Final();
58  return ret;
59  }
double T
Definition: Xdiff_gwt.C:5
template<typename T>
virtual double osc::_IOscCalcAdjustable< T >::GetRho ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT, and osc::OscCalcSterile.

Definition at line 89 of file IOscCalc.h.

Referenced by osc::CopyParams(), osc::OscCalcCPT::GetRho(), ana::ResetSterileCalcToDefault(), and ana::SaveTo().

89 { return fRho ; }
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetTh12 ( ) const
inlinevirtualinherited
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetTh13 ( ) const
inlinevirtualinherited
template<typename T>
virtual T osc::_IOscCalcAdjustable< T >::GetTh23 ( ) const
inlinevirtualinherited
template<typename T>
virtual void osc::_IOscCalcAdjustable< T >::InvalidateCache ( )
inlinevirtualinherited

Invalidate any caching used internally by the calculator.

Some calculators use a cache that can become stale in ways that the calculator may not know about (e.g., Stan var clearing). Default implementation does nothing.

Reimplemented in osc::_OscCalcDMP< T >.

Definition at line 102 of file IOscCalc.h.

102 {};
template<class T>
_OscCalc& osc::analytic::_OscCalc< T >::operator= ( const _OscCalc< T > &  )
privatedefault
template<class T >
T osc::analytic::_OscCalc< T >::P ( int  flavBefore,
int  flavAfter,
double  E 
)
overridevirtual

E in GeV; flavors as PDG codes (so, neg==>antinu)

Implements osc::_IOscCalc< T >.

Definition at line 403 of file OscCalcAnalytic.cxx.

References E.

Referenced by osc::analytic::_OscCalc< T >::_P(), and osc::analytic::_OscCalc< T >::P().

404  {
405  return _P<T>(from, to, E);
406  }
Float_t E
Definition: plot.C:20
template<class T >
Eigen::ArrayX< T > osc::analytic::_OscCalc< T >::P ( int  flavBefore,
int  flavAfter,
const std::vector< double > &  E 
)
overridevirtual

Default implementation forwards to non-vector version using a simple loop. Override if your calculator has a more efficient implementation.

Reimplemented from osc::_IOscCalc< T >.

Definition at line 417 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::P().

418  {
419  // Forward to the eigen implementation
420  return P(from, to, Eigen::Map<const Eigen::ArrayXd>(E.data(), E.size()));
421  }
Float_t E
Definition: plot.C:20
virtual T P(int from, int to, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
template<class T >
Eigen::ArrayX< T > osc::analytic::_OscCalc< T >::P ( int  flavBefore,
int  flavAfter,
const Eigen::ArrayXd &  E 
)
overridevirtual

Default implementation forawrds to vector<double> version. Override if your calculator has a more efficient implementation.

Reimplemented from osc::_IOscCalc< T >.

Definition at line 410 of file OscCalcAnalytic.cxx.

References E, and osc::analytic::_OscCalc< T >::P().

411  {
412  return _P<Eigen::Array<T, Eigen::Dynamic, 1>>(from, to, E);
413  }
Float_t E
Definition: plot.C:20
template<class T >
void osc::analytic::_OscCalc< T >::SetdCP ( const T dCP)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 183 of file OscCalcAnalytic.cxx.

References delta, osc::_IOscCalcAdjustable< T >::fdCP, and osc::analytic::_OscCalc< T >::fDirtyCP.

184  {
185  if constexpr(std::is_arithmetic_v<T>) if(delta == this->fdCP) return;
186 
187  this->fdCP = delta;
188  fDirtyCP = true;
189  }
double delta
Definition: runWimpSim.h:98
if(dump)
template<class T >
void osc::analytic::_OscCalc< T >::SetDmsq21 ( const T dmsq21)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 138 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::fDirtyMasses, and osc::_IOscCalcAdjustable< T >::fDmsq21.

139  {
140  if constexpr(std::is_arithmetic_v<T>) if(dmsq21 == this->fDmsq21) return;
141 
142  this->fDmsq21 = dmsq21;
143  fDirtyMasses = true;
144  }
if(dump)
template<class T >
void osc::analytic::_OscCalc< T >::SetDmsq32 ( const T dmsq32)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 147 of file OscCalcAnalytic.cxx.

References dmsq32, osc::analytic::_OscCalc< T >::fDirtyMasses, and osc::_IOscCalcAdjustable< T >::fDmsq32.

148  {
149  if constexpr(std::is_arithmetic_v<T>) if(dmsq32 == this->fDmsq32) return;
150 
151  this->fDmsq32 = dmsq32;
152  fDirtyMasses = true;
153  }
if(dump)
double dmsq32
template<class T >
void osc::analytic::_OscCalc< T >::SetL ( double  L)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 120 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::ClearProbCaches(), osc::_IOscCalcAdjustable< T >::fL, and CLHEP::L.

121  {
122  if(L == this->fL) return;
123 
124  this->fL = L;
125  ClearProbCaches();
126  }
static constexpr double L
template<class T >
void osc::analytic::_OscCalc< T >::SetRho ( double  rho)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 129 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::ClearProbCaches(), and osc::_IOscCalcAdjustable< T >::fRho.

130  {
131  if(rho == this->fRho) return;
132 
133  this->fRho = rho;
134  ClearProbCaches();
135  }
template<class T >
void osc::analytic::_OscCalc< T >::SetTh12 ( const T th12)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 174 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::fDirty12, osc::_IOscCalcAdjustable< T >::fTh12, and th12.

175  {
176  if constexpr(std::is_arithmetic_v<T>) if(th12 == this->fTh12) return;
177 
178  this->fTh12 = th12;
179  fDirty12 = true;
180  }
double th12
Definition: runWimpSim.h:98
if(dump)
template<class T >
void osc::analytic::_OscCalc< T >::SetTh13 ( const T th13)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 165 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::fDirty13, osc::_IOscCalcAdjustable< T >::fTh13, and th13.

166  {
167  if constexpr(std::is_arithmetic_v<T>) if(th13 == this->fTh13) return;
168 
169  this->fTh13 = th13;
170  fDirty13 = true;
171  }
if(dump)
double th13
Definition: runWimpSim.h:98
template<class T >
void osc::analytic::_OscCalc< T >::SetTh23 ( const T th23)
overridevirtual

Implements osc::_IOscCalcAdjustable< T >.

Definition at line 156 of file OscCalcAnalytic.cxx.

References osc::analytic::_OscCalc< T >::fDirty23, osc::_IOscCalcAdjustable< T >::fTh23, and th23.

157  {
158  if constexpr(std::is_arithmetic_v<T>) if(th23 == this->fTh23) return;
159 
160  this->fTh23 = th23;
161  fDirty23 = true;
162  }
double th23
Definition: runWimpSim.h:98
if(dump)

Member Data Documentation

template<class T>
T osc::analytic::_OscCalc< T >::c12
protected
template<class T>
T osc::analytic::_OscCalc< T >::c13
protected
template<class T>
T osc::analytic::_OscCalc< T >::c23
protected
template<class T>
T osc::analytic::_OscCalc< T >::cCP
protected
template<typename T>
T osc::_IOscCalcAdjustable< T >::fdCP
protectedinherited
template<class T>
bool osc::analytic::_OscCalc< T >::fDirty12
protected
template<class T>
bool osc::analytic::_OscCalc< T >::fDirty13
protected
template<class T>
bool osc::analytic::_OscCalc< T >::fDirty23
protected
template<class T>
bool osc::analytic::_OscCalc< T >::fDirtyCP
protected
template<class T>
bool osc::analytic::_OscCalc< T >::fDirtyMasses
protected
template<typename T>
T osc::_IOscCalcAdjustable< T >::fDmsq21
protectedinherited
template<typename T>
T osc::_IOscCalcAdjustable< T >::fDmsq32
protectedinherited
template<typename T>
double osc::_IOscCalcAdjustable< T >::fL
protectedinherited
template<typename T>
double osc::_IOscCalcAdjustable< T >::fRho
protectedinherited
template<typename T>
T osc::_IOscCalcAdjustable< T >::fTh12
protectedinherited
template<typename T>
T osc::_IOscCalcAdjustable< T >::fTh13
protectedinherited
template<typename T>
T osc::_IOscCalcAdjustable< T >::fTh23
protectedinherited
template<class T>
T osc::analytic::_OscCalc< T >::Hee
protected
template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Hem
protected
template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Het
protected
template<class T>
T osc::analytic::_OscCalc< T >::Hmm
protected
template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Hmt
protected
template<class T>
T osc::analytic::_OscCalc< T >::Htt
protected
template<class T>
T osc::analytic::_OscCalc< T >::s12
protected
template<class T>
T osc::analytic::_OscCalc< T >::s13
protected
template<class T>
T osc::analytic::_OscCalc< T >::s23
protected
template<class T>
T osc::analytic::_OscCalc< T >::sCP
protected
template<class T>
T osc::analytic::_OscCalc< T >::Ue2
protected

Definition at line 147 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().

template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Ue3
protected

Definition at line 147 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().

template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Um2
protected

Definition at line 148 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().

template<class T>
T osc::analytic::_OscCalc< T >::Um3
protected

Definition at line 148 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().

template<class T>
cmplx<T> osc::analytic::_OscCalc< T >::Ut2
protected

Definition at line 149 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().

template<class T>
T osc::analytic::_OscCalc< T >::Ut3
protected

Definition at line 149 of file OscCalcAnalytic.h.

Referenced by osc::analytic::SolveCubic().


The documentation for this class was generated from the following files: