CovMxSurface.h
Go to the documentation of this file.
1 //
2 // CovMxSurface by J. Hewes (U. Cincinnati), March 2019
3 //
4 
5 #include <map>
6 #include <vector>
7 
8 #include "CAFAna/Core/Binning.h"
9 
10 class TCanvas;
11 class TDirectory;
12 class TGraph;
13 class TH2D;
14 
15 namespace osc
16 {
17  class OscCalcSterile;
18 }
19 
20 namespace ana {
21  class IExperiment;
22  class IFitVar;
23  class ISyst;
24 
25  class CovMxSurface {
26 
27  public:
28 
30  osc::OscCalcSterile* calc, const IFitVar* xvar,
31  const IFitVar* yvar, std::vector<const IFitVar*> fit_vars,
32  std::map<const IFitVar*, std::vector<double> > fit_seeds,
33  std::vector<const ISyst*> prof_systs, SystShifts syst_seeds,
34  bool save_spectra=false, const ISyst* pull_syst=nullptr,
35  std::vector<IPrediction*> preds={}, std::vector<Spectrum*> data={},
36  std::vector<Spectrum*> cosmic={}, size_t patch=999, size_t n_patches=999);
37 
38  ~CovMxSurface();
39 
40  TH2D* GetSurface() { return fSurface; }
41 
42  std::vector<std::vector<TGraph*> > GetContours(std::vector<double> up);
43  static TCanvas* DrawContours(std::vector<CovMxSurface*> surfs,
44  std::vector<double> up, std::vector<std::string> names = {});
45 
46  std::map<std::string, TCanvas*> GetSpectra() { return fSurfacePoints; };
47 
48  void SaveTo(TDirectory* dir) const;
49  static std::unique_ptr<CovMxSurface> LoadFrom(TDirectory* dir);
50 
51  private:
52 
53  CovMxSurface(TH2D* surface, std::vector<TH2D*> fit_vars,
54  std::vector<TH2D*> syst_pulls, TH2D* fit_time,
55  std::map<std::string, TCanvas*> spectra);
56 
57  void DrawSurfacePoint(std::vector<IPrediction*> preds,
58  std::vector<std::tuple<std::string, SystShifts,
59  osc::IOscCalcAdjustable*> > calcs,
60  std::vector<Spectrum*> data, std::vector<Spectrum*> cosmic,
61  size_t x, size_t y);
62 
63  // std::vector<TH1D*> SplitFakeData(TH1D* h, std::vector<Binning> b);
64 
65  TH2D* fSurface; /// Surface histogram
66 
67  std::vector<TH2D*> fFitVarSurface; /// Fit variable best fit points
68  std::vector<TH2D*> fSystPullSurface; /// Systematic pulls
69 
70  TH2D* fFitTime; /// Surface tracking fit time for each surface point
71 
72  std::map<std::string, TCanvas*> fSurfacePoints; /// Map of histograms showing spectra at each fit point
73 
74  }; // class CovMxSurface
75 
76 } // namespace ana
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void SaveTo(const osc::IOscCalc &x, TDirectory *dir, const std::string &name)
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
Adapt the PMNS_Sterile calculator to standard interface.
std::vector< TH2D * > fSystPullSurface
Fit variable best fit points.
Definition: CovMxSurface.h:68
void DrawSurfacePoint(PredictionConcat *sim, std::vector< std::pair< std::string, osc::IOscCalcAdjustable * >> calcs, TH1D *cosmic_merged, TH1D *data_merged, std::vector< double > pot, std::vector< bool > is_nd, TDirectory *dir, std::string name)
osc::OscCalcDumb calc
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
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
expt
Definition: demo5.py:34
Sum up livetimes from individual cosmic triggers.
std::map< std::string, TCanvas * > GetSpectra()
Definition: CovMxSurface.h:46
const int xbins
Definition: MakePlots.C:82
Oscillation probability calculators.
Definition: Calcs.h:5
const int ybins
TDirectory * dir
Definition: macro.C:5
std::vector< TH2D * > fFitVarSurface
Surface histogram.
Definition: CovMxSurface.h:67
TH2D * GetSurface()
Definition: CovMxSurface.h:40
Base class defining interface for experiments.
Definition: IExperiment.h:14
std::map< std::string, TCanvas * > fSurfacePoints
Surface tracking fit time for each surface point.
Definition: CovMxSurface.h:72
Interface definition for fittable variables.
Definition: IFitVar.h:16
def save_spectra(fname, spectra, groups)
Definition: core.py:116
TH2D * fFitTime
Systematic pulls.
Definition: CovMxSurface.h:70
ContourCollection GetContours(CLType clt, int universeNum=-1)
Definition: Utilities.h:469
enum BeamMode string