Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osc::OscCalcSterile Class Reference

Adapt the PMNS_Sterile calculator to standard interface. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/osclib/v00.05/src/OscLib/OscCalcSterile.h"

Inheritance diagram for osc::OscCalcSterile:
osc::_IOscCalcAdjustable< double > osc::_IOscCalc< T > osc::OscCalcSterileBeam osc::OscCalcSterileTrivial

Public Member Functions

 OscCalcSterile ()
 
 OscCalcSterile (const OscCalcSterile &calc)
 
virtual ~OscCalcSterile ()
 
void SetNFlavors (int nflavors)
 
virtual IOscCalcAdjustableCopy () const override
 
virtual double P (int flavBefore, int flavAfter, double E) override
 E in GeV; flavors as PDG codes (so, neg==>antinu) More...
 
virtual void SetL (double L) override
 
virtual void SetRho (double rho) override
 
void SetAngle (int i, int j, double th)
 
void SetDelta (int i, int j, double delta)
 
void SetDm (int i, double dm)
 
void SetState (std::vector< double > state)
 
int GetNFlavors () const
 
double GetL () const override
 
double GetRho () const override
 
double GetDm (int i) const
 
double GetAngle (int i, int j) const
 
double GetDelta (int i, int j) const
 
std::vector< double > GetState () const
 
virtual TMD5 * GetParamsHash () const override
 Use to check two calculators are in the same state. More...
 
virtual double GetDmsq21 () const
 
virtual double GetDmsq32 () const
 
virtual double GetTh12 () const
 
virtual double GetTh13 () const
 
virtual double GetTh23 () const
 
virtual double GetdCP () const
 
virtual void InvalidateCache ()
 Invalidate any caching used internally by the calculator. More...
 
virtual Eigen::Matrix< T, Eigen::Dynamic, 1 > P (int flavBefore, int flavAfter, const std::vector< double > &E)
 

Protected Member Functions

virtual void SetDmsq21 (const double &dmsq21) override
 
virtual void SetDmsq32 (const double &dmsq32) override
 
virtual void SetTh12 (const double &th12) override
 
virtual void SetTh13 (const double &th13) override
 
virtual void SetTh23 (const double &th23) override
 
virtual void SetdCP (const double &dCP) override
 
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

PMNS_SterilefPMNS_Sterile
 
int fNFlavors
 
double fRho
 
bool fDirty
 
double fPrevE
 
int fPrevAnti
 
int fPrevFlavBefore
 
double fL
 
double fDmsq21
 
double fDmsq32
 
double fTh12
 
double fTh13
 
double fTh23
 
double fdCP
 

Detailed Description

Adapt the PMNS_Sterile calculator to standard interface.

Adapt the PMNS_Sterile calculator (3+N with matter effects) to standard interface

Definition at line 23 of file OscCalcSterile.h.

Constructor & Destructor Documentation

osc::OscCalcSterile::OscCalcSterile ( )

Definition at line 10 of file OscCalcSterile.cxx.

References fNFlavors, and fPMNS_Sterile.

Referenced by Copy().

11  : fPMNS_Sterile(0), fNFlavors(3), fDirty(true), fPrevE(0), fPrevAnti(0), fPrevFlavBefore(0)
12  {
14  }
PMNS_Sterile * fPMNS_Sterile
Implementation of oscillations of neutrinos in matter in a n-neutrino framework.
osc::OscCalcSterile::OscCalcSterile ( const OscCalcSterile calc)

Definition at line 51 of file OscCalcSterile.cxx.

References GetState(), SetState(), and makeDatasetsPage::state.

52  : OscCalcSterile()
53  {
54  std::vector<double> state = calc.GetState();
55  SetState(state);
56  }
void SetState(std::vector< double > state)
osc::OscCalcDumb calc
osc::OscCalcSterile::~OscCalcSterile ( )
virtual

Definition at line 71 of file OscCalcSterile.cxx.

