make_mockdata_syst_contours.C
Go to the documentation of this file.
1 #include "OscLib/OscCalcDumb.h"
2 
4 #include "CAFAna/Fit/Fit.h"
7 
8 #include "CAFAna/Core/Spectrum.h"
11 #include "CAFAna/Core/IFitVar.h"
12 
13 #include "CAFAna/Vars/FitVars.h"
14 
20 
21 
23 
24 #include "Utilities/func/MathUtil.h"
25 
26 #include "TCanvas.h"
27 #include "TLine.h"
28 #include "TGraph.h"
29 #include "TH2.h"
30 #include "TH1.h"
31 #include "TFile.h"
32 #include "TLegend.h"
33 #include "TRandom3.h"
34 
35 #include <iostream>
36 #include <cmath>
37 
38 using namespace ana;
39 
40 double pot = 9.48e20;
41 
44  std::vector<const ISyst*> systs,
45  const std::vector<const IFitVar*> fitvars)
46 {
47  TRandom3 *rand = new TRandom3();
49  for (const ISyst* syst : systs)
50  seed.SetShift(syst,rand->Gaus());
51  kFitSinSqTheta23.SetValue(calc,0.4);
52  kFitDmSq32.SetValue(calc,2.7e-3);
53  kFitDeltaInPiUnits.SetValue(calc,1.5);
54 
55  return pred->PredictSyst(calc,seed).FakeData(9e20);
56 }
57 
58 
59 
60 void make_mockdata_syst_contours(std::string fname="out_mockdata_for_syst_contours.root")
61 {
62  std::string predFName = "/nova/ana/users/ecatanom/Ana2017/Predictions/v2/pred_nue_ana2017_full_v2.root";
63 
64  std::vector<const ISyst*> systs;
65  for (const ISyst *syst : kNue2017Systs) systs.push_back(syst);
66 
67 
68  const std::vector<const IFitVar*> fitvars = {
71  &kFitDmSq32,
73  };
74 
76  ENue2017ExtrapType extrap = kCombo;
77  PredictionSystNue2017 pred(extrap, calc, kNue2017Systs, predFName);
78  Spectrum fake = MakeFakeData(&pred,calc, systs, fitvars);
79  Spectrum mock = fake.MockData(pot);
80 
81 
82  // Save our fake / mock data histograms
83  // Also save all our surfaces and slice graphs
84  TFile *out = new TFile(fname.c_str(),"recreate");
85  fake.SaveTo(out, "fakedata"); // need to see this
86  mock.SaveTo(out, "mockdata"); // need to see this
87 
88  out->Close();
89 
90 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
Spectrum MakeFakeData(const IPrediction *pred, osc::IOscCalcAdjustable *calc, std::vector< const ISyst * > systs, const std::vector< const IFitVar * > fitvars)
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:18
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Definition: FitVars.cxx:177
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Forward to wrapped Var&#39;s SetValue()
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
const std::vector< const DummyNue2017Syst * > kNue2017Systs
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:33
Loads shifted spectra from files.
unsigned int seed
Definition: runWimpSim.h:102
Spectrum FakeData(double pot) const
Fake data is a MC spectrum scaled to the POT expected in the data.
Definition: Spectrum.cxx:402
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:72
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:578
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Spectrum MockData(double pot, int idx=0) const
Mock data is FakeData with Poisson fluctuations applied.
Definition: Spectrum.cxx:384
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
const FitSinSq2Theta13 kFitSinSq2Theta13
Definition: FitVars.cxx:13
void make_mockdata_syst_contours(std::string fname="out_mockdata_for_syst_contours.root")
mock
Definition: demo4.py:28
Float_t e
Definition: plot.C:35
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
void SetShift(const ISyst *syst, double shift, bool force=false)
Definition: SystShifts.cxx:78