OscProb
Utils.h File Reference
#include "colormod.h"
#include "../tutorial/SetNiceStyle.C"

Go to the source code of this file.

Functions

void SetNominalPars (OscProb::PMNS_Base *p)
 
OscProb::PMNS_FastGetFast (bool is_nominal)
 
OscProb::PMNS_IterGetIter (bool is_nominal)
 
OscProb::PMNS_DecoGetDeco (bool is_nominal)
 
OscProb::PMNS_SterileGetSterile (bool is_nominal)
 
OscProb::PMNS_DecayGetDecay (bool is_nominal)
 
OscProb::PMNS_NSIGetNSI (bool is_nominal)
 
OscProb::PMNS_SNSIGetSNSI (bool is_nominal)
 
OscProb::PMNS_LIVGetLIV (bool is_nominal)
 
OscProb::PMNS_NUNMGetNUNM (bool is_nominal)
 
OscProb::PMNS_BaseGetModel (string model, bool is_nominal=false)
 
vector< string > GetListOfModels ()
 
void SetTestPath (OscProb::PMNS_Base *p)
 
void SaveTestFile (OscProb::PMNS_Base *p, TString filename)
 
int CheckProb (OscProb::PMNS_Base *p, TString filename)
 

Function Documentation

◆ CheckProb()

int CheckProb ( OscProb::PMNS_Base p,
TString  filename 
)

Definition at line 226 of file Utils.h.

226 {
227
228 SetTestPath(p);
229
230 TFile* f = new TFile("data/"+filename, "read");
231
232 int ntests = 0;
233 int fails = 0;
234
235 TCanvas* c1 = 0;
236 TH1D* h0 = 0;
237 TH1D* h = 0;
238
239 for(int flvi=0; flvi<3; flvi++){
240 for(int flvf=0; flvf<3; flvf++){
241 for(int isnb=0; isnb<2; isnb++){
242 p->SetIsNuBar(isnb);
243 TString hname = TString::Format("h%d%d%d",flvi,flvf,isnb);
244 h0 = (TH1D*)f->Get(hname);
245 h = (TH1D*)h0->Clone();
246 bool plot = false;
247 for(int i=1; i<=h0->GetNbinsX(); i++){
248 double energy = h->GetBinCenter(i);
249 double dE = h->GetBinWidth(i);
250 double p0 = h0->GetBinContent(i);
251 double p1 = p->AvgProb(flvi, flvf, energy, dE);
252 ntests++;
253 if(abs(p0-p1)>1e-12){
254 plot = true;
255 fails++;
256 }
257 h->SetBinContent(i, p1);
258 }
259 if(plot){
260 c1 = new TCanvas();
261 c1->Divide(1,2);
262 c1->cd(1);
263 SetHist(h0, kBlue);
264 SetHist(h, kRed);
265 TString nu_lab = isnb ? "#bar{#nu}" : "#nu";
266 TString flv_lab[3] = {"e","#mu","#tau"};
267 TString ylab = "P(" + nu_lab + "_{" + flv_lab[flvi] +
268 "}#rightarrow" + nu_lab + "_{" + flv_lab[flvf] + "})";
269 h0->SetTitle(";Energy [GeV];"+ylab+";");
270 h->SetLineStyle(7);
271 double ymax = max(h->GetMaximum(),
272 h0->GetMaximum());
273 double ymin = min(h->GetMinimum(),
274 h0->GetMinimum());
275 h0->GetYaxis()->SetRangeUser(ymin, ymax);
276 h0->DrawCopy("hist");
277 h->DrawCopy("hist same");
278 SetTH1Margin();
279 gPad->SetLogx();
280 c1->cd(2);
281 h->SetTitle(";Energy [GeV];#Delta"+ylab+";");
282 h->Add(h0,-1);
283 h->SetLineStyle(1);
284 h->DrawCopy("hist");
285 SetTH1Margin();
286 gPad->SetLogx();
287 MiscText(0.55,0.8,0.1,filename,kGray,1);
288 c1->DrawClone();
289 TString pngfile = filename;
290 pngfile.ReplaceAll(".root",".png");
291 c1->SaveAs("plots/Failed_"+hname+"_"+pngfile);
292 delete c1;
293 }
294 delete h0, h;
295 }}}
296
297 if(fails>0){
298 printf((Color::FAILED + " Found %d differences in %d tests (%.3g%%) in %s\n").c_str(),
299 fails, ntests, 100.*fails/ntests, filename.Data());
300 }
301 else {
302 cout << Color::PASSED << " No differences found in " << filename << endl;
303 }
304
305 return fails;
306
307}
void SetTestPath(OscProb::PMNS_Base *p)
Definition: Utils.h:186
virtual void SetIsNuBar(bool isNuBar)
Set the anti-neutrino flag.
Definition: PMNS_Base.cxx:243
virtual double AvgProb(vectorC nu_in, int flvf, double E, double dE=0)
Compute the average probability over a bin of energy.
Definition: PMNS_Base.cxx:1568
static const string PASSED
Definition: colormod.h:21
static const string FAILED
Definition: colormod.h:20

