Functions | Variables
make_nueFDprediction_kinematics.C File Reference
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/SALoaders.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Core/Cut.h"
#include "CAFAna/Core/HistAxis.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/SpectrumLoaderBase.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/NumuCuts.h"
#include "CAFAna/Cuts/NueCutsSecondAna.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/NueCuts2017.h"
#include "CAFAna/Decomp/ProportionalDecomp.h"
#include "CAFAna/Decomp/BENDecomp.h"
#include "CAFAna/Decomp/MichelDecomp.h"
#include "CAFAna/Decomp/NumuDecomp.h"
#include "CAFAna/Extrap/ModularExtrap.h"
#include "CAFAna/Prediction/PredictionExtrap.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "CAFAna/Systs/Systs.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/HistAxes.h"
#include "CAFAna/Vars/NueVars.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Vars/NueVarsExtra.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "OscLib/OscCalcDumb.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include <iostream>
#include <iomanip>

Go to the source code of this file.

Functions

void CheckFileOverwrite (TString)
 
void make_nueFDprediction_kinematics (const std::string &outfilename="FDprediction_kinematics.root", const bool hastau=false)
 

Variables

osc::OscCalcDumb calc
 

Function Documentation

void CheckFileOverwrite ( TString  outfilename)

Definition at line 184 of file make_nueFDprediction_kinematics.C.

References om::cout.

Referenced by make_nueFDprediction_kinematics().

184  {
185  if(!gSystem->AccessPathName(outfilename.Data())){
186  std::cout << "\n\nThis will overwrite " << outfilename
187  << "\n\nAre you sure you want to continue? y/n ";
188  string input = ""; getline(cin,input);
189  if (input!="y") abort();
190  }
191 }
string outfilename
knobs that need extra care
OStream cout
Definition: OStream.cxx:6
void make_nueFDprediction_kinematics ( const std::string &  outfilename = "FDprediction_kinematics.root",
const bool  hastau = false 
)

Definition at line 72 of file make_nueFDprediction_kinematics.C.

References ana::HistDef::axis, axisNue, axisNumu, CheckFileOverwrite(), ana::defs, file, ana::kBeam, ana::kCosTheta, cmf::kData, caf::kFARDET, kMC, caf::kNEARDET, ana::kNoShift, ana::kNue2017FDAllSamples, ana::kNue2017NDPresel, ana::kNueEnergy2017, ana::kNumSels, ana::kNumuNDCvn, ana::kNumVars, ana::kPPFXFluxCVWgt, ana::kPtP, ana::kStandardSpillCuts, cmf::kTauSwap, ana::kTrueQ2, ana::kTrueW, ana::kWOscDumb, ana::kXSecCVWgt2017, loaders, caf::Proxy< caf::StandardRecord >::mc, ana::HistDef::name, caf::Proxy< caf::SRTruthBranch >::nu, ana::ModularExtrap::Nue(), make_template_knob_config::outfilename, ana::PredictionExtrap::SaveTo(), ana::PredictionNoExtrap::SaveTo(), ana::selNames, ana::Binning::Simple(), and Munits::sr.