References fPMNS_Sterile.

72  {
73  delete fPMNS_Sterile;
74  }
PMNS_Sterile * fPMNS_Sterile

Member Function Documentation

IOscCalcAdjustable * osc::OscCalcSterile::Copy ( ) const
overridevirtual

Implements osc::_IOscCalcAdjustable< double >.

Reimplemented in osc::OscCalcSterileTrivial, and osc::OscCalcSterileBeam.

Definition at line 77 of file OscCalcSterile.cxx.

References OscCalcSterile().

Referenced by osc::OscCalcSterileTrivial::~OscCalcSterileTrivial().

78  {
79  return new OscCalcSterile(*this);
80  }
double osc::OscCalcSterile::GetAngle ( int  i,
int  j 
) const
inline
virtual double osc::_IOscCalcAdjustable< double >::GetdCP ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 90 of file IOscCalc.h.

90 { return fdCP ; }
double osc::OscCalcSterile::GetDelta ( int  i,
int  j 
) const
inline
double osc::OscCalcSterile::GetDm ( int  i) const
inline
virtual double osc::_IOscCalcAdjustable< double >::GetDmsq21 ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 85 of file IOscCalc.h.

85 { return fDmsq21 ; }
virtual double osc::_IOscCalcAdjustable< double >::GetDmsq32 ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 86 of file IOscCalc.h.

86 { return fDmsq32 ; }
double osc::OscCalcSterile::GetL ( ) const
inlineoverridevirtual

Reimplemented from osc::_IOscCalcAdjustable< double >.

Definition at line 49 of file OscCalcSterile.h.

References osc::_IOscCalcAdjustable< double >::fL.

Referenced by ana::ToEigen().

49 { return fL; }
int osc::OscCalcSterile::GetNFlavors ( ) const
inline

Definition at line 48 of file OscCalcSterile.h.

References fPMNS_Sterile, and osc::PMNS_Sterile::GetNFlavors().

48 { return fPMNS_Sterile->GetNFlavors(); }
PMNS_Sterile * fPMNS_Sterile
virtual int GetNFlavors() const
Getters.
Definition: PMNS_Sterile.h:57
TMD5 * osc::OscCalcSterile::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 >.

Reimplemented in osc::OscCalcSterileBeam.

Definition at line 59 of file OscCalcSterile.cxx.

References GetState(), and runNovaSAM::ret.

Referenced by GetDelta().

60  {
61  TMD5* ret = new TMD5;
62  std::string txt = "PMNSSterile";
63  ret->Update((unsigned char*)txt.c_str(), txt.size());
64  std::vector<double> buf = GetState();
65  ret->Update((unsigned char*)&buf[0], sizeof(double)*buf.size());
66  ret->Final();
67  return ret;
68  }
std::vector< double > GetState() const
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TMD5* osc::_IOscCalcAdjustable< double >::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

Referenced by osc::OscCalcGeneral::GetParamsHash(), osc::OscCalcPMNS_CPT::GetParamsHash(), and osc::OscCalc::GetParamsHash().

double osc::OscCalcSterile::GetRho ( ) const
inlineoverridevirtual

Reimplemented from osc::_IOscCalcAdjustable< double >.

Definition at line 50 of file OscCalcSterile.h.

References fRho.

50 { return fRho; }
std::vector< double > osc::OscCalcSterile::GetState ( ) const

Definition at line 17 of file OscCalcSterile.cxx.

References osc::_IOscCalcAdjustable< double >::fL, fNFlavors, fRho, GetAngle(), GetDelta(), GetDm(), MECModelEnuComparisons::i, calib::j, and makeDatasetsPage::state.

Referenced by GetDelta(), GetParamsHash(), OscCalcSterile(), osc::OscCalcSterileTrivial::OscCalcSterileTrivial(), and ana::SaveTo().

