MakeNus17Prediction.C
Go to the documentation of this file.
3 #include "CAFAna/Core/Loaders.h"
6 #include "NuXAna/Cuts/NusCuts.h"
11 #include "CAFAna/Extrap/ExtrapSterile.h"
18 #include "CAFAna/Vars/HistAxes.h"
21 
22 #include "OscLib/OscCalcSterile.h"
24 
25 #include <utility>
26 
27 using namespace ana;
28 
30 {
31  TH1::AddDirectory(0);
32 
33  const Var kReweight = kXSecCVWgt2017*kPPFXFluxCVWgt;
34 
35  // Set up some calculators:
36  // Set up oscillation calculator that uses default 3 flavor parameters
38 
39 
40  // ND DATA + MC
41  SpectrumLoader loaderNDMC(fNDmcDECAF);
42  SpectrumLoader loaderNDdata(fNDdataDECAF);
43  loaderNDMC.SetSpillCut(kStandardSpillCuts);
44  loaderNDdata.SetSpillCut(kStandardSpillCuts);
45 
46  SpectrumLoader* loaderFDMC_non = new SpectrumLoader(fFDmcDECAF);
47  SpectrumLoader* loaderFDMC_swp = new SpectrumLoader(fFDswapDECAF);
48  SpectrumLoader* loaderFDMC_tau = new SpectrumLoader(fFDtauDECAF);
49  loaderFDMC_non->SetSpillCut(kStandardSpillCuts);
50  loaderFDMC_swp->SetSpillCut(kStandardSpillCuts);
51  loaderFDMC_tau->SetSpillCut(kStandardSpillCuts);
52 
53  // FD DATA COSMICS
55  loaderFDCOS.SetSpillCut(kStandardSpillCuts);
56 
57  const Binning kNCDisappearanceEnergyBinningExt1 = Binning::Simple(100, 0, 10);
58  const Binning kNCDisappearanceEnergyBinningExt2 = Binning::Simple(40, 0, 4);
59 
60  const HistAxis kNCNDAxisExtended1("Visible Energy (GeV)",
61  kNCDisappearanceEnergyBinningExt1, kNus17Energy);
62  const HistAxis kNCFDAxisExtended1("Visible Energy (GeV)",
63  kNCDisappearanceEnergyBinningExt1, kNus17Energy);
64  const HistAxis kNCBinsNumuCCAxisExt1("Reconstructed Neutrino Energy (GeV)",
65  kNCDisappearanceEnergyBinningExt1, kCCE );
66 
67  const HistAxis kNCNDAxisExtended2("Visible Energy (GeV)",
68  kNCDisappearanceEnergyBinningExt2, kNus17Energy);
69  const HistAxis kNCFDAxisExtended2("Visible Energy (GeV)",
70  kNCDisappearanceEnergyBinningExt2, kNus17Energy);
71  const HistAxis kNCBinsNumuCCAxisExt2("Reconstructed Neutrino Energy (GeV)",
72  kNCDisappearanceEnergyBinningExt2, kCCE );
73 
74 
75 
76  // Set up NC decompositon for ND spectra plots
77  ProportionalDecomp decompNC1(
78  loaderNDMC, loaderNDdata, kNCNDAxisExtended1, kNus17ND,
79  kNoShift, kNoShift, kReweight
80  ); // NC Decomp
81 
82  // Set up ND decompositon for Numu
83  ProportionalDecomp decompNumu1(
84  loaderNDMC, loaderNDdata, kNCBinsNumuCCAxisExt1, kNumuND,
85  kNoShift, kNoShift, kReweight
86  ); // NC Decomp
87 
89  loaderNDMC, *loaderFDMC_swp, *loaderFDMC_non, *loaderFDMC_tau,
90  decompNC1, decompNumu1,
91  kNCFDAxisExtended1, kNCBinsNumuCCAxisExt1,
93  kNoShift, kReweight
94  );
95 
96  // Test what 0.5 GeV to 4 GeV looks (for energy scaled)
97  const Cut kECut_scale = kNus17Energy > 0.31884 && kNus17Energy < 2.5509;
98 
99  ProportionalDecomp decompNC2(
100  loaderNDMC, loaderNDdata, kNCNDAxisExtended2, kNus17ND && kECut_scale,
101  kNoShift, kNoShift, kReweight
102  ); // NC Decomp
103 
104  // Set up ND decompositon for Numu
105  ProportionalDecomp decompNumu2(
106  loaderNDMC, loaderNDdata, kNCBinsNumuCCAxisExt2, kNumuND && kECut_scale,
107  kNoShift, kNoShift, kReweight
108  ); // NC Decomp
109 
111  loaderNDMC, *loaderFDMC_swp, *loaderFDMC_non, *loaderFDMC_tau,
112  decompNC2, decompNumu2,
113  kNCFDAxisExtended2, kNCBinsNumuCCAxisExt2,
114  kNus17FDAlt && kECut_scale, kNus17ND && kECut_scale, kNumuND && kECut_scale,
115  kNoShift, kReweight
116  );
117 
118  // Set up the prediction object
119  PredictionSterile* pred1 = new PredictionSterile(&extrap1);
120  PredictionSterile* pred2 = new PredictionSterile(&extrap2);
121 
122  // Set up the cosmic spectrum
123  Spectrum sCosmic1(loaderFDCOS, kNCFDAxisExtended1, kInCosmicTimingWindow && kNus17FDAlt && kECut);
124  Spectrum sCosmic2(loaderFDCOS, kNCFDAxisExtended2, kInCosmicTimingWindow && kNus17FDAlt && kECut_scale);
125 
126  // Fill the spectra!
127  loaderNDMC.Go();
128  loaderNDdata.Go();
129  loaderFDMC_non->Go();
130  loaderFDMC_swp->Go();
131  loaderFDMC_tau->Go();
132  loaderFDCOS.Go();
133 
134  // Set up output filename
135  TFile* rootF = new TFile(outfile.c_str(), "RECREATE");
136 
137  TDirectory* tmp = gDirectory;
138  TDirectory* saveDir = gDirectory;
139 
140  // Save all of the objects
141  saveDir = rootF->mkdir("decompNC1");
142  decompNC1.SaveTo(saveDir);
143  saveDir = rootF->mkdir("decompNumu1");
144  decompNumu1.SaveTo(saveDir);
145  saveDir = rootF->mkdir("extrap1");
146  extrap1.SaveTo(saveDir);
147  saveDir = rootF->mkdir("prediction1");
148  pred1->SaveTo(saveDir);
149  saveDir = rootF->mkdir("sCos1");
150  sCosmic1.SaveTo(saveDir);
151 
152 
153  saveDir = rootF->mkdir("decompNC2");
154  decompNC2.SaveTo(saveDir);
155  saveDir = rootF->mkdir("decompNumu2");
156  decompNumu2.SaveTo(saveDir);
157  saveDir = rootF->mkdir("extrap2");
158  extrap2.SaveTo(saveDir);
159  saveDir = rootF->mkdir("prediction2");
160  pred2->SaveTo(saveDir);
161  saveDir = rootF->mkdir("sCos2");
162  sCosmic2.SaveTo(saveDir);
163 
164  tmp->cd();
165  rootF->Close(); // Close the file
166 }
const std::string fNDdataDECAF
Definition: NusLoadProd3.h:63
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 MakeNus17Prediction(std::string outfile)
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const std::string fFDtauDECAF
Definition: NusLoadProd3.h:47
Adapt the PMNS_Sterile calculator to standard interface.
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Float_t tmp
Definition: plot.C:36
void SetSpillCut(const SpillCut &cut)
const std::string fNDmcDECAF
Definition: NusLoadProd3.h:66
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Var kNus17Energy([](const caf::SRProxy *sr){double cale=sr->slc.calE;double recoE=0.;if(sr->hdr.det==caf::kFARDET) recoE=FDscaleCalE17 *cale;if(sr->hdr.det==caf::kNEARDET) recoE=NDscaleCalE17 *cale;return recoE;})
Definition: NusVars.h:62
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
Definition: Calcs.cxx:97
const Cut kNumuND
Definition: NumuCuts.h:55
const Var kCCE
Definition: NumuVars.h:21
const Cut kNus17ND
Full Nus17 ND analysis selection.
Definition: NusCuts17.h:120
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:517
const std::string fFDcosmicdataDECAF
Definition: NusLoadProd3.h:52
const SystShifts kNoShift
Definition: SystShifts.cxx:21
void SaveTo(TDirectory *dir, const std::string &name) const override
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const std::string fFDmcDECAF
Definition: NusLoadProd3.h:43
Splits Data proportionally according to MC.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Cut kNus17FDAlt
Definition: NusCuts17.h:92
A prediction object compatible with sterile oscillations.
void SaveTo(TDirectory *dir, const std::string &name) const override
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
const Var kXSecCVWgt2017
Definition: XsecTunes.h:37
static ModularExtrapSterile NCDisappearance(Loaders &loaders, const IDecomp &NCSurvDecomp, const IDecomp &NumuOscDecomp, const HistAxis &axis, const HistAxis &axisNumuND, const Cut &fdcut, const Cut &NCNDcut, const Cut &NumuNDcut, const SystShifts &shiftMC=kNoShift, const Var &weight=kUnweighted)
Creates a NC disappearance extrapolation.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:114
const std::string fFDswapDECAF
Definition: NusLoadProd3.h:45
FILE * outfile
Definition: dump_event.C:13