All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalcsNuFit.cxx
Go to the documentation of this file.
2 
4 
5 #include "OscLib/OscCalcPMNSOpt.h"
6 
8 
9 namespace ana
10 {
11  //----------------------------------------------------------------------
13  {
14  assert(hie == +1 || hie == -1);
15 
16  osc::IOscCalcAdjustable* ret = new osc::OscCalcPMNSOpt;
17  ret->SetL(kBaseline);
18  ret->SetRho(kEarthDensity);
19 
20  ret->SetDmsq21(kNuFitDmsq21CV);
21  ret->SetTh12(kNuFitTh12CV);
22 
23  if(hie > 0){
24  ret->SetDmsq32(kNuFitDmsq32CVNH);
25  ret->SetTh23(kNuFitTh23CVNH);
26  ret->SetTh13(kNuFitTh13CVNH);
27  ret->SetdCP(kNuFitdCPCVNH);
28  }
29  else{
30  ret->SetDmsq32(kNuFitDmsq32CVIH);
31  ret->SetTh23(kNuFitTh23CVIH);
32  ret->SetTh13(kNuFitTh13CVIH);
33  ret->SetdCP(kNuFitdCPCVIH);
34  }
35 
36  return ret;
37  }
38 
39  bool HasVar(std::vector<const IFitVar*> oscVars, std::string name){
40  for(auto *s :oscVars ) if(s->ShortName() == name) return true;
41  return false;
42  }
43 
44  //----------------------------------------------------------------------
45  osc::IOscCalcAdjustable* ThrownNuFitOscCalc(int hie, std::vector<const IFitVar*> oscVars)
46  {
47  assert(hie == +1 || hie == -1);
48 
49  osc::IOscCalcAdjustable* ret = NuFitOscCalc(hie);//new osc::OscCalcPMNSOpt;
50 
51  // Throw 12 and rho within errors
52  if (HasVar(oscVars, kFitRho.ShortName()))
53  ret->SetRho(kEarthDensity*(1+0.02*gRandom->Gaus()));
54 
55  if (HasVar(oscVars, kFitDmSq21.ShortName()))
56  ret->SetDmsq21(kNuFitDmsq21CV*(1+kNuFitDmsq21Err*gRandom->Gaus()));
57 
58  if (HasVar(oscVars, kFitSinSq2Theta12.ShortName()))
59  ret->SetTh12(kNuFitTh12CV*(1+kNuFitTh12Err*gRandom->Gaus()));
60 
61  // Uniform throws within +/-3 sigma
62  if(hie > 0){
63  if (HasVar(oscVars, kFitDmSq32Scaled.ShortName()))
64  ret->SetDmsq32(gRandom->Uniform(kNuFitDmsq32CVNH-3*kNuFitDmsq32ErrNH,
66 
67  if (HasVar(oscVars, kFitSinSqTheta23.ShortName()))
68  ret->SetTh23(gRandom->Uniform(kNuFitTh23CVNH-3*kNuFitTh23ErrNH,
70 
71  if (HasVar(oscVars, kFitTheta13.ShortName()))
72  ret->SetTh13(gRandom->Uniform(kNuFitTh13CVNH-3*kNuFitTh13ErrNH,
74 
75  if (HasVar(oscVars, kFitDeltaInPiUnits.ShortName()))
76  ret->SetdCP(gRandom->Uniform(-1*TMath::Pi(), TMath::Pi()));
77 
78  } else {
79  if (HasVar(oscVars, kFitDmSq32Scaled.ShortName()))
80  ret->SetDmsq32(gRandom->Uniform(kNuFitDmsq32CVIH-3*kNuFitDmsq32ErrIH,
82 
83  if (HasVar(oscVars, kFitSinSqTheta23.ShortName()))
84  ret->SetTh23(gRandom->Uniform(kNuFitTh23CVIH-3*kNuFitTh23ErrIH,
86 
87  if (HasVar(oscVars, kFitTheta13.ShortName()))
88  ret->SetTh13(gRandom->Uniform(kNuFitTh13CVIH-3*kNuFitTh13ErrIH,
90 
91  if (HasVar(oscVars, kFitDeltaInPiUnits.ShortName()))
92  ret->SetdCP(gRandom->Uniform(-1*TMath::Pi(), TMath::Pi()));
93  }
94  return ret;
95  }
96 
97  //----------------------------------------------------------------------
99  {
100  assert(hie == +1 || hie == -1);
101 
102  osc::IOscCalcAdjustable* ret = new osc::OscCalcPMNSOpt;
103  ret->SetL(kBaseline);
104  ret->SetRho(kEarthDensity);
105 
106  ret->SetDmsq21(kNuFitDmsq21CV + kNuFitDmsq21Err);
107  ret->SetTh12(kNuFitTh12CV + kNuFitTh12Err);
108 
109  if(hie > 0){
110  ret->SetDmsq32(kNuFitDmsq32CVNH + kNuFitDmsq32ErrNH);
111  ret->SetTh23(kNuFitTh23CVNH + kNuFitTh23ErrNH);
112  ret->SetTh13(kNuFitTh13CVNH + kNuFitTh13ErrNH);
113  }
114  else{
115  ret->SetDmsq32(kNuFitDmsq32CVIH + kNuFitDmsq32ErrIH);
116  ret->SetTh23(kNuFitTh23CVIH + kNuFitTh23ErrIH);
117  ret->SetTh13(kNuFitTh13CVIH + kNuFitTh13ErrIH);
118  }
119 
120  ret->SetdCP(0); // a little ambiguous in the instructions
121 
122  return ret;
123  }
124 
125  //----------------------------------------------------------------------
127  const SystShifts& /*syst*/) const
128  {
129  double ret =
130  util::sqr((calc->GetDmsq21() - kNuFitDmsq21CV)/kNuFitDmsq21Err) +
131  util::sqr((calc->GetTh12() - kNuFitTh12CV)/kNuFitTh12Err);
132 
133  if(calc->GetDmsq32() > 0){
134  ret +=
135  util::sqr((calc->GetDmsq32() - kNuFitDmsq32CVNH)/kNuFitDmsq32ErrNH) +
136  util::sqr((calc->GetTh23() - kNuFitTh23CVNH)/kNuFitTh23ErrNH) +
137  util::sqr((calc->GetTh13() - kNuFitTh13CVNH)/kNuFitTh13ErrNH);
138  }
139  else{
140  ret +=
141  util::sqr((calc->GetDmsq32() - kNuFitDmsq32CVIH)/kNuFitDmsq32ErrIH) +
142  util::sqr((calc->GetTh23() - kNuFitTh23CVIH)/kNuFitTh23ErrIH) +
143  util::sqr((calc->GetTh13() - kNuFitTh13CVIH)/kNuFitTh13ErrIH);
144  }
145 
146  // No term in delta
147 
148  return ret;
149  }
150 
151  //----------------------------------------------------------------------
152  Penalizer_GlbLike::Penalizer_GlbLike(osc::IOscCalcAdjustable* cvcalc, int hietrue, bool weakOnly) : fWeakOnly(weakOnly) {
153 
154  fDmsq21 = cvcalc->GetDmsq21();
155  fTh12 = cvcalc->GetTh12();
156  fDmsq32 = cvcalc->GetDmsq32();
157  fTh23 = cvcalc->GetTh23();
158  fTh13 = cvcalc->GetTh13();
159  fRho = cvcalc->GetRho();
160 
161  //Set the errors by hand for now.
162  //Fractional errors in GLoBES convention
163  //NH: 0.023, 0.018, 0.058, 0.0, 0.024, 0.016
164  //IH: 0.023, 0.018, 0.048, 0.0, 0.024, 0.016
165 
168  fDmsq32Err = (hietrue > 0) ? kNuFitDmsq32ErrNH : kNuFitDmsq32ErrIH;
169  fTh13Err = (hietrue > 0) ? kNuFitTh13ErrNH : kNuFitTh13ErrIH;
170  fTh23Err = (hietrue > 0) ? kNuFitTh23ErrNH : kNuFitTh23ErrIH;
171 
172  fRhoErr = 0.02*fRho;
173 
174  }
175 
177  const SystShifts& /*syst*/) const {
178 
179  //Usage: calc is the fit parameters as above
180  //Starting fit parameters and errors are set in constructor - this is equivalent to SetCentralValues in globes
181 
182  double ret =
183  util::sqr((calc->GetDmsq21() - fDmsq21)/fDmsq21Err) +
184  util::sqr((calc->GetTh12() - fTh12)/fTh12Err) +
185  util::sqr((calc->GetRho() - fRho)/fRhoErr);
186 
187  // if fWeakOnly is set, only apply a constraint to the parameter we can only weakly constrain in DUNE
188  if (!fWeakOnly)
189  ret +=
190  util::sqr((calc->GetDmsq32() - fDmsq32)/fDmsq32Err) +
191  util::sqr((calc->GetTh23() - fTh23)/fTh23Err) +
192  util::sqr((calc->GetTh13() - fTh13)/fTh13Err);
193 
194  // No term in delta
195 
196  return ret;
197  }
198 
199 
200 }
const FitSinSq2Theta12 kFitSinSq2Theta12
Definition: FitVars.h:179
double ChiSq(osc::IOscCalcAdjustable *calc, const SystShifts &syst=SystShifts::Nominal()) const override
Definition: CalcsNuFit.cxx:176
const FitTheta13 kFitTheta13
Definition: FitVars.h:20
const double kNuFitDmsq32ErrNH
Definition: CalcsNuFit.h:32
const double kNuFitTh23ErrIH
Definition: CalcsNuFit.h:37
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
virtual std::string ShortName() const
Definition: FitVars.h:171
const double kNuFitDmsq32ErrIH
Definition: CalcsNuFit.h:36
virtual std::string ShortName() const
Definition: FitVars.h:207
virtual std::string ShortName() const
Definition: FitVars.h:76
virtual std::string ShortName() const
Definition: FitVars.h:48
process_name opflashCryoW ana
const double kNuFitTh12Err
Definition: CalcsNuFit.h:30
const double kNuFitdCPCVIH
Definition: CalcsNuFit.h:26
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
virtual std::string ShortName() const
Definition: FitVars.h:15
const FitDmSq21 kFitDmSq21
Definition: FitVars.h:199
virtual std::string ShortName() const
Definition: FitVars.h:189
const double kNuFitDmsq32CVIH
Definition: CalcsNuFit.h:23
osc::IOscCalcAdjustable * ThrownNuFitOscCalc(int hie, std::vector< const IFitVar * > oscVars)
Definition: CalcsNuFit.cxx:45
virtual std::string ShortName() const
Definition: FitVars.h:133
const double kNuFitTh23CVIH
Definition: CalcsNuFit.h:24
const double kEarthDensity
Definition: CalcsNuFit.h:42
const double kNuFitTh23CVNH
Definition: CalcsNuFit.h:19
const double kNuFitTh13ErrIH
Definition: CalcsNuFit.h:38
const double kNuFitDmsq21Err
Definition: CalcsNuFit.h:29
Penalizer_GlbLike(osc::IOscCalcAdjustable *cvcalc, int hietrue, bool weakOnly=false)
Definition: CalcsNuFit.cxx:152
const double kNuFitDmsq21CV
Definition: CalcsNuFit.h:14
double ChiSq(osc::IOscCalcAdjustable *calc, const SystShifts &syst=SystShifts::Nominal()) const override
Definition: CalcsNuFit.cxx:126
const double kNuFitdCPCVNH
Definition: CalcsNuFit.h:21
osc::IOscCalcAdjustable * NuFitOscCalcPlusOneSigma(int hie)
Definition: CalcsNuFit.cxx:98
const double kBaseline
Definition: CalcsNuFit.h:41
const FitDmSq32Scaled kFitDmSq32Scaled
Definition: FitVars.h:143
const double kNuFitTh13CVIH
Definition: CalcsNuFit.h:25
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
const double kNuFitDmsq32CVNH
Definition: CalcsNuFit.h:18
const FitSinSqTheta23 kFitSinSqTheta23
Definition: FitVars.h:84
const double kNuFitTh23ErrNH
Definition: CalcsNuFit.h:33
const double kNuFitTh13ErrNH
Definition: CalcsNuFit.h:34
then echo fcl name
osc::IOscCalcAdjustable * NuFitOscCalc(int hie)
Definition: CalcsNuFit.cxx:12
const FitDeltaInPiUnits kFitDeltaInPiUnits
Definition: FitVars.h:53
bool HasVar(std::vector< const IFitVar * > oscVars, std::string name)
Definition: CalcsNuFit.cxx:39
const FitRho kFitRho
Definition: FitVars.h:217
const double kNuFitTh12CV
Definition: CalcsNuFit.h:15
const double kNuFitTh13CVNH
Definition: CalcsNuFit.h:20