18  {
19  std::vector<double> state;
20  state.push_back((double)fNFlavors);
21  state.push_back(fL);
22  state.push_back(fRho);
23  for(int i = 2; i <= fNFlavors; ++i) state.push_back(GetDm(i));
24  for(int j = 2; j <= fNFlavors; ++j) {
25  for(int i = 1; i < j; ++i) {
26  state.push_back(GetAngle(i, j));
27  if(i+1 != j) state.push_back(GetDelta(i, j));
28  }
29  }
30  return state;
31  }
double GetDelta(int i, int j) const
const double j
Definition: BetheBloch.cxx:29
double GetDm(int i) const
double GetAngle(int i, int j) const
virtual double osc::_IOscCalcAdjustable< double >::GetTh12 ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 87 of file IOscCalc.h.

87 { return fTh12 ; }
virtual double osc::_IOscCalcAdjustable< double >::GetTh13 ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 88 of file IOscCalc.h.

88 { return fTh13 ; }
virtual double osc::_IOscCalcAdjustable< double >::GetTh23 ( ) const
inlinevirtualinherited

Reimplemented in osc::OscCalcCPT.

Definition at line 89 of file IOscCalc.h.

89 { return fTh23 ; }
virtual void osc::_IOscCalcAdjustable< double >::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.

Definition at line 97 of file IOscCalc.h.

97 {};
template<class T >
Eigen::Matrix< T, Eigen::Dynamic, 1 > osc::_IOscCalc< T >::P ( int  flavBefore,
int  flavAfter,
const std::vector< double > &  E 
)
virtualinherited

Reimplemented in osc::OscCalcPMNSOptEigen, and osc::_OscCalcDMP< T >.

Definition at line 28 of file IOscCalc.cxx.

References MECModelEnuComparisons::i, P, runNovaSAM::ret, and submit_hadd::u.

29  {
30  Eigen::Matrix<T,Eigen::Dynamic,1> ret(E.size());
31  for(auto i = 0u; i < E.size(); i++) {
32  ret(i) = this->P(flavBefore, flavAfter, E[i]);
33  }
34  return ret.array().isNaN().select(0, ret);
35  }
Float_t E
Definition: plot.C:20
virtual T P(int flavBefore, int flavAfter, double E)=0
E in GeV; flavors as PDG codes (so, neg==>antinu)
double osc::OscCalcSterile::P ( int  flavBefore,
int  flavAfter,
double  E 
)
overridevirtual

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

Implements osc::_IOscCalc< T >.

Reimplemented in osc::OscCalcSterileTrivial.

Definition at line 155 of file OscCalcSterile.cxx.

References abs(), ana::assert(), E, e, fDirty, osc::_IOscCalcAdjustable< double >::fL, fPMNS_Sterile, fPrevAnti, fPrevE, fPrevFlavBefore, fRho, MECModelEnuComparisons::i, calib::j, osc::PMNS_Sterile::P(), osc::PMNS_Sterile::PropMatter(), and osc::PMNS_Sterile::ResetToFlavour().

Referenced by LOverEPlot(), ana::ToEigen(), and osc::OscCalcSterileTrivial::~OscCalcSterileTrivial().

