make_mockdata_syst_contours.C
Go to the documentation of this file.
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->mkdir("fakedata")); // need to see this
86  mock.SaveTo(out->mkdir("mockdata")); // need to see this
87 
88  out->Close();
89 
90 }
void SetValue(osc::IOscCalculatorAdjustable *osc, double val) const override
Definition: FitVars.cxx:85
osc::OscCalculatorDumb calc
Oscillation analysis framework, runs over CAF files outside of ART.
osc::IOscCalculatorAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
std::vector< SystGroupDef > systs
Definition: syst_header.h:384
const FitDmSq32 kFitDmSq32
Definition: FitVars.cxx:16
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
Spectrum MakeFakeData(const IPrediction *pred, osc::IOscCalculatorAdjustable *calc, std::vector< const ISyst * > systs, const std::vector< const IFitVar * > fitvars)
void SetValue(osc::IOscCalculatorAdjustable *osc, double val) const override
Definition: FitVars.cxx:67
void SetValue(osc::IOscCalculatorAdjustable *osc, double val) const override
Definition: FitVars.cxx:115
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:37
virtual Spectrum PredictSyst(osc::IOscCalculator *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:98
Loads shifted spectra from files.
General interface to any calculator that lets you set the parameters.
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:819
::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:787
const FitSinSqTheta23 kFitSinSqTheta23
Definition: FitVars.cxx:15
string syst
Definition: plotSysts.py:176
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 FitDeltaInPiUnits kFitDeltaInPiUnits
Definition: FitVars.cxx:14
void SetShift(const ISyst *syst, double shift, bool force=false)
Definition: SystShifts.cxx:70
void SaveTo(TDirectory *dir) const
Definition: Spectrum.cxx:1029