make_nueFDprediction_kinematics_RHC.C
Go to the documentation of this file.
1 
2 // Analysis
5 #include "CAFAna/Analysis/SALoaders.h"
7 
8 // Core
9 #include "CAFAna/Core/Binning.h"
10 #include "CAFAna/Core/Cut.h"
11 #include "CAFAna/Core/HistAxis.h"
13 #include "CAFAna/Core/Spectrum.h"
16 
17 // Cuts
18 #include "CAFAna/Cuts/Cuts.h"
22 #include "CAFAna/Cuts/NueCutsSecondAna.h"
23 #include "CAFAna/Cuts/SpillCuts.h"
26 
27 // Decomp
32 
33 // Extrap
36 
37 // Predict
41 
42 // Systs
43 #include "CAFAna/Systs/Systs.h"
44 
45 // Vars
49 #include "CAFAna/Vars/Vars.h"
52 
53 #include "OscLib/OscCalcDumb.h"
54 
56 
57 
58 #include <iostream>
59 #include <iomanip>
60 
61 using namespace ana;
62 
63 void CheckFileOverwrite(TString);
64 
66 
67 void make_nueFDprediction_kinematics_RHC( const std::string& outfilename = "FDprediction_kinematics_RHC.root")
68 
69 {
70  // ND loaders
71  std::string loaderNDData = "prod_caf_R17-09-05-prod4recopreview.f_nd_numi_rhc_full_v1_addShortSimpleCVN_goodruns";
72  std::string loaderNDMC = "prod_caf_R17-11-14-prod4reco.e_nd_genie_nonswap_rhc_nova_v08_full_v1";
73 
74  // FD loaders
75  std::string loaderFDnonswapMC = "prod_caf_R17-11-14-prod4reco.e_fd_genie_nonswap_rhc_nova_v08_full_v1";
76  std::string loaderFDfluxswapMC = "prod_caf_R17-11-14-prod4reco.e_fd_genie_fluxswap_rhc_nova_v08_full_v1";
77  std::string loaderFDtauswapMC = "prod_caf_R17-11-14-prod4reco.e_fd_genie_tau_rhc_nova_v08_full_v1";
78 
79  //******* 1. Set up selection and variables ********
80  //Only needed here. Keep updated!
82 
83  const int kNumSels = 3;
84  const int kNumVars = 5;
85 
86  const HistDef defs[kNumVars] = {
87  {"cvn2d", kNue2018Axis},
88  {"trueQ2", {"true Q^{2} (GeV^{2})", Binning::Simple(500, 0, 5), kTrueQ2}},
89  {"trueW2", {"true W^{2} (GeV^{2})", Binning::Simple(100, 0, 2), kTrueW}},
90  {"PtP", {"p_{t}/p", Binning::Simple(500,0,1), kPtP}},
91  {"CosTheta", {"CosTheta", Binning::Simple(500,0,1), kCosTheta}}
92  };
93 
94  const Cut selFD[kNumSels] = {
95  kNue2018FD,
98  };
99  const Cut selND[kNumSels] = {
102  kNue2018NDPresel && kNue2018CVNCut
103  };
104  const std::string selNames[kNumSels] = {
105  "CORE",
106  "PERI",
107  "ALL"
108  };
109  const Cut cutNDNumu = {
111  };
112 
114 
115  //********** 2. Set up loaders *********************
116  SANueExtrapLoaders loaders;
117 
118  loaders.SetLoaderPath(loaderNDData, caf::kNEARDET, ana::Loaders::DataMC::kData);
119  loaders.SetLoaderPath(loaderNDMC, caf::kNEARDET, ana::Loaders::DataMC::kMC);
120 
121  loaders.SetLoaderPath(loaderFDnonswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam, ana::Loaders::SwappingConfig::kNonSwap);
122  loaders.SetLoaderPath(loaderFDfluxswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam,ana::Loaders::SwappingConfig::kFluxSwap);
124 
125  loaders.SetSpillCut(kStandardSpillCuts);
126 
127  //******* 3. Set up the extrapolations and go *******
128  SystShifts thisShift = kNoShift;
129 
130  NumuDecomp * numuDecomp;
131  ProportionalDecomp * propDecomp[kNumSels][kNumVars];
132  ModularExtrap * extrapProp[kNumSels][kNumVars];
133  PredictionExtrap * predicProp[kNumSels][kNumVars];
134  PredictionNoExtrap * predicNoXP[kNumSels][kNumVars];
136 
137  numuDecomp = new NumuDecomp (loaders, axisNumu, cutNDNumu, thisShift, kNoShift, kXSecCVWgt2018*kPPFXFluxCVWgt);
138 
139  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
140  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
141 
142  const HistAxis& axisNue = defs[varIdx].axis;
143 
144  propDecomp[selIdx][varIdx] = new ProportionalDecomp (loaders,
145  axisNue, selND[selIdx],
146  thisShift, kNoShift, kXSecCVWgt2018*kPPFXFluxCVWgt );
147 
148  extrapProp[selIdx][varIdx] = new NueRHCExtrap (loaders,
149  *propDecomp[selIdx][varIdx], *numuDecomp,
150  axisNue, axisNumu,
151  selFD[selIdx], selND[selIdx], cutNDNumu,
152  thisShift, kXSecCVWgt2018*kPPFXFluxCVWgt);
153 
154  predicProp[selIdx][varIdx] = new PredictionExtrap (extrapProp[selIdx][varIdx]);
155 
156  predicNoXP[selIdx][varIdx] = new PredictionNoExtrap (loaders,
157  axisNue,
158  selFD[selIdx], thisShift, kXSecCVWgt2018*kPPFXFluxCVWgt);
159 
160  }//vars
161  }//sels
162  loaders.Go();
163 
164  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
165  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
166  predicExte[selIdx][varIdx] = new PredictionExtendToPeripheral (predicProp[selIdx][varIdx], predicNoXP[selIdx][varIdx], kNue2018Binning, false);
167  }
168  }
169 
170  //********** 4. Save everything ********************
171  TFile * file = new TFile(outfilename.c_str(),"RECREATE");
172  TDirectory * dFDshi = file->mkdir("prediction");
173  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
174  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
175  TString varName = defs[varIdx].name.c_str();
176  predicExte[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_"+selNames[selIdx]+"_"+varName) ;
177  predicProp[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_noextend_"+selNames[selIdx]+"_"+varName) ;
178  predicNoXP[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_noextrap_"+selNames[selIdx]+"_"+varName) ;
179  }
180  }
181  file->Close();
182 
183 } // end
184 
185 //****************************************
187  if(!gSystem->AccessPathName(outfilename.Data())){
188  std::cout << "\n\nThis will overwrite " << outfilename
189  << "\n\nAre you sure you want to continue? y/n ";
190  string input = ""; getline(cin,input);
191  if (input!="y") abort();
192  }
193 }
Near Detector underground.
Definition: SREnums.h:10
const int kNumVars
Definition: vars.h:14
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
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
const Cut kNumuCutND2018
Definition: NumuCuts2018.h:41
const Color_t kMC
std::string name
Definition: NuePlotLists.h:12
const Cut kNue2018CVNCut([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2018RHCCVNCut(sr);else return kNue2018FHCCVNCut(sr);})
Definition: NueCuts2018.h:49
void make_nueFDprediction_kinematics_RHC(const std::string &outfilename="FDprediction_kinematics_RHC.root")
const Cut kNue2018NDPresel
Definition: NueCuts2018.h:145
const Var kTrueQ2
Definition: TruthVars.h:27
string outfilename
knobs that need extra care
const Var kPtP
Transverse momentum fraction in slice.
Definition: NueVars.cxx:90
Uses MC for NC and CC components, assigns remainder of data to CC.
Definition: NumuDecomp.h:10
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Definition: HistAxes.h:8
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it&#39;s s...
Definition: OscCalcDumb.h:16
const HistDef defs[kNumVars]
Definition: vars.h:15
const Binning kNue2018Binning
Definition: NueCuts2018.cxx:93
const Cut kNue2018FD
Use this cut for the full FD Core selection, apply for both RHC and FHC.
Definition: NueCuts2018.h:54
const int kNumSels
Definition: vars.h:43
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
const Cut kNue2018FDPeripheral(kNue2018FDPeripheralFunc)
HistAxis axis
Definition: NuePlotLists.h:13
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
const HistAxis axisNue
Definition: syst_header.h:378
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Creates a nue-like extrapolation for RHC mode.
Definition: NueRHCExtrap.h:16
Splits Data proportionally according to MC.
osc::OscCalcDumb calc
const Var kXSecCVWgt2018
Definition: XsecTunes.h:48
std::vector< Loaders * > loaders
Definition: syst_header.h:386
const Cut kNue2018FDAllSamples
Definition: NueCuts2018.h:77
TFile * file
Definition: cellShifts.C:17
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
void CheckFileOverwrite(TString)
Prediction that just uses FD MC, with no extrapolation.
const HistAxis axisNumu
Take the output of an extrapolation and oscillate it as required.
const Var kCosTheta
const std::string selNames[kNumSels]
Definition: vars.h:46
Extrapolate each component using a separate ModularExtrapComponent.
Definition: ModularExtrap.h:23
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Var kTrueW
Definition: TruthVars.h:22
const HistAxis kNue2018Axis("NuE Energy / Analysis Bin", kNue2018Binning, kNue2018AnaBin)
Use this Axis for Ana2018, official Axis.
enum BeamMode string