References OscProb::PMNS_Base::AvgProb(), Color::FAILED, Color::PASSED, OscProb::PMNS_Base::SetIsNuBar(), and SetTestPath().

◆ GetDecay()

OscProb::PMNS_Decay * GetDecay ( bool  is_nominal)

Definition at line 68 of file Utils.h.

68 {
69
72 if(!is_nominal){
73 p->SetAlpha3(1e-4);
74 }
75
76 return p;
77
78}
void SetNominalPars(OscProb::PMNS_Base *p)
Definition: Utils.h:7
Implementation of neutrino decay in a three-neutrino framework.
Definition: PMNS_Decay.h:30
virtual void SetAlpha3(double alpha3)
Definition: PMNS_Decay.cxx:62

References OscProb::PMNS_Decay::SetAlpha3(), and SetNominalPars().

◆ GetDeco()

OscProb::PMNS_Deco * GetDeco ( bool  is_nominal)

Definition at line 38 of file Utils.h.

38 {
39
42 if(!is_nominal){
43 p->SetGamma(2, 1e-23);
44 p->SetGamma(3, 1e-22);
45 }
46
47 return p;
48
49}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework with decoherence.
Definition: PMNS_Deco.h:27
virtual void SetGamma(int j, double val)
Set any given decoherence parameter.
Definition: PMNS_Deco.cxx:51

References OscProb::PMNS_Deco::SetGamma(), and SetNominalPars().

◆ GetFast()

OscProb::PMNS_Fast * GetFast ( bool  is_nominal)

Definition at line 20 of file Utils.h.

20 {
21
24 return p;
25
26}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework.
Definition: PMNS_Fast.h:40

References SetNominalPars().

◆ GetIter()

OscProb::PMNS_Iter * GetIter ( bool  is_nominal)

Definition at line 29 of file Utils.h.

29 {
30
33 return p;
34
35}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework.
Definition: PMNS_Iter.h:35

References SetNominalPars().

◆ GetListOfModels()

vector< string > GetListOfModels ( )

Definition at line 175 of file Utils.h.

175 {
176
177 //return {"Decay"};
178
179 return {"Fast", "Iter", "Sterile", "NSI",
180 "Deco", "Decay", "LIV", "SNSI",
181 "NUNM"};
182
183}

◆ GetLIV()

OscProb::PMNS_LIV * GetLIV ( bool  is_nominal)

Definition at line 117 of file Utils.h.

117 {
118
121 if(!is_nominal){
122 p->SetaT(0,0, 0.1e-22, 0);
123 p->SetaT(0,1, 0.2e-22, 0);
124 p->SetaT(0,2, 0.3e-22, 0);
125 p->SetaT(1,1, 0.4e-22, 0);
126 p->SetaT(1,2, 0.5e-22, 0);
127 p->SetaT(2,2, 0.6e-22, 0);
128 p->SetcT(0,0, 0.1e-22, 0);
129 p->SetcT(0,1, 0.2e-22, 0);
130 p->SetcT(0,2, 0.3e-22, 0);
131 p->SetcT(1,1, 0.4e-22, 0);
132 p->SetcT(1,2, 0.5e-22, 0);
133 p->SetcT(2,2, 0.6e-22, 0);
134 }
135
136 return p;
137
138}
Implements oscillations with LIV as modelled by SME.
Definition: PMNS_LIV.h:28
virtual void SetaT(int flvi, int flvj, int dim, double val, double phase)
Definition: PMNS_LIV.cxx:67
virtual void SetcT(int flvi, int flvj, int dim, double val, double phase)
Definition: PMNS_LIV.cxx:119

