test_nue2018_surface.C
Go to the documentation of this file.
3 #include "CAFAna/Fit/Fit.h"
4 #include "CAFAna/Vars/FitVars.h"
8 #include "OscLib/IOscCalc.h"
11 
12 #include "TCanvas.h"
13 #include "TFile.h"
14 #include "TGraph.h"
15 
16 using namespace ana;
17 
18 #include <iostream>
19 
20 void test_nue2018_surface(bool create){
21 
22  if(create){
23  double pot = 6E20;
25 
26  auto pred = new PredictionSystJoint2018 ( kProportional, calc,
27  {},
28  "fhc",
29  false, true, "", // isfakedata, mergePeripheral,
30  true, {}); //mini-memo, summingsys
31 
32  auto data = pred->Predict(calc).FakeData(pot);
34 
35  FrequentistSurface surf(&expt, calc,
36  &kFitSinSqTheta23, 30,0.3,0.75,
37  &kFitDmSq32, 30, 2e-3, 3.5e-3,
38  {&kFitDeltaInPiUnits}, {}, {}, {},false);
39  TFile * file = new TFile ("test_surf.root","recreate");
40  surf.SaveTo(file, "surf");
41  file->Close();
42  }
43  else{
44  TFile * file = new TFile ("test_surf.root","read");
45 
46  std::unique_ptr<FrequentistSurface> surf = ISurface::LoadFrom(file, "surf");
47 
48  surf->Draw();
49 
50  surf->DrawBestFit(kRed);
51  std::cout << "MinChi " << surf->BestLikelihood() << std::endl;
52  new TCanvas;
53  surf->DrawContour(Gaussian90Percent2D(*surf),kSolid, kRed);
54  new TCanvas;
55  auto h2 = surf->ToTH2();
56  h2->Draw("colz");
57 
58  auto graphs = surf->GetGraphs(Gaussian2Sigma2D(*surf));
59  for (auto gr:graphs){
60  gr->SetLineColor(kBlue);
61  gr->Draw("C same");
62  }
63 
64  for (auto h:(surf->GetMarginalizedHists())){
65  new TCanvas;
66  h->Draw();
67  }
68 
69 
70  }
71 
72 
73 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Loads shifted spectra from files.
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:18
void test_nue2018_surface(bool create)
TH2 * Gaussian2Sigma2D(const FrequentistSurface &s)
Up-value surface for 2 sigma confidence in 2D in gaussian approximation.
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
const XML_Char const XML_Char * data
Definition: expat.h:268
Log-likelihood scan across two parameters.
expt
Definition: demo5.py:34
#define pot
OStream cout
Definition: OStream.cxx:6
TH1F * h2
Definition: plot.C:45
TH2 * Gaussian90Percent2D(const FrequentistSurface &s)
Up-value surface for 90% confidence in 2D in gaussian approximation.
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
TFile * file
Definition: cellShifts.C:17
Float_t e
Definition: plot.C:35
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
Compare a single data spectrum to the MC + cosmics expectation.
surf
Definition: demo5.py:35