make_nueFDprediction_kinematics_FHC.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
35 
36 // Predict
40 
41 // Systs
42 #include "CAFAna/Systs/Systs.h"
43 
44 // Vars
48 #include "CAFAna/Vars/Vars.h"
51 
52 #include "OscLib/OscCalcDumb.h"
53 
55 
56 
57 #include <iostream>
58 #include <iomanip>
59 
60 using namespace ana;
61 
62 void CheckFileOverwrite(TString);
63 
65 
66 void make_nueFDprediction_kinematics_FHC( const std::string& outfilename = "FDprediction_kinematics_FHC.root")
67 
68 {
69  // ND loaders
70  std::string loaderNDData = "prod_caf_R17-09-05-prod4recopreview.f_nd_numi_fhc_full_v1_addShortSimpleCVN_goodruns";
71  std::string loaderNDMC = "prod_caf_R17-11-14-prod4reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1";
72 
73  // FD loaders
74  std::string loaderFDnonswapMC = "prod_caf_R17-11-14-prod4reco.d_fd_genie_nonswap_fhc_nova_v08_full_v1";
75  std::string loaderFDfluxswapMC = "prod_caf_R17-11-14-prod4reco.d_fd_genie_fluxswap_fhc_nova_v08_full_v1";
76  std::string loaderFDtauswapMC = "prod_caf_R17-11-14-prod4reco.d_fd_genie_tau_fhc_nova_v08_full_v1";
77 
78  //******* 1. Set up selection and variables ********
79  //Only needed here. Keep updated!
81 
82  const int kNumSels = 3;
83  const int kNumVars = 5;
84 
85  const HistDef defs[kNumVars] = {
86  {"cvn2d", kNue2018Axis},
87  {"trueQ2", {"true Q^{2} (GeV^{2})", Binning::Simple(500, 0, 5), kTrueQ2}},
88  {"trueW2", {"true W^{2} (GeV^{2})", Binning::Simple(100, 0, 2), kTrueW}},
89  {"PtP", {"p_{t}/p", Binning::Simple(500,0,1), kPtP}},
90  {"CosTheta", {"CosTheta", Binning::Simple(500,0,1), kCosTheta}}
91  };
92 
93  const Cut selFD[kNumSels] = {
94  kNue2018FD,
97  };
98  const Cut selND[kNumSels] = {
101  kNue2018NDPresel && kNue2018CVNCut
102  };
103  const std::string selNames[kNumSels] = {
104  "CORE",
105  "PERI",
106  "ALL"
107  };
108  const Cut cutNDNumu = {
110  };
111 
113 
114  //********** 2. Set up loaders *********************
115  SANueExtrapLoaders loaders;
116 
117  loaders.SetLoaderPath(loaderNDData, caf::kNEARDET, ana::Loaders::DataMC::kData);
118  loaders.SetLoaderPath(loaderNDMC, caf::kNEARDET, ana::Loaders::DataMC::kMC);
119 
120  loaders.SetLoaderPath(loaderFDnonswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam, ana::Loaders::SwappingConfig::kNonSwap);
121  loaders.SetLoaderPath(loaderFDfluxswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam,ana::Loaders::SwappingConfig::kFluxSwap);
123 
124  loaders.SetSpillCut(kStandardSpillCuts);
125 
126  //******* 3. Set up the extrapolations and go *******
127  SystShifts thisShift = kNoShift;
128 
129  NumuDecomp * numuDecomp;
130  ProportionalDecomp * propDecomp[kNumSels][kNumVars];
131  ModularExtrap * extrapProp[kNumSels][kNumVars];
132  PredictionExtrap * predicProp[kNumSels][kNumVars];
133  PredictionNoExtrap * predicNoXP[kNumSels][kNumVars];
135 
136  numuDecomp = new NumuDecomp (loaders, axisNumu, cutNDNumu, thisShift, kNoShift, kXSecCVWgt2018*kPPFXFluxCVWgt);
137 
138  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
139  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
140 
141  const HistAxis& axisNue = defs[varIdx].axis;
142 
143  propDecomp[selIdx][varIdx] = new ProportionalDecomp (loaders,
144  axisNue, selND[selIdx],
145  thisShift, kNoShift, kXSecCVWgt2018*kPPFXFluxCVWgt );
146 
147  extrapProp[selIdx][varIdx] = new NueExtrap(NueExtrap (loaders,
148  *propDecomp[selIdx][varIdx], *numuDecomp,
149  axisNue, axisNumu,
150  selFD[selIdx], selND[selIdx], cutNDNumu,
151  thisShift, kXSecCVWgt2018*kPPFXFluxCVWgt));
152 
153  predicProp[selIdx][varIdx] = new PredictionExtrap (extrapProp[selIdx][varIdx]);
154 
155  predicNoXP[selIdx][varIdx] = new PredictionNoExtrap (loaders,
156  axisNue,
157  selFD[selIdx], thisShift, kXSecCVWgt2018*kPPFXFluxCVWgt);
158 
159  }//vars
160  }//sels
161  loaders.Go();
162 
163  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
164  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
165  predicExte[selIdx][varIdx] = new PredictionExtendToPeripheral (predicProp[selIdx][varIdx], predicNoXP[selIdx][varIdx], kNue2018Binning, false);
166  }
167  }
168 
169  //********** 4. Save everything ********************
170  TFile * file = new TFile(outfilename.c_str(),"RECREATE");
171  TDirectory * dFDshi = file->mkdir("prediction");
172  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
173  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
174  TString varName = defs[varIdx].name.c_str();
175  predicExte[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_"+selNames[selIdx]+"_"+varName) ;
176  predicProp[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_noextend_"+selNames[selIdx]+"_"+varName) ;
177  predicNoXP[selIdx][varIdx]->SaveTo(dFDshi, "nue_pred_noextrap_"+selNames[selIdx]+"_"+varName) ;
178  }
179  }
180  file->Close();
181 
182 } // end
183 
184 //****************************************
186  if(!gSystem->AccessPathName(outfilename.Data())){
187  std::cout << "\n\nThis will overwrite " << outfilename
188  << "\n\nAre you sure you want to continue? y/n ";
189  string input = ""; getline(cin,input);
190  if (input!="y") abort();
191  }
192 }
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
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
void CheckFileOverwrite(TString)
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
void make_nueFDprediction_kinematics_FHC(const std::string &outfilename="FDprediction_kinematics_FHC.root")
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
void NueExtrap(string beam="fhc", string cvntype="oldpresel")
Definition: NueExtrap.C:28
osc::OscCalcDumb calc
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Splits Data proportionally according to MC.
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
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