FitVars.cxx
Go to the documentation of this file.
1 #include "CAFAna/Vars/FitVars.h"
2 
3 #include "OscLib/IOscCalc.h"
4 #include "Utilities/func/MathUtil.h"
5 
6 #include <cassert>
7 #include <cmath>
8 
9 namespace ana
10 {
11  // declared as 'extern' in FitVars.h
27 
28 
29  //----------------------------------------------------------------------
31  {
32  return osc->GetTh13();
33  }
34 
35  //----------------------------------------------------------------------
37  {
38  return osc->SetTh13(val);
39  }
40 
41 //----------------------------------------------------------------------
43  {
44  return util::sqr(sin(2*osc->GetTh13()));
45  }
46 
47  //----------------------------------------------------------------------
49  {
50  osc->SetTh13(asin(sqrt(Clamp(val)))/2);
51  }
52 
53  //----------------------------------------------------------------------
54  // helper function so the code doesn't need to be written twice
55  namespace
56  {
57  template<typename T>
58  T dcP_GetVal_Helper(const osc::_IOscCalcAdjustable<T>* osc)
59  {
60  T ret = osc->GetdCP()/M_PI;
61 
62  // convert to the range 0-2
63  auto a = floor(ret/2+1);
64  ret -= 2*a;
65  // Instead of figuring out all the rounding just nudge the last little bit
66  while(ret < 0) ret += 2;
67  while(ret > 2) ret -= 2;
68 
69  return ret;
70  }
71  }
73  {
74  return dcP_GetVal_Helper(osc);
75  }
77  {
78  return dcP_GetVal_Helper(osc);
79  }
80 
81  //----------------------------------------------------------------------
83  {
84  osc->SetdCP(M_PI*val);
85  }
87  {
88  osc->SetdCP(M_PI*val);
89  }
90 
91  //----------------------------------------------------------------------
93  {
94  return util::sqr(sin(osc->GetTh23()));
95  }
96 
97  //----------------------------------------------------------------------
99  {
100  return util::sqr(sin(osc->GetTh23()));
101  }
102 
103  //----------------------------------------------------------------------
105  {
106  osc->SetTh23(asin(sqrt(this->Clamp(val))));
107  }
108 
109  //----------------------------------------------------------------------
111  {
112  osc->SetTh23(asin(sqrt(this->Clamp(val))));
113  }
114 
115  //----------------------------------------------------------------------
117  {
118  return util::sqr(sin(osc->GetTh23()));
119  }
121  {
122  return util::sqr(sin(osc->GetTh23()));
123  }
124  //----------------------------------------------------------------------
126  {
127  osc->SetTh23(asin(sqrt(this->Clamp(val))));
128  }
129 
130  //----------------------------------------------------------------------
132  {
133  osc->SetTh23(asin(sqrt(this->Clamp(val))));
134  }
135 
136  //----------------------------------------------------------------------
138  {
139  return util::sqr(sin(osc->GetTh23()));
140  }
142  {
143  return util::sqr(sin(osc->GetTh23()));
144  }
145 
146  //----------------------------------------------------------------------
148  {
149  osc->SetTh23(asin(sqrt(this->Clamp(val))));
150  }
151 
152  //----------------------------------------------------------------------
154  {
155  osc->SetTh23(asin(sqrt(this->Clamp(val))));
156  }
157 
158  //----------------------------------------------------------------------
160  {
161  return util::sqr(sin(2*osc->GetTh23()));
162  }
163 
164  //----------------------------------------------------------------------
166  {
167  osc->SetTh23(asin(sqrt(Clamp(val)))/2);
168  }
169 
170  //----------------------------------------------------------------------
172  {
173  return osc->GetDmsq32();
174  }
175 
176  //----------------------------------------------------------------------
178  {
179  osc->SetDmsq32(this->Clamp(val));
180  }
181 
182  //----------------------------------------------------------------------
184  {
185  return osc->GetDmsq32()*1000.0;
186  }
187 
188  //----------------------------------------------------------------------
190  {
191  return osc->GetDmsq32()*1000.0;;
192  }
193 
194  //----------------------------------------------------------------------
196  {
197  osc->SetDmsq32(this->Clamp(val)/1000.0);
198  }
199 
200  //----------------------------------------------------------------------
202  {
203  osc->SetDmsq32(this->Clamp(val)/1000.0);
204  }
205 
206 
207 //----------------------------------------------------------------------
209  {
210  return osc->GetDmsq32();
211  }
212 
213  //---------------------------------------------------------------------
215  {
216  osc->SetDmsq32(Clamp(val));
217  }
218 
219  //---------------------------------------------------------------------
221  {
222  osc->SetDmsq32(Clamp(val)/1000.0);
223  }
224 
225  //--------------------------------------------------------------------
227  {
228  return osc->GetDmsq32()*1000.0;
229  }
230 
231  //---------------------------------------------------------------------
233  {
234  osc->SetDmsq32(Clamp(val)/1000.0);
235  }
236 
237  //--------------------------------------------------------------------
239  {
240  return osc->GetDmsq32()*1000.0;
241  }
242 
243  //---------------------------------------------------------------------
245  {
246  return osc->GetDmsq32();
247  }
248 
249  //---------------------------------------------------------------------
251  {
252  osc->SetDmsq32(Clamp(val));
253  }
254 
255 
256  //----------------------------------------------------------------------
258  {
259  return util::sqr(tan(osc->GetTh12()));
260  }
261 
262  //----------------------------------------------------------------------
264  {
265  osc->SetTh12(atan(sqrt(Clamp(val))));
266  }
267 
268  //----------------------------------------------------------------------
270  {
271  return util::sqr(sin(2*osc->GetTh12()));
272  }
273 
274  //----------------------------------------------------------------------
276  {
277  osc->SetTh12(asin(sqrt(Clamp(val)))/2);
278  }
279 
280  //----------------------------------------------------------------------
282  {
283  return osc->GetDmsq21();
284  }
285 
286  //----------------------------------------------------------------------
288  {
289  osc->SetDmsq21(Clamp(val));
290  }
291 } // namespace
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:220
const FitSinSq2Theta12 kFitSinSq2Theta12
Definition: FitVars.cxx:25
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const FitTheta13 kFitTheta13
Definition: FitVars.cxx:12
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:141
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:232
virtual void SetDmsq21(const T &dmsq21)=0
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:18
const FitDmSq32ScaledNH kFitDmSq32ScaledNH
Definition: FitVars.cxx:21
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:250
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:177
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:171
T sqrt(T number)
Definition: d0nt_math.hpp:156
const FitSinSqTheta23UpperOctant kFitSinSqTheta23UpperOctant
Definition: FitVars.cxx:16
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:275
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:165
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:208
virtual void SetTh13(const T &th13)=0
virtual T GetTh23() const
Definition: IOscCalc.h:89
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:48
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:42
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
virtual void SetDmsq32(const T &dmsq32)=0
#define M_PI
Definition: SbMath.h:34
const FitDmSq21 kFitDmSq21
Definition: FitVars.cxx:26
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:183
int Clamp(int x)
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:92
T atan(T number)
Definition: d0nt_math.hpp:66
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:257
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:120
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:269
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:30
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:238
const double a
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:263
virtual T GetDmsq32() const
Definition: IOscCalc.h:86
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:159
virtual T GetTh12() const
Definition: IOscCalc.h:87
const ConstrainedFitVarWithPrior fitDmSq32Scaled_UniformPrior & kFitDmSq32Scaled
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:147
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:195
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:82
Oscillation probability calculators.
Definition: Calcs.h:5
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:214
virtual T GetdCP() const
Definition: IOscCalc.h:90
virtual T GetTh13() const
Definition: IOscCalc.h:88
virtual T GetDmsq21() const
Definition: IOscCalc.h:85
const FitDmSq32ScaledIH kFitDmSq32ScaledIH
Definition: FitVars.cxx:22
T sin(T number)
Definition: d0nt_math.hpp:132
stan::math::var GetValue(const osc::IOscCalcAdjustableStan *osc) const override
Definition: FitVars.cxx:76
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:287
const FitSinSqTheta23LowerOctant kFitSinSqTheta23LowerOctant
Definition: FitVars.cxx:17
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
virtual void SetTh23(const T &th23)=0
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:36
double T
Definition: Xdiff_gwt.C:5
const FitSinSq2Theta13 kFitSinSq2Theta13
Definition: FitVars.cxx:13
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:125
const FitDmSq32InvertedHierarchy kFitDmSq32InvertedHierarchy
Definition: FitVars.cxx:23
T tan(T number)
Definition: d0nt_math.hpp:144
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:244
const FitDmSq32NormalHierarchy kFitDmSq32NormalHierarchy
Definition: FitVars.cxx:20
const FitTanSqTheta12 kFitTanSqTheta12
Definition: FitVars.cxx:24
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:104
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:281
virtual void SetTh12(const T &th12)=0
virtual void SetdCP(const T &dCP)=0
T asin(T number)
Definition: d0nt_math.hpp:60
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:226