SystsCalibAbsMethod17.C
Go to the documentation of this file.
4 #include "CAFAna/Cuts/Cuts.h"
5 #include "NuXAna/Cuts/NusCuts.h"
10 #include "CAFAna/Extrap/ExtrapSterile.h"
13 #include "CAFAna/Systs/Systs.h"
18 #include "NuXAna/Vars/HistAxes.h"
19 
20 using namespace ana;
21 
23 {
24  TH1::AddDirectory(0);
25 
26 
27  const Var kWgtP3 = kXSecCVWgt2017*kPPFXFluxCVWgt;
28 
29 
30  const std::string fnamenear_conc="prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1";
31  const std::string fnameneardata_conc="prod_caf_R17-03-01-prod3reco.d_nd_numi_fhc_full_v1_goodruns";
32  const std::string fnamefar_con="prod_caf_R17-03-01-prod3reco.l_fd_genie_nonswap_fhc_nova_v08_full_v1";
33  const std::string fnameswap_con="prod_caf_R17-03-01-prod3reco.l_fd_genie_fluxswap_fhc_nova_v08_full_v1";
34  const std::string fnametau_conc="prod_caf_R17-03-01-prod3reco.l_fd_genie_tau_fhc_nova_v08_full_v1";
35 
36 
37  SpectrumLoader floadnear(fnamenear_conc);
38  SpectrumLoader floadfar(fnamefar_con);
39  SpectrumLoader floadswap(fnameswap_con);
40  SpectrumLoader floadtau(fnametau_conc);
41  SpectrumLoader floadneardata(fnameneardata_conc);
42 
43  floadnear .SetSpillCut(kStandardSpillCuts);
45  floadswap .SetSpillCut(kStandardSpillCuts);
47  floadneardata.SetSpillCut(kStandardSpillCuts);
48 
49  std::string fnear_ns="defname: prod_caf_R17-03-01-prod3reco.l_nd_genie_nonswap_fhc_nova_v08_full_no-shift_v1";
50  std::string ffar_ns="defname: prod_caf_R17-03-01-prod3reco.l_fd_genie_nonswap_fhc_nova_v08_full_lightmodel-noshift_v2";
51  std::string fswap_ns="defname: prod_caf_R17-03-01-prod3reco.l_fd_genie_fluxswap_fhc_nova_v08_full_lightmodel-noshift_v2";
52  std::string ftau_ns="defname: prod_caf_R17-03-01-prod3reco.l_fd_genie_tau_fhc_nova_v08_full_lightmodel-noshift_v2";
53 
54 
55  std::map<std::string, std::vector<std::string> > shiftlabels;
56  shiftlabels["Noshift"] =std::vector<std::string>();
57 
58 
59  shiftlabels["Noshift"].push_back(fnear_ns);
60  shiftlabels["Noshift"].push_back(ffar_ns);
61  shiftlabels["Noshift"].push_back(fswap_ns);
62  shiftlabels["Noshift"].push_back(ftau_ns);
63 
64 
65  // A map of systematic objects, indexed by the same label as above
66  std::map<std::string, std::vector<SpectrumLoader*> > systematics;
67 
68  for(const auto& shiftlabel : shiftlabels) {
69  systematics[shiftlabel.first] = std::vector<SpectrumLoader*>();
70  for(const auto& samdef : shiftlabel.second){
71  systematics[shiftlabel.first].push_back(new SpectrumLoader(samdef));
72  systematics[shiftlabel.first].back()->SetSpillCut(kStandardSpillCuts);
73  }
74  }
75 
76  // Define a map of samples and cuts/axes to set them up
77  // Each sample, essentially, is a way to set up the analysis
78  std::string labelRecoE = "Energy Deposited in Scintillator (GeV)";
79  std::map<std::string, std::pair<HistAxis*, std::pair<Cut*, Cut*> > > cut_samples;
80  std::pair<Cut*, Cut*> Ana01(new Cut(kNus17ND), new Cut(kNus17FDAlt));
81  cut_samples["Ana01"] = std::pair<HistAxis*, std::pair<Cut*, Cut*> >(
82  new HistAxis(labelRecoE, kNCDisappearanceEnergyBinning, kNusNDEnergy17),
83  Ana01
84  );
85 
86  // Set up maps to the decompositions/predictions (each flavor component)
87  // Nominal maps are indexed purely by sample label
88  // Shifted maps are indexed by sample label, systematic label, then sigma of the shift
89  std::map<std::string, IDecomp*> decomps_nominal;
90  std::map<std::string, std::map<std::string, std::map<int, IDecomp*> > > decomps_shifted;
91  std::map<std::string, PredictionNoExtrap*> predsNE_nominal;
92  std::map<std::string, std::map<std::string, std::map<int, PredictionNoExtrap*> > > predsNE_shifted;
93  std::map<std::string, PredictionSterile*> predsSt_nominal;
94  std::map<std::string, std::map<std::string, std::map<int, PredictionSterile*> > > predsSt_shifted;
95 
96  //std::cout << "Hey I am here "<<std::cout;
97 
98  // Set up the actual decompositions/predictions
99  // sample.first = the sample label
100  // shiftlabel.first = the systematic shift label
101  // sample.second.first = the sample HistAxis
102  // sample.second.second = the sample Cut
103  for(const auto& sample : cut_samples) {
104  decomps_nominal[sample.first] = new ProportionalDecomp(
105  floadnear, floadneardata,
106  *sample.second.first, *sample.second.second.first,
107  kNoShift, kNoShift, kWgtP3
108  );
109 
110  predsNE_nominal[sample.first] = new PredictionNoExtrap(
111  floadfar, floadswap, floadtau,
112  labelRecoE, kNCDisappearanceEnergyBinning,kNusNDEnergy17,*sample.second.second.second,
113  kNoShift, kWgtP3
114  );
115 
116 
117 
118  ProportionalDecomp* decompnc_n = new ProportionalDecomp(
119  floadnear, floadneardata,
120  *sample.second.first, *sample.second.second.first,
121  kNoShift, kNoShift, kWgtP3
122  );
123  ProportionalDecomp* decompnumu_n = new ProportionalDecomp(
124  floadnear, floadneardata,
126  kNoShift, kNoShift, kWgtP3
127  );
129  floadnear, floadswap, floadfar, floadtau, *decompnc_n, *decompnumu_n,
130  *sample.second.first, kNCBinsNumuCCAxis,
131  *sample.second.second.second, *sample.second.second.first, kNumuND,
132  kNoShift, kWgtP3
133  ));
134  predsSt_nominal[sample.first] = new PredictionSterile(extrap_n);
135 
136  for(const auto& systlabel : systematics) {
137  int ndpos = 0;
138  int fdpos = 1;
139  int fspos = 2;
140  int ftpos=3;
141  decomps_shifted[sample.first][systlabel.first][1] = new ProportionalDecomp(
142  *systlabel.second[ndpos],floadneardata,
143  *sample.second.first, *sample.second.second.first,
144  kNoShift, kNoShift, kWgtP3
145  );
146  predsNE_shifted[sample.first][systlabel.first][1] = new PredictionNoExtrap(
147  *systlabel.second[fdpos], *systlabel.second[fspos], *systlabel.second[ftpos],
148  labelRecoE, kNCDisappearanceEnergyBinning ,
149  kNusNDEnergy17, *sample.second.second.second,
150  kNoShift, kWgtP3
151  );
152 
153  ProportionalDecomp* decompnc_s = new ProportionalDecomp(
154  *systlabel.second[ndpos], floadneardata,
155  *sample.second.first, *sample.second.second.first,
156  kNoShift, kNoShift, kWgtP3
157  );
158  ProportionalDecomp* decompnumu_s = new ProportionalDecomp(
159  *systlabel.second[ndpos], floadneardata,
161  kNoShift, kNoShift, kWgtP3
162  );
164  *systlabel.second[ndpos], *systlabel.second[fspos], *systlabel.second[fdpos],
165  *systlabel.second[ftpos], *decompnc_s, *decompnumu_s,
166  *sample.second.first, kNCBinsNumuCCAxis,
167  *sample.second.second.second, *sample.second.second.first, kNumuND,
168  kNoShift, kWgtP3
169  ));
170  predsSt_shifted[sample.first][systlabel.first][1] = new PredictionSterile(
171  extrap_s
172  );
173  }
174  }
175 
176  for(const auto& systlabel : systematics) {
177  for(const auto& loader : systlabel.second) {
178  loader->Go();
179  }
180  }
181  floadnear.Go();
182  floadfar .Go();
183  floadswap.Go();
184  floadtau .Go();
185  floadneardata.Go();
186 
187  std::string folder = "./";
188  std::string filenm = "SystsCalibAbs_norm_noshift";
189 
190  std::string fullLocation = folder + filenm + ".root";
191  TFile* rootF = new TFile(fullLocation.c_str(), "RECREATE");
192 
193  SaveMaps(rootF,
194  decomps_nominal, decomps_shifted,
195  predsNE_nominal, predsNE_shifted,
196  predsSt_nominal, predsSt_shifted
197  );
198 }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
void SaveMaps(TDirectory *out, std::map< std::string, IDecomp * > decomps_nominal, std::map< std::string, std::map< std::string, std::map< int, IDecomp * > > > decomps_shifted, std::map< std::string, PredictionNoExtrap * > predsNE_nominal, std::map< std::string, std::map< std::string, std::map< int, PredictionNoExtrap * > > > predsNE_shifted, std::map< std::string, PredictionSterile * > predsSt_nominal, std::map< std::string, std::map< std::string, std::map< int, PredictionSterile * > > > predsSt_shifted)
Save all of the objects in the input maps to the out directory/file.
Definition: PPFXHelper.h:1077
void SetSpillCut(const SpillCut &cut)
void SystsCalibAbsMethod17()
const Cut kNumuND
Definition: NumuCuts.h:55
const Cut kNus17ND
Full Nus17 ND analysis selection.
Definition: NusCuts17.h:120
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
virtual void Go() override
Load all the registered spectra.
loader
Definition: demo0.py:10
const SystShifts kNoShift
Definition: SystShifts.cxx:22
const HistAxis kNCBinsNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNCDisappearanceEnergyBinning, kCCE)
Definition: HistAxes.h:9
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.
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Prediction that just uses FD MC, with no extrapolation.
const Var kXSecCVWgt2017
Definition: XsecTunes.h:36
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.
const Binning kNCDisappearanceEnergyBinning
Energy binnings used in Ana01 for nus extrapolation.
Definition: Binning.cxx:68
enum BeamMode string