test_fitvarsproduct.C
Go to the documentation of this file.
2 using namespace ana;
3 
5 
6 #include "TCanvas.h"
7 #include "TGraph.h"
8 #include "TH2.h"
9 #include "TRandom3.h"
10 
11 #include <iostream>
12 
14 {
15  auto alpha = FitVarSinSqTheta23SinSq2Theta13();
17 
18  const IFitVar& x = kFitSinSq2Theta13;
19  const IFitVar& y = kFitSinSqTheta23;
20 
22 
23  // Check that you can set the variables in any order and get the same values
24  // back.
25  for(int i = 0; i < 1000; ++i){
26  const double vx = gRandom->Uniform(0, 1);
27  x.SetValue(&osc, vx);
28  assert(fabs(vx - x.GetValue(&osc) < 1e-6));
29  const double vy = gRandom->Uniform(0, 1);
30  y.SetValue(&osc, vy);
31  assert(fabs(vy - y.GetValue(&osc) < 1e-6));
32  assert(fabs(vx - x.GetValue(&osc) < 1e-6));
33  }
34 
35  for(int i = 0; i < 1000; ++i){
36  const double va = gRandom->Uniform(0, 1);
37  alpha.SetValue(&osc, va);
38  assert(fabs(va - alpha.GetValue(&osc) < 1e-6));
39  const double vb = gRandom->Uniform(0, 1);
40  beta.SetValue(&osc, vb);
41  assert(fabs(vb - beta.GetValue(&osc) < 1e-6));
42  assert(fabs(va - alpha.GetValue(&osc) < 1e-6));
43  }
44 
45  // Show what scanning x and y looks like on alpha, beta axes
46  TH2* axes = new TH2F("", "", 120, -.1, 1.1, 120, -.1, 1.1);
47  axes->GetXaxis()->SetTitle(alpha.LatexName().c_str());
48  axes->GetYaxis()->SetTitle(beta.LatexName().c_str());
49  axes->Draw();
50  for(int ix = 0; ix <= 20; ++ix){
51  TGraph* g = new TGraph;
52  for(int iy = 0; iy <= 100; ++iy){
53  x.SetValue(&osc, ix*.05);
54  y.SetValue(&osc, iy*.01);
55  g->SetPoint(iy, alpha.GetValue(&osc), beta.GetValue(&osc));
56  }
57  g->SetLineWidth(2);
58  g->Draw("l same");
59  }
60 
61  for(int iy = 0; iy <= 20; ++iy){
62  TGraph* g = new TGraph;
63  for(int ix = 0; ix <= 100; ++ix){
64  x.SetValue(&osc, ix*.01);
65  y.SetValue(&osc, iy*.05);
66  g->SetPoint(ix, alpha.GetValue(&osc), beta.GetValue(&osc));
67  }
68  g->SetLineWidth(2);
69  g->Draw("l same");
70  }
71 
72 
73  // Show what scanning alpha and beta looks like on x, y axes
74  new TCanvas;
75  axes = new TH2F("", "", 120, -.1, 1.1, 120, -.1, 1.1);
76  axes->GetXaxis()->SetTitle(x.LatexName().c_str());
77  axes->GetYaxis()->SetTitle(y.LatexName().c_str());
78  axes->Draw();
79 
80  for(int ia = 0; ia <= 20; ++ia){
81  TGraph* g = new TGraph;
82  for(int ib = 0; ib <= 100; ++ib){
83  alpha.SetValue(&osc, ia*.05);
84  beta.SetValue(&osc, ib*.01);
85  g->SetPoint(ib, x.GetValue(&osc), y.GetValue(&osc));
86  }
87  g->SetLineWidth(2);
88  g->Draw("l same");
89  }
90 
91  for(int ib = 0; ib <= 20; ++ib){
92  TGraph* g = new TGraph;
93  for(int ia = 0; ia <= 100; ++ia){
94  alpha.SetValue(&osc, ia*.01);
95  beta.SetValue(&osc, ib*.05);
96  g->SetPoint(ia, x.GetValue(&osc), y.GetValue(&osc));
97  }
98  g->SetLineWidth(2);
99  g->Draw("l same");
100  }
101 }
const std::string & LatexName() const
Definition: IFitVar.h:38
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
FitVarsProductMarg FitVarSinSqTheta23SinSq2Theta13Marg()
Return a FitVarsProductMarg to marginalize over this if using kFitSinSqTheta23SinSq2Theta13.
Double_t beta
void test_fitvarsproduct()
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:32
FitVarsProduct FitVarSinSqTheta23SinSq2Theta13()
Return a FitVarsProduct for .
Oscillation probability calculators.
Definition: Calcs.h:5
virtual void SetValue(osc::IOscCalcAdjustable *osc, double val) const =0
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
assert(nhit_max >=nhit_nbins)
Interface definition for fittable variables.
Definition: IFitVar.h:17
const FitSinSq2Theta13 kFitSinSq2Theta13
Definition: FitVars.cxx:13
Float_t e
Definition: plot.C:35
virtual double GetValue(const osc::IOscCalcAdjustable *osc) const =0