156  {
157  const int anti = (flavBefore > 0) ? +1 : -1;
158  //anti must be +/- 1 but flavAfter can be zero
159  assert(flavAfter/anti >= 0);
160  if (anti != fPrevAnti) fDirty = true;
161  fPrevAnti = anti;
162 
163  if (flavBefore != fPrevFlavBefore) fDirty = true;
164  fPrevFlavBefore = flavBefore;
165 
166  if (abs(fPrevE - E) > 1e-8) fDirty = true;
167  fPrevE = E;
168 
169  int i = -1, j = -1;
170  if(abs(flavBefore) == 12) i = 0;
171  if(abs(flavBefore) == 14) i = 1;
172  if(abs(flavBefore) == 16) i = 2;
173  if(abs(flavAfter) == 12) j = 0;
174  if(abs(flavAfter) == 14) j = 1;
175  if(abs(flavAfter) == 16) j = 2;
176  if(abs(flavAfter) == 0) j = 3;
177  assert(i >= 0 && j >= 0);
178 
179  if (fDirty) {
181  // Assume Z/A=0.5
182  const double Ne = fRho/2;
183  fPMNS_Sterile->PropMatter(fL, E, Ne, anti);
184  }
185 
186  // Return the active fraction
187  if (j == 3) return fPMNS_Sterile->P(0) + fPMNS_Sterile->P(1) + fPMNS_Sterile->P(2);
188  else return fPMNS_Sterile->P(j);
189  }
virtual double P(int flv) const
virtual void PropMatter(double L, double E, double Ne, int anti=1)
void abs(TH1 *hist)
PMNS_Sterile * fPMNS_Sterile
Float_t E
Definition: plot.C:20
const double j
Definition: BetheBloch.cxx:29
virtual void ResetToFlavour(int flv=1)
assert(nhit_max >=nhit_nbins)
Float_t e
Definition: plot.C:35
void osc::OscCalcSterile::SetAngle ( int  i,
int  j,
double  th 
)

Definition at line 92 of file OscCalcSterile.cxx.

References fDirty, fPMNS_Sterile, and osc::PMNS_Sterile::SetAngle().

Referenced by BlessedPlotsAna(), BlessedPlotsAnaByPeriod(), FitSystEffectsAna(), LOverEPlot(), MiniBooNEParameters(), PlotNus17Prediction(), ana::PredictionSterile::PredictUnoscillated(), ResetAngles(), ana::ResetSterileCalcToDefault(), SetAngles(), SetCalcParam(), SetFakeSignalParams(), SetNus20Params(), SetRho(), SetState(), ana::FitTheta13Sterile::SetValue(), ana::FitSinSqTheta13Sterile::SetValue(), ana::FitSinSq2Theta13Sterile::SetValue(), ana::FitTheta23Sterile::SetValue(), ana::FitSinSqTheta23Sterile::SetValue(), ana::FitTheta14Sterile::SetValue(), ana::FitSinSqTheta14Sterile::SetValue(), ana::FitTheta24Sterile::SetValue(), ana::FitSinSqTheta24Sterile::SetValue(), ana::FitTheta34Sterile::SetValue(), ana::FitSinSqTheta34Sterile::SetValue(), ana::FitTheta13InDegreesSterile::SetValue(), ana::FitTheta23InDegreesSterile::SetValue(), ana::FitTheta14InDegreesSterile::SetValue(), ana::FitTheta24InDegreesSterile::SetValue(), ana::FitTheta34InDegreesSterile::SetValue(), sterile_demo(), SterileOscillator(), and SystsOscParamAna().

93  {
94  fDirty = true;
95  fPMNS_Sterile->SetAngle(i, j, th);
96  }
virtual void SetAngle(int i, int j, double th)
PMNS_Sterile * fPMNS_Sterile
const double j
Definition: BetheBloch.cxx:29
void osc::OscCalcSterile::SetdCP ( const double &  dCP)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 148 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

149  {
150  std::cerr << "Must use SetDelta!" << std::endl;
151  assert(false);
152  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)
void osc::OscCalcSterile::SetDelta ( int  i,
int  j,
double  delta 
)
void osc::OscCalcSterile::SetDm ( int  i,
double  dm 
)
void osc::OscCalcSterile::SetDmsq21 ( const double &  dmsq21)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 113 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

114  {
115  std::cerr << "Must use SetDm!" << std::endl;
116  assert(false);
117  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)
void osc::OscCalcSterile::SetDmsq32 ( const double &  dmsq32)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 120 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

121  {
122  std::cerr << "Must use SetDm!" << std::endl;
123  assert(false);
124  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)
virtual void osc::OscCalcSterile::SetL ( double  L)
inlineoverridevirtual
void osc::OscCalcSterile::SetNFlavors ( int  nflavors)
virtual void osc::OscCalcSterile::SetRho ( double  rho)
inlineoverridevirtual
void osc::OscCalcSterile::SetState ( std::vector< double >  state)