References OscProb::PMNS_LIV::SetaT(), OscProb::PMNS_LIV::SetcT(), and SetNominalPars().

◆ GetModel()

OscProb::PMNS_Base * GetModel ( string  model,
bool  is_nominal = false 
)

Definition at line 159 of file Utils.h.

159 {
160
161 if(model == "Iter") return GetIter(is_nominal);
162 if(model == "Deco") return GetDeco(is_nominal);
163 if(model == "Sterile") return GetSterile(is_nominal);
164 if(model == "Decay") return GetDecay(is_nominal);
165 if(model == "NSI") return GetNSI(is_nominal);
166 if(model == "LIV") return GetLIV(is_nominal);
167 if(model == "SNSI") return GetSNSI(is_nominal);
168 if(model == "NUNM") return GetNUNM(is_nominal);
169
170 return GetFast(is_nominal);
171
172}
OscProb::PMNS_NUNM * GetNUNM(bool is_nominal)
Definition: Utils.h:141
OscProb::PMNS_Deco * GetDeco()
Definition: Utils.h:24
OscProb::PMNS_Iter * GetIter()
Definition: Utils.h:17
OscProb::PMNS_LIV * GetLIV()
Definition: Utils.h:88
OscProb::PMNS_Decay * GetDecay()
Definition: Utils.h:48
OscProb::PMNS_Sterile * GetSterile()
Definition: Utils.h:35
OscProb::PMNS_NSI * GetNSI()
Definition: Utils.h:58
OscProb::PMNS_SNSI * GetSNSI()
Definition: Utils.h:73
OscProb::PMNS_Fast * GetFast()
Definition: Utils.h:10

References GetDecay(), GetDeco(), GetFast(), GetIter(), GetLIV(), GetNSI(), GetNUNM(), GetSNSI(), and GetSterile().

◆ GetNSI()

OscProb::PMNS_NSI * GetNSI ( bool  is_nominal)

Definition at line 81 of file Utils.h.

81 {
82
85 if(!is_nominal){
86 p->SetEps(0,0, 0.1, 0);
87 p->SetEps(0,1, 0.2, 0);
88 p->SetEps(0,2, 0.3, 0);
89 p->SetEps(1,1, 0.4, 0);
90 p->SetEps(1,2, 0.5, 0);
91 p->SetEps(2,2, 0.6, 0);
92 }
93
94 return p;
95
96}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework with NSI.
Definition: PMNS_NSI.h:28
virtual void SetEps(int flvi, int flvj, double val, double phase)
Set any given NSI parameter.
Definition: PMNS_NSI.cxx:86

References OscProb::PMNS_NSI::SetEps(), and SetNominalPars().

◆ GetNUNM()

OscProb::PMNS_NUNM * GetNUNM ( bool  is_nominal)

Definition at line 141 of file Utils.h.

141 {
142
145 if(!is_nominal){
146 p->SetAlpha(0,0, 0.05, 0);
147 p->SetAlpha(1,0, 0.06, 0);
148 p->SetAlpha(2,0, 0.07, 0);
149 p->SetAlpha(1,1, 0.08, 0);
150 p->SetAlpha(2,1, 0.09, 0);
151 p->SetAlpha(2,2, 0.1, 0);
152 }
153
154 return p;
155
156}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework with Non unitary ...
Definition: PMNS_NUNM.h:30
virtual void SetAlpha(int i, int j, double val, double phase)
Set any given NUNM parameter.
Definition: PMNS_NUNM.cxx:93

References OscProb::PMNS_NUNM::SetAlpha(), and SetNominalPars().

Referenced by GetModel().

◆ GetSNSI()

OscProb::PMNS_SNSI * GetSNSI ( bool  is_nominal)

Definition at line 99 of file Utils.h.

99 {
100
103 if(!is_nominal){
104 p->SetEps(0,0, 0.1, 0);
105 p->SetEps(0,1, 0.2, 0);
106 p->SetEps(0,2, 0.3, 0);
107 p->SetEps(1,1, 0.4, 0);
108 p->SetEps(1,2, 0.5, 0);
109 p->SetEps(2,2, 0.6, 0);
110 }
111
112 return p;
113
114}
Implementation of oscillations of neutrinos in matter in a three-neutrino framework with scalar NSI.
Definition: PMNS_SNSI.h:26

