IOscCalculator.h
Go to the documentation of this file.
1 #ifndef IOSCCALCULATOR_H
2 #define IOSCCALCULATOR_H
3 
4 #include "TMD5.h"
5 
6 //////////////////////////////////////////////////////////////////////////
7 // //
8 // \file IOscCalculator.h //
9 // //
10 // \brief General interface to oscillation calculators //
11 // \author Christopher Backhouse - bckhouse@caltech.edu //
12 // //
13 //////////////////////////////////////////////////////////////////////////
14 
15 /// Oscillation probability calculators
16 namespace osc
17 {
18  /// General interface to oscillation calculators
19  template <typename T>
20  class _IOscCalculator
21  {
22  public:
23  virtual ~_IOscCalculator() {}
24 
25  virtual _IOscCalculator* Copy() const = 0;
26 
27  /// E in GeV; flavors as PDG codes (so, neg==>antinu)
28  virtual T P(int flavBefore, int flavAfter, double E) = 0;
29 
30  /// \brief Use to check two calculators are in the same state
31  ///
32  /// \return Null means not implemented for this calculator
33  virtual TMD5* GetParamsHash() const {return 0;}
34  };
36 
37  /// Pass neutrinos through unchanged
38  template <typename T>
40  {
41  public:
42  virtual _IOscCalculator<T>* Copy() const override {return new _NoOscillations<T>;}
43 
44  virtual T P(int from, int to, double /*E*/) override
45  {
46  if(from == to || to == 0) return 1;
47  return 0;
48  }
49 
50  /// Always compare equal to self
51  virtual TMD5* GetParamsHash() const override
52  {
53  TMD5* ret = new TMD5;
54  const char* txt = "NoOscillations";
55  ret->Update((unsigned char*)txt, strlen(txt));
56  ret->Final();
57  return ret;
58  }
59  };
61 
62  /// General interface to any calculator that lets you set the parameters
63  template <typename T>
65  {
66  public:
67  virtual ~_IOscCalculatorAdjustable();
68  virtual _IOscCalculatorAdjustable<T>* Copy() const = 0;
69 
70  // These setters are left unimplemented here, since calculators may want
71  // to compute additional values when these are set.
72  virtual void SetL (double L ) = 0;
73  virtual void SetRho (double rho ) = 0;
74  virtual void SetDmsq21(const T& dmsq21) = 0;
75  virtual void SetDmsq32(const T& dmsq32) = 0;
76  virtual void SetTh12 (const T& th12 ) = 0;
77  virtual void SetTh13 (const T& th13 ) = 0;
78  virtual void SetTh23 (const T& th23 ) = 0;
79  virtual void SetdCP (const T& dCP ) = 0;
80 
81  virtual double GetL () const { return fL ; }
82  virtual double GetRho () const { return fRho ; }
83  virtual T GetDmsq21() const { return fDmsq21 ; }
84  virtual T GetDmsq32() const { return fDmsq32 ; }
85  virtual T GetTh12 () const { return fTh12 ; }
86  virtual T GetTh13 () const { return fTh13 ; }
87  virtual T GetTh23 () const { return fTh23 ; }
88  virtual T GetdCP () const { return fdCP ; }
89 
90  protected:
91  /// \brief This is only a safe implementation if your calculator only
92  /// depends on these eight parameters
93  ///
94  /// \param txt A string to uniquely identify your calculator class
95  TMD5* GetParamsHashDefault(const std::string& txt) const;
96 
97  // Set by the user. Generally useful to derived classes
98  double fRho; // density (g/cm^3); always double since never fitted
99  double fL; // baseline (km); ditto
106  };
108 
109  //----------------------------------------------------------------------
110  /// Copy parameters from one calculator to another, irrespective of their type
111  template <typename T, typename U>
112  void CopyParams(const osc::_IOscCalculatorAdjustable<T> * inCalc,
114 
115 } // namespace
116 
117 #endif
Pass neutrinos through unchanged.
virtual T GetDmsq21() const
virtual double GetRho() const
_IOscCalculatorAdjustable< double > IOscCalculatorAdjustable
Definition: FwdDeclare.h:19
General interface to oscillation calculators.
Definition: FwdDeclare.h:15
double th23
Definition: runWimpSim.h:98
_IOscCalculator< double > IOscCalculator
Definition: FwdDeclare.h:16
virtual _IOscCalculator * Copy() const =0
double th12
Definition: runWimpSim.h:98
virtual double GetL() const
_NoOscillations< double > NoOscillations
virtual T P(int from, int to, double) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
General interface to any calculator that lets you set the parameters.
static constexpr double L
Float_t E
Definition: plot.C:20
double dCP
virtual TMD5 * GetParamsHash() const
Use to check two calculators are in the same state.
void SetRho(const float &r)
Definition: HoughPeak.h:94
void CopyParams(const osc::_IOscCalculatorAdjustable< T > *inCalc, osc::_IOscCalculatorAdjustable< U > *outCalc)
Copy parameters from one calculator to another, irrespective of their type.
Oscillation probability calculators.
Definition: Calcs.h:5
virtual T P(int flavBefore, int flavAfter, double E)=0
E in GeV; flavors as PDG codes (so, neg==>antinu)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
virtual T GetDmsq32() const
double dmsq32
double T
Definition: Xdiff_gwt.C:5
virtual ~_IOscCalculator()
double th13
Definition: runWimpSim.h:98
virtual TMD5 * GetParamsHash() const override
Always compare equal to self.
virtual _IOscCalculator< T > * Copy() const override