76 {
77  // ND loaders
78  std::string loaderNDData = "prod_decaf_R17-03-01-prod3reco.d_nd_numi_fhc_full_nue_or_numu_or_nus_contain_v1_goodruns";
79  std::string loaderNDMC = "prod_decaf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
80 
81  // FD loaders
82  std::string loaderFDnonswapMC = "prod_decaf_R17-03-01-prod3reco.l_fd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
83  std::string loaderFDfluxswapMC = "prod_decaf_R17-03-01-prod3reco.l_fd_genie_fluxswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
84  std::string loaderFDtauswapMC = "prod_decaf_R17-03-01-prod3reco.l_fd_genie_tau_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
85 
86  //******* 1. Set up selection and variables ********
87  //Only needed here. Keep updated!
88  const HistAxis axisNumu = kNumuNonQEAxisFirstAna;
89 
90  const Var kWOscDumb([](const caf::SRProxy* sr){return sr->mc.nu[0].woscdumb;});
91 
92  const int kNumSels = 1;
93  const int kNumVars = 5;
94 
95  const HistDef defs[kNumVars] = {
96  {"recoE", {"E_{reco} (GeV)", Binning::Simple(10, 0, 5), kNueEnergy2017}},
97  {"trueQ2", {"true Q^{2} (GeV^{2})", Binning::Simple(500, 0, 5), kTrueQ2}},
98  {"trueW2", {"true W^{2} (GeV^{2})", Binning::Simple(100, 0, 2), kTrueW}},
99  {"PtP", {"p_{t}/p", Binning::Simple(500,0,1), kPtP}},
100  {"CosTheta", {"CosTheta", Binning::Simple(500,0,1), kCosTheta}}
101  };
102 
103  const Cut selFD[kNumSels] = {
105  };
106  const Cut selND[kNumSels] = {
107  kNue2017NDPresel && kNueSecondAnaCVNeSsb
108  };
109  const std::string selNames[kNumSels] = {
110  "AllSamples"
111  };
112  const Cut cutNDNumu = {
113  kNumuNDCvn
114  };
115 
117 
118  //********** 2. Set up loaders *********************
119  SANueExtrapLoaders loaders;
120 
121  loaders.SetLoaderPath(loaderNDData, caf::kNEARDET, ana::Loaders::DataMC::kData);
122  loaders.SetLoaderPath(loaderNDMC, caf::kNEARDET, ana::Loaders::DataMC::kMC);
123 
124  loaders.SetLoaderPath(loaderFDnonswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam, ana::Loaders::SwappingConfig::kNonSwap);
125  loaders.SetLoaderPath(loaderFDfluxswapMC, caf::kFARDET, ana::Loaders::DataMC::kMC, DataSource::kBeam,ana::Loaders::SwappingConfig::kFluxSwap);
126  if(hastau)
128  else
130 
131  loaders.SetSpillCut(kStandardSpillCuts);
132 
133  //******* 3. Set up the extrapolations and go *******
134  SystShifts thisShift = kNoShift;
135 
136  NumuDecomp * numuDecomp;
137  ProportionalDecomp * propDecomp[kNumSels][kNumVars];
138  ModularExtrap extrapProp[kNumSels][kNumVars];
139  PredictionExtrap * predicProp[kNumSels][kNumVars];
140  PredictionNoExtrap * predicNoXP[kNumSels][kNumVars];
141 
142  numuDecomp = new NumuDecomp (loaders, axisNumu, cutNDNumu, thisShift, kNoShift, kXSecCVWgt2017*kPPFXFluxCVWgt);
143 
144  for(unsigned int selIdx = 0; selIdx < kNumSels; ++selIdx){
145  for(unsigned int varIdx = 0; varIdx < kNumVars; ++varIdx){
146 
147  const HistAxis& axisNue = defs[varIdx].axis;
148 
149  propDecomp[selIdx][varIdx] = new ProportionalDecomp (loaders,
150  axisNue, selND[selIdx],
151  thisShift, kNoShift, kXSecCVWgt2017*kPPFXFluxCVWgt );
152 
153  extrapProp[selIdx][varIdx] = ModularExtrap::Nue (loaders,
154  *propDecomp[selIdx][varIdx], *numuDecomp,
155  axisNue, axisNumu,
156  selFD[selIdx], selND[selIdx], cutNDNumu,
157  thisShift, kXSecCVWgt2017*kPPFXFluxCVWgt);
158 
159  predicProp[selIdx][varIdx] = new PredictionExtrap (&extrapProp[selIdx][varIdx]);
160 
161  predicNoXP[selIdx][varIdx] = new PredictionNoExtrap (loaders,
162  axisNue,
163  selFD[selIdx], thisShift, kXSecCVWgt2017*kPPFXFluxCVWgt);
164 
165  }//vars
166  }//sels
167  loaders.Go();
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  predicProp[selIdx][varIdx]->SaveTo(dFDshi->mkdir("nue_pred_"+selNames[selIdx]+"_"+varName) );
176  predicNoXP[selIdx][varIdx]->SaveTo(dFDshi->mkdir("nue_pred_noextrap_"+selNames[selIdx]+"_"+varName) );
177  }
178  }
179  file->Close();
180 
181 } // end
Near Detector underground.
Definition: SREnums.h:10
const int kNumVars
Definition: vars.h:14
Far Detector at Ash River.
Definition: SREnums.h:11
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
const HistAxis axisNumu
Proxy for caf::StandardRecord.
Definition: SRProxy.h:1969
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:569
std::string name
Definition: NuePlotLists.h:12
const Color_t kMC
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 Var kNueEnergy2017([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;return NueRecoE_2017FDFit(kCVNemE(sr), kCVNhadE(sr));})
Definition: NueEnergy2017.h:11
const Cut kNumuNDCvn
Definition: NumuCuts.h:61
const Var kCosTheta
void CheckFileOverwrite(TString)
const HistDef defs[kNumVars]
Definition: vars.h:15
const int kNumSels
Definition: vars.h:43
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
HistAxis axis
Definition: NuePlotLists.h:13
const SystShifts kNoShift
Definition: SystShifts.h:112
const HistAxis axisNue
Definition: syst_header.h:377
const Cut kNue2017NDPresel
Definition: NueCuts2017.h:285
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:1981
const Var kWOscDumb([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return 0.f;return float(sr->mc.nu[0].woscdumb);})
Definition: TruthVars.h:10
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Splits Data proportionally according to MC.
std::vector< Loaders * > loaders
Definition: syst_header.h:385
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.
Take the output of an extrapolation and oscillate it as required.
const std::string selNames[kNumSels]
Definition: vars.h:46
const Var kXSecCVWgt2017
Definition: XsecTunes.h:37
Extrapolate each component using a separate ModularExtrapComponent.
Definition: ModularExtrap.h:21
const Var kTrueW
Definition: TruthVars.h:22
static constexpr Double_t sr
Definition: Munits.h:164
const Cut kNue2017FDAllSamples
Our FD selection including all samples, for making predictions, etc.
Definition: NueCuts2017.h:155

Variable Documentation

osc::OscCalcDumb calc

Definition at line 70 of file make_nueFDprediction_kinematics.C.