References OscProb::PMNS_NSI::SetEps(), and SetNominalPars().

◆ GetSterile()

OscProb::PMNS_Sterile * GetSterile ( bool  is_nominal)

Definition at line 52 of file Utils.h.

52 {
53
56 if(!is_nominal){
57 p->SetDm(4, 0.1);
58 p->SetAngle(1,4, 0.1);
59 p->SetAngle(2,4, 0.1);
60 p->SetAngle(3,4, 0.1);
61 }
62
63 return p;
64
65}
virtual void SetDm(int j, double dm)
Set the mass-splitting dm_j1 in eV^2.
Definition: PMNS_Base.cxx:674
virtual void SetAngle(int i, int j, double th)
Set the mixing angle theta_ij.
Definition: PMNS_Base.cxx:539
Implementation of oscillations of neutrinos in matter in a N-neutrino framework.
Definition: PMNS_Sterile.h:34

References OscProb::PMNS_Base::SetAngle(), OscProb::PMNS_Base::SetDm(), and SetNominalPars().

◆ SaveTestFile()

void SaveTestFile ( OscProb::PMNS_Base p,
TString  filename 
)

Definition at line 195 of file Utils.h.

195 {
196
197 SetTestPath(p);
198
199 int nbins = 100;
200 vector<double> xbins = GetLogAxis(nbins, 0.1, 10);
201 TH1D* h = 0;
202
203 TFile* f = new TFile("data/"+filename, "recreate");
204
205 for(int flvi=0; flvi<3; flvi++){
206 for(int flvf=0; flvf<3; flvf++){
207 for(int isnb=0; isnb<2; isnb++){
208 p->SetIsNuBar(isnb);
209 TString hname = TString::Format("h%d%d%d",flvi,flvf,isnb);
210 h = new TH1D(hname, "", nbins, &xbins[0]);
211 for(int i=1; i<=nbins; i++){
212 double energy = h->GetBinCenter(i);
213 double dE = h->GetBinWidth(i);
214 h->SetBinContent(i, p->AvgProb(flvi, flvf, energy, dE));
215 }
216 h->Write();
217 delete h;
218 }}}
219
220 f->Close();
221 cout << "Saved new test file: data/" + filename << endl;
222
223}

References OscProb::PMNS_Base::AvgProb(), OscProb::PMNS_Base::SetIsNuBar(), and SetTestPath().

◆ SetNominalPars()

void SetNominalPars ( OscProb::PMNS_Base p)

Definition at line 7 of file Utils.h.

7 {
8
9 // Set to NuFIT 5.2 values (NO w/ SK)
10 p->SetDm(2, 7.41e-5);
11 p->SetDm(3, 2.507e-3);
12 p->SetAngle(1,2, asin(sqrt(0.303)));
13 p->SetAngle(1,3, asin(sqrt(0.02225)));
14 p->SetAngle(2,3, asin(sqrt(0.451)));
15 p->SetDelta(1,3, 232 * TMath::DegToRad());
16
17}
virtual void SetDelta(int i, int j, double delta)
Set the CP phase delta_ij.
Definition: PMNS_Base.cxx:602

References OscProb::PMNS_Base::SetAngle(), OscProb::PMNS_Base::SetDelta(), and OscProb::PMNS_Base::SetDm().

Referenced by GetDecay(), GetDeco(), GetFast(), GetIter(), GetLIV(), GetNSI(), GetNUNM(), GetSNSI(), and GetSterile().

◆ SetTestPath()

void SetTestPath ( OscProb::PMNS_Base p)

Definition at line 186 of file Utils.h.

186 {
187
188 p->SetPath(1000, 2);
189 p->AddPath(1000, 4);
190 p->AddPath(1000, 2);
191
192}
virtual void AddPath(NuPath p)
Add a path to the sequence.
Definition: PMNS_Base.cxx:307
virtual void SetPath(NuPath p)
Set a single path.
Definition: PMNS_Base.cxx:330

References OscProb::PMNS_Base::AddPath(), and OscProb::PMNS_Base::SetPath().

Referenced by CheckProb(), and SaveTestFile().