make_prediction.C
Go to the documentation of this file.
1 #ifdef __CINT__
2 void make_prediction()
3 {
4  std::cout << "Sorry, you must run in compiled mode" << std::endl;
5 }
6 #else
7 
9 #include "CAFAna/Core/Loaders.h"
10 #include "CAFAna/Cuts/NueCutsSecondAna.h"
11 #include "CAFAna/Cuts/NumuCuts.h"
12 #include "CAFAna/Cuts/SpillCuts.h"
17 #include "CAFAna/Systs/Systs.h"
18 #include "CAFAna/Systs/NumuSysts.h"
21 #include "CAFAna/Vars/HistAxes.h"
22 #include "OscLib/IOscCalc.h"
23 #include "TFile.h"
24 
25 using namespace ana;
26 
27 
29 {
30 
31  TString fileName = "pred_tutorial_nue_numu.root";
32 
33  ////////////////////////////////////////////////////////////
34  // Set up loaders
35  ////////////////////////////////////////////////////////////
37 
38  std::string ldrFDNonSwap = "prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_nonswap_fhc_nova_v08_period5_nue_or_numu_or_nus_contain_v1";
39  std::string ldrFDFlxSwap = "prod_sumdecaf_R17-03-01-prod3reco.k_fd_genie_fluxswap_fhc_nova_v08_period5_nue_or_numu_or_nus_contain_v1";
40 
41 // ldrFDNonSwap = ldrFDNonSwap + " with limit 1";
42 // ldrFDFlxSwap = ldrFDFlxSwap + " with limit 1";
43 
46 
48 
49  ////////////////////////////////////////////////////////////
50  // Set up variables, cuts, etc
51  ////////////////////////////////////////////////////////////
52 
53  // Note: Redundancies here for readability and future-proofing.
54  // You can use the kXXX directly in constructors
55 
57  const HistAxis numuAxis = kNumuCCAxis;
58  const HistAxis nueAxis = kNueAxisSecondAnaCVN;
59  const Cut numuCutFD = kNumuFD;
60  const Cut nueCutFD = kNueSAFDCVNSsb;
61 
62  //These are silly
63  MECq0ShapeSyst2017 kMECq0ShapeSyst2017;
64  std::vector< const ISyst * > numuSysts = {&kMECq0ShapeSyst2017, &kNumuNCScaleSyst, &kBeamAll};
65  std::vector< const ISyst * > nueSysts = {&kMECq0ShapeSyst2017, &kBeamAllTransport, &kNA49};
66 
67  ////////////////////////////////////////////////////////////
68  //Set up the predictions
69  ////////////////////////////////////////////////////////////
70 
71  PredictionNoExtrap numuPred (loaders, numuAxis, numuCutFD, kNoShift, weight);
72  PredictionNoExtrap nuePred (loaders, nueAxis, nueCutFD, kNoShift, weight);
73 
74  NoExtrapGenerator numuGenerator (numuAxis, numuCutFD, weight);
75  NoExtrapGenerator nueGenerator (nueAxis, nueCutFD, weight);
76 
77  auto calc = DefaultOscCalc();
78  PredictionInterp numuPredSysts (numuSysts,calc->Copy(),
79  numuGenerator,loaders);
80  PredictionInterp nuePredSysts (nueSysts,calc->Copy(),
81  nueGenerator,loaders);
82 
83  ////////////////////////////////////////////////////////////
84  // Go! And save everything
85  ////////////////////////////////////////////////////////////
86 
87  loaders.Go();
88 
89  TFile * file = new TFile (fileName,"recreate");
90 
91  numuPred.SaveTo(file->mkdir("prediction_numu"));
92  nuePred.SaveTo(file->mkdir("prediction_nue"));
93  numuPredSysts.SaveTo(file->mkdir("prediction_systs_numu"));
94  nuePredSysts.SaveTo(file->mkdir("prediction_systs_nue"));
95 
96 }
97 #endif
const NumuNCScaleSyst kNumuNCScaleSyst
Definition: NumuSysts.cxx:26
Implements systematic errors by interpolation between shifted templates.
fileName
Definition: plotROC.py:78
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Var weight
void make_prediction()
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
const Cut kNumuFD
Definition: NumuCuts.h:53
osc::OscCalcDumb calc
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Definition: Calcs.cxx:49
Generates FD-only predictions (no extrapolation)
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Definition: HistAxes.h:8
virtual IOscCalc * Copy() const
Definition: OscCalcDumb.h:19
const BeamSyst kBeamAllTransport((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"totErr","beamTransportComb","Combined Beam Transport Systematics")
All Beam Transport systematics combined in quadratures.
Definition: BeamSysts.h:125
static const BeamSyst & kBeamAll
Definition: BeamSysts.h:127
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
const SystShifts kNoShift
Definition: SystShifts.h:115
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const NOvARwgtSyst kMECq0ShapeSyst2017("MECq0Shape","MEC q_{0} shape", novarwgt::kMECq0ShapeSyst2017)
Definition: MECSysts.h:41
std::vector< Loaders * > loaders
Definition: syst_header.h:386
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:46
Prediction that just uses FD MC, with no extrapolation.
const Var kXSecCVWgt2017
Definition: XsecTunes.h:37
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25