FrequentistSurface.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "CAFAna/Core/ISyst.h"
6 
7 #include "CAFAna/Fit/ISurface.h"
9 
10 #include "Rtypes.h"
11 #include "TAttMarker.h"
12 
13 #include <iostream>
14 #include <map>
15 
16 class TGraph;
17 class TH2;
18 class TH2F;
19 
20 namespace ana
21 {
22  class IExperiment;
23  class IFitVar;
24 
25  /// Log-likelihood scan across two parameters
27  {
28  public:
29  friend class NumuSurface;
30  friend class NueSurface;
31 
32  /// \param expt The experiment object to draw \f$ \chi^2 \f$ values from
33  /// \param calc Values for oscillation parameters to be held fixed
34  /// \param xvar Oscillation parameter to place on the x axis
35  /// \param nbinsx Number of bins along x axis
36  /// \param xmin Minimum value of x axis
37  /// \param xmax Maximum value of x axis
38  /// \param nbinsy Number of bins along y axis
39  /// \param ymin Minimum value of y axis
40  /// \param ymax Maximum value of y axis
41  /// \param profVars Oscillation parameters to profile over
42  /// \param profSysts Systematic parameters to profile over
43  /// \param seedPts Try all combinations of these params as seeds
44  /// \param systSeedPts Try all of these systematic combinations as seeds
45  /// \param parallel Use all the cores on this machine? Be careful...
48  const IFitVar* xvar, int nbinsx, double xmin, double xmax,
49  const IFitVar* yvar, int nbinsy, double ymin, double ymax,
50  const std::vector<const IFitVar*>& profVars = {},
51  const std::vector<const ISyst*>& profSysts = {},
52  const SeedList& seedPts = SeedList(),
53  const std::vector<SystShifts>& systSeedPts = {},
54  bool parallel = false,
56 
57  virtual ~FrequentistSurface();
58 
59  /// Maps of the values taken on by the profiled parameters
60  std::vector<TH2*> GetProfiledHists() {return fProfHists;}
61 
62  void SaveTo(TDirectory * dir)const;
63  static std::unique_ptr<FrequentistSurface> LoadFrom(TDirectory * dir);
64 
65  protected:
67 
68  void CreateHistograms(const IFitVar* xvar, int nbinsx, double xmin, double xmax,
69  const IFitVar* yvar, int nbinsy, double ymin, double ymax,
70  const std::vector<const IFitVar*>& profVars,
71  const std::vector<const ISyst*>& profSysts);
72 
73  std::string ProgressBarTitle(const IFitVar* xvar, const IFitVar* yvar,
74  const std::vector<const IFitVar*>& profVars,
75  const std::vector<const ISyst*>& profSysts) const;
76 
77  virtual void FillSurface(const IExperiment* expt,
79  const IFitVar* xvar, const IFitVar* yvar,
80  const std::vector<const IFitVar*>& profVars,
81  const std::vector<const ISyst*>& profSysts,
82  const SeedList& seedPts,
83  const std::vector<SystShifts>& systSeedPts);
84 
85  double FillSurfacePoint(const IExperiment* expt,
87  const IFitVar* xvar, double x,
88  const IFitVar* yvar, double y,
89  const std::vector<const IFitVar*>& profVars,
90  const std::vector<const ISyst*>& profSysts,
91  const SeedList& seedPts,
92  const std::vector<SystShifts>& systSeedPts);
93 
94  void FindMinimum(const IExperiment* expt,
96  const IFitVar* xvar, const IFitVar* yvar,
97  const std::vector<const IFitVar*>& profVars,
98  const std::vector<const ISyst*>& profSysts,
99  const SeedList& seedPts,
100  const std::vector<SystShifts>& systSeedPts);
101 
102  bool fParallel;
103 
105 
106  // Best fit point
107  std::vector<TH2*> fProfHists;
108  };
109 
110  /// Up-value surface for 68% confidence in 2D in gaussian approximation
112  /// Up-value surface for 90% confidence in 2D in gaussian approximation
114  /// Up-value surface for 95% confidence in 2D in gaussian approximation
116  /// Up-value surface for 2 sigma confidence in 2D in gaussian approximation
117  TH2* Gaussian2Sigma2D (const FrequentistSurface& s);
118  /// Up-value surface for 99% confidence in 2D in gaussian approximation
120  /// Up-value surface for 3 sigma confidence in 2D in gaussian approximation
121  TH2* Gaussian3Sigma2D (const FrequentistSurface& s);
122 
123  // First approximation of the correct up-values to use for ss2th13 vs delta
124 
125  /// Up-value surface for 68% confidence in 1D in gaussian approximation
127  /// Up-value surface for 90% confidence in 1D in gaussian approximation
129  /// Up-value surface for 95% confidence in 1D in gaussian approximation
131  /// Up-value surface for 2 sigma confidence in 1D in gaussian approximation
132  TH2* Gaussian2Sigma1D (const FrequentistSurface& s);
133  /// Up-value surface for 99% confidence in 1D in gaussian approximation
135  /// Up-value surface for 3 sigma confidence in 1D in gaussian approximation
136  TH2* Gaussian3Sigma1D (const FrequentistSurface& s);
137 }
void CreateHistograms(const IFitVar *xvar, int nbinsx, double xmin, double xmax, const IFitVar *yvar, int nbinsy, double ymin, double ymax, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts)
virtual void FillSurface(const IExperiment *expt, osc::IOscCalculatorAdjustable *calc, const IFitVar *xvar, const IFitVar *yvar, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts)
TH2 * Gaussian90Percent1D(const FrequentistSurface &s)
Up-value surface for 90% confidence in 1D in gaussian approximation.
Cuts and Vars for the 2020 FD DiF Study.
Definition: CutFlow_header.h:5
std::map< std::string, double > xmax
MinuitFitter::FitOpts fFitOpts
TH2 * Gaussian68Percent2D(const FrequentistSurface &s)
Up-value surface for 68% confidence in 2D in gaussian approximation.
void SaveTo(TDirectory *dir) const
double FillSurfacePoint(const IExperiment *expt, osc::IOscCalculatorAdjustable *calc, const IFitVar *xvar, double x, const IFitVar *yvar, double y, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts)
TH2 * Gaussian2Sigma2D(const FrequentistSurface &s)
Up-value surface for 2 sigma confidence in 2D in gaussian approximation.
TH2 * Gaussian2Sigma1D(const FrequentistSurface &s)
Up-value surface for 2 sigma confidence in 1D in gaussian approximation.
std::string ProgressBarTitle(const IFitVar *xvar, const IFitVar *yvar, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts) const
std::vector< TH2 * > fProfHists
Double_t ymax
Definition: plot.C:25
Log-likelihood scan across two parameters.
const XML_Char * s
Definition: expat.h:262
TH2 * Gaussian95Percent2D(const FrequentistSurface &s)
Up-value surface for 95% confidence in 2D in gaussian approximation.
default if un-specified
Definition: MinuitFitter.h:23
expt
Definition: demo5.py:34
std::vector< TH2 * > GetProfiledHists()
Maps of the values taken on by the profiled parameters.
Surface with axes and .
Definition: NueSurface.h:13
TH2 * Gaussian3Sigma2D(const FrequentistSurface &s)
Up-value surface for 3 sigma confidence in 2D in gaussian approximation.
TH2 * Gaussian99Percent2D(const FrequentistSurface &s)
Up-value surface for 99% confidence in 2D in gaussian approximation.
TH2 * Gaussian3Sigma1D(const FrequentistSurface &s)
Up-value surface for 3 sigma confidence in 1D in gaussian approximation.
static std::unique_ptr< FrequentistSurface > LoadFrom(TDirectory *dir)
osc::OscCalculatorDumb calc
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Int_t nbinsx
Definition: plot.C:23
TDirectory * dir
Definition: macro.C:5
TH2 * Gaussian90Percent2D(const FrequentistSurface &s)
Up-value surface for 90% confidence in 2D in gaussian approximation.
Base class defining interface for experiments.
Definition: IExperiment.h:14
void FindMinimum(const IExperiment *expt, osc::IOscCalculatorAdjustable *calc, const IFitVar *xvar, const IFitVar *yvar, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts)
Interface definition for fittable variables.
Definition: IFitVar.h:16
Surface with axes and .
Definition: NumuSurface.h:12
Double_t ymin
Definition: plot.C:24
TH2 * Gaussian99Percent1D(const FrequentistSurface &s)
Up-value surface for 99% confidence in 1D in gaussian approximation.
TH2 * Gaussian95Percent1D(const FrequentistSurface &s)
Up-value surface for 95% confidence in 1D in gaussian approximation.
TH2 * Gaussian68Percent1D(const FrequentistSurface &s)
Up-value surface for 68% confidence in 1D in gaussian approximation.