5 #include "CAFAna/Analysis/SALoaders.h" 9 #include "CAFAna/Core/Binning.h" 10 #include "CAFAna/Core/Cut.h" 11 #include "CAFAna/Core/HistAxis.h" 21 #include "CAFAna/Cuts/NueCutsSecondAna.h" 73 std::string loaderNDData =
"prod_caf_R17-09-05-prod4recopreview.f_nd_numi_rhc_full_v1_addShortSimpleCVN_goodruns";
74 std::string loaderNDMC =
"prod_caf_R17-11-14-prod4reco.e_nd_genie_nonswap_rhc_nova_v08_full_v1";
77 std::string loaderFDnonswapMC =
"prod_caf_R17-11-14-prod4reco.e_fd_genie_nonswap_rhc_nova_v08_full_v1";
78 std::string loaderFDfluxswapMC =
"prod_caf_R17-11-14-prod4reco.e_fd_genie_fluxswap_rhc_nova_v08_full_v1";
79 std::string loaderFDtauswapMC =
"prod_caf_R17-11-14-prod4reco.e_fd_genie_tau_rhc_nova_v08_full_v1";
110 const Cut cutNDNumu = {
115 TFile *weight_file =
new TFile(wfile.c_str(),
"READ");
119 gDirectory->GetObject((
"trueQ2_weight_"+sample).c_str(),h);
122 int nbins = h->GetNbinsX();
125 bins[
i-1] = h->GetBinContent(
i);
126 binslow[
i-1] = h->GetBinLowEdge(
i);
127 binshigh[
i-1] = h->GetBinLowEdge(
i) + h->GetBinWidth(
i);
130 const Var kTrueQ2Weight([nbins, &binslow, &binshigh, &bins](
const caf::SRProxy *
sr)
133 if((
kRecoQ2(sr) > binslow[
i]) && (
kRecoQ2(sr) < binshigh[i])){
return bins[
i];}
141 gDirectory->GetObject((
"PtP_weight_"+sample).c_str(),hptp);
144 int nbins_ptp = hptp->GetNbinsX();
145 double bins_ptp[nbins_ptp], binslow_ptp[nbins_ptp], binshigh_ptp[nbins_ptp];
146 for(
int i = 1;
i <= nbins_ptp; ++
i){
147 bins_ptp[
i-1] = hptp->GetBinContent(
i);
148 binslow_ptp[
i-1] = hptp->GetBinLowEdge(
i);
149 binshigh_ptp[
i-1] = hptp->GetBinLowEdge(
i) + hptp->GetBinWidth(
i);
152 const Var kPtPWeight([nbins_ptp, &binslow_ptp, &binshigh_ptp, &bins_ptp](
const caf::SRProxy *sr)
154 for(
int i = 0;
i < nbins_ptp; ++
i){
155 if((
kPtP(sr) > binslow_ptp[
i]) && (
kPtP(sr) < binshigh_ptp[i])){
return bins_ptp[
i];}
163 gDirectory->GetObject((
"CosNumi_weight_"+sample).c_str(),hcos);
166 int nbins_cos = hptp->GetNbinsX();
167 double bins_cos[nbins_cos], binslow_cos[nbins_cos], binshigh_cos[nbins_cos];
168 for(
int i = 1;
i <= nbins_cos; ++
i){
169 bins_cos[
i-1] = hcos->GetBinContent(
i);
170 binslow_cos[
i-1] = hcos->GetBinLowEdge(
i);
171 binshigh_cos[
i-1] = hcos->GetBinLowEdge(
i) + hcos->GetBinWidth(
i);
174 const Var kCosWeight([nbins_cos, &binslow_cos, &binshigh_cos, &bins_cos](
const caf::SRProxy *sr)
176 for(
int i = 0;
i < nbins_cos; ++
i){
177 if((
kCosNumi(sr) > binslow_cos[
i]) && (
kCosNumi(sr) < binshigh_cos[i])){
return bins_cos[
i];}
184 weight_file->Close();
226 for(
unsigned int selIdx = 0; selIdx <
kNumSels; ++selIdx){
227 for(
unsigned int varIdx = 0; varIdx <
kNumVars; ++varIdx){
231 axisNue, selND[selIdx],
235 extrapProp_trueQ2[selIdx][varIdx] =
NueRHCExtrap (loaders,
236 *propDecomp[selIdx][varIdx], *numuDecomp_trueQ2,
238 selFD[selIdx], selND[selIdx], cutNDNumu,
242 extrapProp_PtP[selIdx][varIdx] =
new NueRHCExtrap (loaders,
243 *propDecomp[selIdx][varIdx], *numuDecomp_PtP,
245 selFD[selIdx], selND[selIdx], cutNDNumu,
248 extrapProp_Cos[selIdx][varIdx] =
new NueRHCExtrap (loaders,
249 *propDecomp[selIdx][varIdx], *numuDecomp_Cos,
251 selFD[selIdx], selND[selIdx], cutNDNumu,
255 predicProp_trueQ2[selIdx][varIdx] =
new PredictionExtrap (extrapProp_trueQ2[selIdx][varIdx]);
256 predicProp_PtP[selIdx][varIdx] =
new PredictionExtrap (extrapProp_PtP[selIdx][varIdx]);
257 predicProp_Cos[selIdx][varIdx] =
new PredictionExtrap (extrapProp_Cos[selIdx][varIdx]);
272 for(
unsigned int selIdx = 0; selIdx <
kNumSels; ++selIdx){
273 for(
unsigned int varIdx = 0; varIdx <
kNumVars; ++varIdx){
282 for(
unsigned int selIdx = 0; selIdx <
kNumSels; ++selIdx){
283 TDirectory* dFDshi = file->mkdir((selNames[selIdx]+
"_"+sample).c_str());
284 for(
unsigned int varIdx = 0; varIdx <
kNumVars; ++varIdx){
285 TString varName = defs[varIdx].
name.c_str();
286 predicExte_trueQ2[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_trueQ2_"+selNames[selIdx]+
"_"+varName) ;
287 predicExte_PtP[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_PtP_"+selNames[selIdx]+
"_"+varName) ;
288 predicExte_Cos[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_Cos_"+selNames[selIdx]+
"_"+varName) ;
289 predicProp_trueQ2[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_noextend_trueQ2_"+selNames[selIdx]+
"_"+varName) ;
290 predicProp_PtP[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_noextend_PtP_"+selNames[selIdx]+
"_"+varName) ;
291 predicProp_Cos[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_noextend_Cos_"+selNames[selIdx]+
"_"+varName) ;
292 predicNoXP[selIdx][varIdx]->
SaveTo(dFDshi,
"nue_pred_noextrap_"+selNames[selIdx]+
"_"+varName) ;
301 if(!gSystem->AccessPathName(outfilename.Data())){
302 std::cout <<
"\n\nThis will overwrite " << outfilename
303 <<
"\n\nAre you sure you want to continue? y/n ";
304 string input =
""; getline(cin,input);
305 if (input!=
"y") abort();
Near Detector underground.
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_mu_sqrd=util::sqr(0.1056);double E_mu=kMuE(sr);double p_mu=sqrt(util::sqr(E_mu)-M_mu_sqrd);return 2 *kCCE(sr)*(E_mu-p_mu *kCosNumi(sr))-M_mu_sqrd;})
Reconstructed four-momentum transfer invariant (Q^2)
Far Detector at Ash River.
Cuts and Vars for the 2020 FD DiF Study.
Simple record of shifts applied to systematic parameters.
Proxy for caf::StandardRecord.
const Cut kNue2018CVNCut([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2018RHCCVNCut(sr);else return kNue2018FHCCVNCut(sr);})
const Cut kNue2018NDPresel
string outfilename
knobs that need extra care
const Var kPtP
Transverse momentum fraction in slice.
Uses MC for NC and CC components, assigns remainder of data to CC.
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
Simple oscillation probability calculator that has no solar term or mass hierarchy or delta so it's s...
const HistDef defs[kNumVars]
const Binning kNue2018Binning
const SystShifts kNoShift
Splits Data proportionally according to MC.
const Cut kNue2018FDAllSamples
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
const std::string selNames[kNumSels]
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={})
const HistAxis kNue2018Axis("NuE Energy / Analysis Bin", kNue2018Binning, kNue2018AnaBin)
Use this Axis for Ana2018, official Axis.
const Var kCosNumi([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999){if(sr->hdr.det==1){return sr->trk.kalman.tracks[0].dir.Dot(beamDirND);}if(sr->hdr.det==2){return sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);}}return-5.f;})
void CheckFileOverwrite(TString)
void make_nueFDprediction_kinematics_RHC_REW(const std::string sample, const std::string wfile, const std::string &outfilename="FDprediction_kinematics_REW.root")