FitVarsCPT.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "OscLib/OscCalcCPT.h" // for ENuSign
5 #include "CAFAna/Vars/FitVars.h"
6 
7 namespace ana
8 {
9 
10  //---------------------------------------------------------------------------
11  /// FitDmSq32, but for one sign only
12  class FitDmSq32CPT: public FitDmSq32
13  {
14  public:
15  explicit FitDmSq32CPT(osc::ENuSign nuSign)
16  : IConstrainedFitVar((nuSign==osc::ENuSign::kNu) ? "dmsq32_nu" : "dmsq32_nubar",
17  (nuSign==osc::ENuSign::kNu) ? "#Deltam^{2}_{32}"
18  : "#Delta#bar{m}^{2}_{32}"),
19  fNuSign(nuSign)
20  {}
21  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
23  double val) const override;
24  protected:
26  };
27 
28  extern const FitDmSq32CPT kFitDmSq32nu;
30 
31 
32  //---------------------------------------------------------------------------
33  /// FitDmSq32Scaled, but for one sign only
35  {
36  public:
38  : StanFitSupport<IConstrainedFitVar>((nuSign==osc::ENuSign::kNu) ? "dmsq32scaled_nu" : "dmsq32scaled_nubar",
39  (nuSign==osc::ENuSign::kNu) ? "#Deltam^{2}_{32} (10^{-3} eV^{2})"
40  : "#Delta#bar{m}^{2}_{32} (10^{-3} eV^{2})"),
41  fNuSign(nuSign)
42  {}
43 
44  // make sure the inherited methods don't get shadowed
47 
48  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
50  double val) const override;
51  protected:
53  };
54 
57 
58 
59 
60  //---------------------------------------------------------------------------
61  // rough boundary between oscillation maxima
62  constexpr double kDmsq32Limit = 6e-3;
63 
64  /** FitDmSq32CPT, but constrained to a hierarchy
65  (and away from the other oscillation maximum near 8e-3 eV^2) */
67  {
68  public:
69  explicit FitDmSq32CPTHierarchy(osc::ENuSign nuSign, bool inverted=false)
70  : IConstrainedFitVar( ((nuSign==osc::ENuSign::kNu) ? "dmsq32scaled_nu" : "dmsq32scaled_nubar")
71  + std::string(inverted ? "_IH" : "_NH"),
72  ((nuSign==osc::ENuSign::kNu) ? "#Deltam^{2}_{32} (10^{-3} eV^{2})"
73  : "#Delta#bar{m}^{2}_{32} (10^{-3} eV^{2})")
74  + std::string(inverted ? " IH" : " NH")),
75  FitDmSq32CPT(nuSign), fInverted(inverted)
76  {}
77 
78  void SetValue(osc::IOscCalcAdjustable* osc, double val) const override
79  {
80  FitDmSq32CPT::SetValue(osc, Clamp(val));
81  }
82 
83  double LowLimit() const override {return !fInverted ? 0 : -kDmsq32Limit ;}
84  double HighLimit() const override {return !fInverted ? kDmsq32Limit : 0 ;}
85  protected:
86  const bool fInverted;
87  };
88 
93 
94  //---------------------------------------------------------------------------
95  /// FitDmSq21, but for one sign only
96  class FitDmSq21CPT: public FitDmSq21
97  {
98  public:
99  explicit FitDmSq21CPT(osc::ENuSign nuSign)
100  : IConstrainedFitVar((nuSign==osc::ENuSign::kNu) ? "dmsq21_nu" : "dmsq21_nubar",
101  (nuSign==osc::ENuSign::kNu) ? "#Deltam^{2}_{21}"
102  : "#Delta#bar{m}^{2}_{21}"),
103  fNuSign(nuSign)
104  {}
105 
106  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
108  double val) const override;
109  protected:
111  };
112 
115 
116  //---------------------------------------------------------------------------
117 
118  /// FitSinSq2Theta23, but for one sign only
120  {
121  public:
123  : IConstrainedFitVar((nuSign==osc::ENuSign::kNu) ? "ss2th23_nu" : "ss2th23_nubar",
124  (nuSign==osc::ENuSign::kNu) ? "sin^{2}2#theta_{23}"
125  : "sin^{2}2#bar{#theta}_{23}"),
126  fNuSign(nuSign)
127  {}
128 
129  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
131  double val) const override;
132  protected:
134  };
135 
138 
139  //---------------------------------------------------------------------------
140 
141  /// FitSinSqTheta23CPT, but for one sign only
143  {
144  public:
146  : StanFitSupport<IConstrainedFitVar>((nuSign==osc::ENuSign::kNu) ? "ssth23_nu" : "ssth23_nubar",
147  (nuSign==osc::ENuSign::kNu) ? "sin^{2}#theta_{23}"
148  : "sin^{2}#bar{#theta}_{23}"),
149  fNuSign(nuSign)
150  {}
151 
152  // make sure the inherited methods don't get shadowed
155 
156  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
158  double val) const override;
159  protected:
161  };
162 
165 
166  //---------------------------------------------------------------------------
167 
168  // boundary between octants
169  constexpr double kSinsqtheta23Limit = .5;
170 
171  /// FitSinSqTheta23CPT, but forcing octant
173  {
174  public:
175  explicit FitSinSqTheta23CPTOctant(osc::ENuSign nuSign, bool second=false)
176  : StanFitSupport<IConstrainedFitVar>( ((nuSign==osc::ENuSign::kNu) ? "ssth23_nu" : "ssth23_nubar")
177  + std::string(second ? "_UO" : "_LO"),
178  ((nuSign==osc::ENuSign::kNu) ? "sin^{2}#theta_{23}"
179  : "sin^{2}#bar{#theta}_{23}")
180  + std::string(second ? " UO" : " LO")),
181 
182  FitSinSqTheta23CPT(nuSign), fSecond(second)
183  {}
184  double LowLimit() const override { return !fSecond ? 0 : kSinsqtheta23Limit; }
185  double HighLimit() const override { return !fSecond ? kSinsqtheta23Limit : 1; }
186  protected:
187  const bool fSecond;
188  };
189 
194 
195  //---------------------------------------------------------------------------
196 
197  /// FitSinSq2Theta13, but for one sign only
199  {
200  public:
202  : IConstrainedFitVar((nuSign==osc::ENuSign::kNu) ? "ss2th13_nu" : "ss2th13_nubar",
203  (nuSign==osc::ENuSign::kNu) ? "sin^{2}2#theta_{13}"
204  : "sin^{2}2#bar{#theta}_{13}"),
205  fNuSign(nuSign)
206  {}
207 
208  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
210  double val) const override;
211  protected:
213  };
214 
217 
218  //---------------------------------------------------------------------------
219 
220  /// FitSinSq2Theta12, but for one sign only
222  {
223  public:
225  : IConstrainedFitVar((nuSign==osc::ENuSign::kNu) ? "ss2th12_nu" : "ss2th12_nubar",
226  (nuSign==osc::ENuSign::kNu) ? "sin^{2}2#theta_{12}"
227  : "sin^{2}2#bar{#theta}_{12}"),
228  fNuSign(nuSign)
229  {}
230 
231  double GetValue(const osc::IOscCalcAdjustable* osc) const override;
233  double val) const override;
234  protected:
236  };
237 
240 
241  //---------------------------------------------------------------------------
242  //---------------------------------------------------------------------------
243 
244  /** Helper class, allows FitVar pairs like var1+var2, var1-var2
245  Requires CPT calculator to cache data when parallelized */
247  {
248  friend class FitSigmaCPT;
249  friend class FitDeltaCPT;
250  public:
252  const IConstrainedFitVar &x,
253  const IConstrainedFitVar &y);
254  private:
255  double GetSigma(const osc::IOscCalcAdjustable* osc) const;
256  double GetDelta(const osc::IOscCalcAdjustable* osc) const;
257  void SetSigma(osc::IOscCalcAdjustable* osc, double val);
258  void SetDelta(osc::IOscCalcAdjustable* osc, double val);
259  double SigmaPenalty(double val, osc::IOscCalcAdjustable*) const;
260  double DeltaPenalty(double val) const;
263  void SetFitVars(osc::OscCalcCPT*);
264  const double fCenterDelta;
265  const double fCenterSigma;
266  };
267 
268  //---------------------------------------------------------------------------
269 
270  /** A FitVar that acts like fXvar+fYvar for members of its helper SigmaDelta.
271  Changing a FitSigmaCPT maintains the associated FitDeltaCPT */
272  class FitSigmaCPT: public IFitVar
273  {
274  public:
276  : IFitVar(sd->fXvar.ShortName() + "_plus_" + sd->fYvar.ShortName(),
277  sd->fXvar.LatexName() + "+" + sd->fYvar.LatexName()),
278  fSigDel{sd}
279  {}
280 
281  double GetValue(const osc::IOscCalcAdjustable* osc) const override
282  { return fSigDel->GetSigma(osc); }
283 
284  void SetValue(osc::IOscCalcAdjustable* osc, double val) const override
285  { fSigDel->SetSigma(osc, val); }
286 
287  double Penalty(double val, osc::IOscCalcAdjustable* osc) const override
288  { return fSigDel->SigmaPenalty(val, osc); }
289  private:
291  };
292 
293  //---------------------------------------------------------------------------
294 
295  /** A FitVar that acts like fXvar-fYvar for members of its helper SigmaDelta.
296  Changing a FitDeltaCPT tries to maintain the associated FitSigmaCPT,
297  but if constraints prevent this, only FitDelta is maintained */
298  class FitDeltaCPT: public IFitVar
299  {
300  public:
302  : IFitVar(sd->fXvar.ShortName() + "_minus_" + sd->fYvar.ShortName(),
303  sd->fXvar.LatexName() + "-" + sd->fYvar.LatexName()),
304  fSigDel{sd}
305  {}
306  double GetValue(const osc::IOscCalcAdjustable* osc) const override
307  { return fSigDel->GetDelta(osc); }
308  void SetValue(osc::IOscCalcAdjustable* osc, double val) const override
309  { fSigDel->SetDelta(osc, val); }
310  double Penalty(double val, osc::IOscCalcAdjustable*) const override
311  { return fSigDel->DeltaPenalty(val); }
312  private:
314  };
315 
316 } //namespace
const double fCenterSigma
Definition: FitVarsCPT.h:265
const std::string & LatexName() const
Definition: IFitVar.h:38
constexpr double kSinsqtheta23Limit
Definition: FitVarsCPT.h:169
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:235
FitDeltaCPT(SigmaDelta *sd)
Definition: FitVarsCPT.h:301
FitSinSqTheta23CPT, but for one sign only.
Definition: FitVarsCPT.h:142
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
FitDmSq21, but for one sign only.
Definition: FitVarsCPT.h:96
const FitSinSq2Theta12CPT kFitSinSq2Theta12bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:239
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVarsCPT.h:306
FitSinSq2Theta12CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:224
FitSinSq2Theta23CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:122
FitDmSq32ScaledCPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:37
FitDmSq32Scaled, but for one sign only.
Definition: FitVarsCPT.h:34
double HighLimit() const override
Definition: FitVarsCPT.h:84
const FitSinSq2Theta13CPT kFitSinSq2Theta13bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:216
FitDmSq32CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:15
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVarsCPT.h:308
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:133
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:52
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:160
double LowLimit() const override
Definition: FitVarsCPT.h:83
const double fCenterDelta
Definition: FitVarsCPT.h:264
const FitSinSqTheta23CPT kFitSinSqTheta23bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:164
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:183
FitSinSqTheta23CPTOctant(osc::ENuSign nuSign, bool second=false)
Definition: FitVarsCPT.h:175
const FitSinSq2Theta23CPT kFitSinSq2Theta23bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:137
double Penalty(double val, osc::IOscCalcAdjustable *) const override
Definition: FitVarsCPT.h:310
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVars.cxx:92
const FitSinSqTheta23CPTOctant kFitSinSqTheta23nuSecond(osc::ENuSign::kNu, true)
Definition: FitVarsCPT.h:192
const FitSinSq2Theta12CPT kFitSinSq2Theta12nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:238
const FitDmSq32ScaledCPT kFitDmSq32Scalednu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:55
double sd(Eigen::VectorXd x)
const FitDmSq32ScaledCPT kFitDmSq32Scaledbar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:56
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:25
FitSinSqTheta23CPT, but forcing octant.
Definition: FitVarsCPT.h:172
const FitSinSq2Theta13CPT kFitSinSq2Theta13nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:215
FitSigmaCPT(SigmaDelta *sd)
Definition: FitVarsCPT.h:275
const FitSinSqTheta23CPTOctant kFitSinSqTheta23barSecond(osc::ENuSign::kNuBar, true)
Definition: FitVarsCPT.h:193
double LowLimit() const override
Definition: FitVarsCPT.h:184
const FitDmSq32CPTHierarchy kFitDmSq32nuNorm(osc::ENuSign::kNu, false)
Definition: FitVarsCPT.h:89
double HighLimit() const override
Definition: FitVarsCPT.h:185
const FitSinSq2Theta23CPT kFitSinSq2Theta23nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:136
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVarsCPT.h:78
SigmaDelta * fSigDel
Definition: FitVarsCPT.h:313
const FitDmSq21CPT kFitDmSq21bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:114
FitSinSq2Theta23, but for one sign only.
Definition: FitVarsCPT.h:119
const FitSinSqTheta23CPTOctant kFitSinSqTheta23barFirst(osc::ENuSign::kNuBar, false)
Definition: FitVarsCPT.h:191
T Clamp(T val) const
Definition: IFitVar.h:61
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:110
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:195
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVarsCPT.h:281
ENuSign
Simple neutrino/anti-neutrino enum.
Definition: OscCalcCPT.h:28
const IConstrainedFitVar & fYvar
Definition: FitVarsCPT.h:262
Oscillation probability calculators.
Definition: Calcs.h:5
const FitDmSq32CPT kFitDmSq32nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:28
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVarsCPT.h:284
double GetValue(const osc::IOscCalcAdjustable *osc) const override
Definition: FitVarsCPT.cxx:44
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVarsCPT.cxx:47
FitSinSq2Theta13CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:201
const FitSinSqTheta23CPTOctant kFitSinSqTheta23nuFirst(osc::ENuSign::kNu, false)
Definition: FitVarsCPT.h:190
const std::string & ShortName() const
Definition: IFitVar.h:37
SigmaDelta * fSigDel
Definition: FitVarsCPT.h:290
const FitSinSqTheta23CPT kFitSinSqTheta23nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:163
FitDmSq32CPTHierarchy(osc::ENuSign nuSign, bool inverted=false)
Definition: FitVarsCPT.h:69
Interface definition for fittable variables.
Definition: IFitVar.h:17
FitSinSqTheta23CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:145
const osc::ENuSign fNuSign
Definition: FitVarsCPT.h:212
Float_t e
Definition: plot.C:35
const IConstrainedFitVar & fXvar
Definition: FitVarsCPT.h:261
FitDmSq32, but for one sign only.
Definition: FitVarsCPT.h:12
const FitDmSq32CPTHierarchy kFitDmSq32nuInv(osc::ENuSign::kNu, true)
Definition: FitVarsCPT.h:91
const FitDmSq32CPTHierarchy kFitDmSq32barNorm(osc::ENuSign::kNuBar, false)
Definition: FitVarsCPT.h:90
double Penalty(double val, osc::IOscCalcAdjustable *osc) const override
Definition: FitVarsCPT.h:287
const FitDmSq21CPT kFitDmSq21nu(osc::ENuSign::kNu)
Definition: FitVarsCPT.h:113
const FitDmSq32CPT kFitDmSq32bar(osc::ENuSign::kNuBar)
Definition: FitVarsCPT.h:29
const FitDmSq32CPTHierarchy kFitDmSq32barInv(osc::ENuSign::kNuBar, true)
Definition: FitVarsCPT.h:92
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:104
FitSinSq2Theta12, but for one sign only.
Definition: FitVarsCPT.h:221
constexpr double kDmsq32Limit
Definition: FitVarsCPT.h:62
FitDmSq21CPT(osc::ENuSign nuSign)
Definition: FitVarsCPT.h:99
FitSinSq2Theta13, but for one sign only.
Definition: FitVarsCPT.h:198
enum BeamMode string