51 ldrData =
"prod_caf_R17-09-05-prod4recopreview.f_nd_numi_rhc_full_v1_addShortSimpleCVN_goodruns";
52 ldrMC =
"prod_caf_R17-11-14-prod4reco.e_nd_genie_nonswap_rhc_nova_v08_full_v1";
55 ldrData =
"prod_caf_R17-09-05-prod4recopreview.f_nd_numi_fhc_full_v1_addShortSimpleCVN_goodruns";
56 ldrMC =
"prod_caf_R17-11-14-prod4reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1";
59 std::vector <HistDef>
defs;
66 AddNueHistDefForCvn(defs);
77 std::vector <CutDef>
sels = {
86 std::string decompFName =
"nue2018_decomp_ratios_rhc_prop.root";
89 decompFName =
"nue2018_decomp_ratios_fhc.root";
90 decompShortName =
"combo";
94 "/data/decomp/" + decompFName,
105 std::vector < std::vector<Spectrum*> > spects;
106 std::vector < std::vector<IPrediction*> > preds_mc;
107 std::vector < std::vector<IPrediction*> > preds_mc_decomp;
109 for(
int selIdx = 0; selIdx<(
int)sels.size(); ++selIdx){
110 std::vector<Spectrum *> temp_spec;
111 std::vector<IPrediction *> temp_pred_mc;
112 std::vector<IPrediction *> temp_pred_mc_decomp;
114 for(
int varIdx = 0; varIdx < (
int)defs.size(); ++varIdx){
122 axis.
GetVars()[0], sels[selIdx].cut,
126 spects.push_back(temp_spec);
127 preds_mc.push_back(temp_pred_mc);
128 preds_mc_decomp.push_back(temp_pred_mc_decomp);
134 TFile*
fout =
new TFile(predFileName.c_str(),
"RECREATE");
135 for(
int selIdx = 0; selIdx < (
int)sels.size(); ++selIdx){
136 const char* cut = sels[selIdx].name.c_str();
138 for(
int varIdx = 0; varIdx < (
int)defs.size(); ++varIdx){
139 const char*
name = defs[varIdx].name.c_str();
141 spects[selIdx][varIdx]->SaveTo(fout,
TString::Format(
"spect_%s_%s", name, cut));
142 preds_mc[selIdx][varIdx]->SaveTo(fout,
TString::Format(
"pred_mc_%s_%s", name, cut));
143 preds_mc_decomp[selIdx][varIdx]->SaveTo(fout,
TString::Format(
"pred_mc_decomp_%s_%s", name, cut));
157 TFile * predFile =
new TFile (predFileName.c_str(),
"READ");
158 TString validFileName1 (predFileName); validFileName1.ReplaceAll(
".root",
"_mc_validation.root");
159 TString validFileName3 (predFileName); validFileName3.ReplaceAll(
".root",
"_data_validation.root");
160 TString validFileName2 (predFileName); validFileName2.ReplaceAll(
".root",
"_mc_decomp_validation.root");
162 TFile * validFile1 =
new TFile(validFileName1,
"RECREATE");
163 TFile * validFile3 =
new TFile(validFileName3,
"RECREATE");
164 TFile * validFile2 =
new TFile(validFileName2,
"RECREATE");
173 for(
int selIdx = 0; selIdx <
kNumSels; ++selIdx){
174 const char* cut = sels[selIdx].name.c_str();
175 for(
int varIdx = 0; varIdx <
kNumVars; ++varIdx){
176 const char* name = defs[varIdx].name.c_str();
189 spec->SaveTo(validFile3,
TString::Format(
"%s{group=Cut,cat=%s}", name,cut));
191 pred_mc->ComponentCC(12,12). Unoscillated().SaveTo(validFile1,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=0_nue}", name,cut));
192 pred_mc->ComponentCC(14,14). Unoscillated().SaveTo(validFile1,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=1_numu}", name,cut));
193 pred_mc->ComponentCC(-12,-12).Unoscillated().SaveTo(validFile1,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=3_antinue}", name,cut));
194 pred_mc->ComponentCC(-14,-14).Unoscillated().SaveTo(validFile1,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=4_antinumu}", name,cut));
195 pred_mc->ComponentNCTotal().
SaveTo(validFile1,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=2_nc}", name,cut));
198 pred_mc_decomp->ComponentCC(12,12). Unoscillated().SaveTo(validFile2,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=0_nue}", name,cut));
199 pred_mc_decomp->ComponentCC(14,14). Unoscillated().SaveTo(validFile2,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=1_numu}", name,cut));
200 pred_mc_decomp->ComponentCC(-12,-12).Unoscillated().SaveTo(validFile2,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=3_antinue}", name,cut));
201 pred_mc_decomp->ComponentCC(-14,-14).Unoscillated().SaveTo(validFile2,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=4_antinumu}", name,cut));
202 pred_mc_decomp->ComponentNCTotal().
SaveTo(validFile2,
TString::Format(
"%s{group=Cut,cat=%s}{group=Component,cat=2_nc}", name,cut));
206 std::cout <<
"Formatted outputs saved to " << validFileName1 <<
", " << validFileName2 <<
" and " << validFileName3 <<
std::endl;
void SaveTo(const osc::IOscCalc &x, TDirectory *dir, const std::string &name)
const std::vector< T > & GetVars() const
void AddNueHistDefBasic(std::vector< HistDef > &hd)
const Cut kNue2018NDCVNSsb
std::vector< double > Spectrum
void SetSpillCut(const SpillCut &cut)
std::string FindCAFAnaDir()
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
const Cut kNue2018NDPresel
void AddNueHistDefShowerND(std::vector< ana::HistDef > &hd)
void AddNueHistDefSelectionExtras(std::vector< HistDef > &hd)
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
Struct to hold cut information.
const Var kCVNSSe([](const caf::SRProxy *sr){return sr->sel.cvnProd3Train.nueid;})
const HistDef defs[kNumVars]
void AddNueHistDefProngCVN(std::vector< HistDef > &hd)
const SystShifts kNoShift
void AddNueHistDefShower(std::vector< HistDef > &hd)
const std::vector< Binning > & GetBinnings() const
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kNue2018AnaBin([](const caf::SRProxy *sr){int selBin=kNue2018SelectionBin(sr);float nuE=kNueEnergy2017(sr);int nuEBin=nuE/0.5;assert(nuEBin<=8 &&"An event with nuE > 4.5 should never happen");int anaBin=9 *selBin+nuEBin;if(anaBin > 36) anaBin=-1;return anaBin;})
assert(nhit_max >=nhit_nbins)
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
void AddNueHistDefVertexND(std::vector< HistDef > &hd)
void AddNueHistDefPIDs(std::vector< HistDef > &hd)
static NullLoader kNullLoader
Dummy loader that doesn't load any files.
const std::vector< std::string > & GetLabels() const