Definition at line 34 of file OscCalcSterile.cxx.

References fDirty, fNFlavors, MECModelEnuComparisons::i, calib::j, SetAngle(), SetDelta(), SetDm(), SetL(), SetNFlavors(), and SetRho().

Referenced by OscCalcSterile(), osc::OscCalcSterileTrivial::OscCalcSterileTrivial(), and SetRho().

35  {
36  int iState(0);
37  fDirty = true ;
38  SetNFlavors((int)state[iState++]);
39  SetL(state[iState++]);
40  SetRho(state[iState++]);
41  for (int i = 2; i <= fNFlavors; ++i) SetDm(i, state[iState++]);
42  for(int j = 2; j <= fNFlavors; ++j) {
43  for(int i = 1; i < j; ++i) {
44  SetAngle(i, j, state[iState++]);
45  if(i+1 != j) SetDelta(i, j, state[iState++]);
46  }
47  }
48  }
void SetNFlavors(int nflavors)
void SetDelta(int i, int j, double delta)
const double j
Definition: BetheBloch.cxx:29
void SetAngle(int i, int j, double th)
void SetDm(int i, double dm)
virtual void SetL(double L) override
virtual void SetRho(double rho) override
void osc::OscCalcSterile::SetTh12 ( const double &  th12)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 127 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

128  {
129  std::cerr << "Must use SetAngle!" << std::endl;
130  assert(false);
131  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)
void osc::OscCalcSterile::SetTh13 ( const double &  th13)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 134 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

135  {
136  std::cerr << "Must use SetAngle!" << std::endl;
137  assert(false);
138  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)
void osc::OscCalcSterile::SetTh23 ( const double &  th23)
overrideprotectedvirtual

Implements osc::_IOscCalcAdjustable< double >.

Definition at line 141 of file OscCalcSterile.cxx.

References ana::assert(), om::cerr, and allTimeWatchdog::endl.

142  {
143  std::cerr << "Must use SetAngle!" << std::endl;
144  assert(false);
145  }
OStream cerr
Definition: OStream.cxx:7
assert(nhit_max >=nhit_nbins)

Member Data Documentation

double osc::_IOscCalcAdjustable< double >::fdCP
protectedinherited
bool osc::OscCalcSterile::fDirty
protected

Definition at line 69 of file OscCalcSterile.h.

Referenced by P(), SetAngle(), SetDelta(), SetDm(), SetL(), SetNFlavors(), SetRho(), and SetState().

double osc::_IOscCalcAdjustable< double >::fDmsq21
protectedinherited
double osc::_IOscCalcAdjustable< double >::fDmsq32
protectedinherited
double osc::_IOscCalcAdjustable< double >::fL
protectedinherited
int osc::OscCalcSterile::fNFlavors
protected
PMNS_Sterile* osc::OscCalcSterile::fPMNS_Sterile
protected
int osc::OscCalcSterile::fPrevAnti
protected

Definition at line 71 of file OscCalcSterile.h.

Referenced by P().

double osc::OscCalcSterile::fPrevE
protected

Definition at line 70 of file OscCalcSterile.h.

Referenced by P().

int osc::OscCalcSterile::fPrevFlavBefore
protected

Definition at line 72 of file OscCalcSterile.h.

Referenced by P().

double osc::OscCalcSterile::fRho
protected

Definition at line 68 of file OscCalcSterile.h.

Referenced by osc::OscCalcSterileBeam::GetParamsHash(), GetRho(), GetState(), P(), and SetRho().

double osc::_IOscCalcAdjustable< double >::fTh12
protectedinherited
double osc::_IOscCalcAdjustable< double >::fTh13
protectedinherited
double osc::_IOscCalcAdjustable< double >::fTh23
protectedinherited

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