5 #include "CAFAna/Core/HistAxis.h" 7 #include "CAFAna/Core/Binning.h" 8 #include "CAFAna/Core/Cut.h" 44 std::vector<std::string>
ret;
48 pch = strtok (cstr,
",");
54 pch = strtok (NULL,
",");
65 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1," 66 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.l_nd_genie_nonswap_fhc_nova_v08_full_lightmodel-lightdown-calibup_v1," 67 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.l_nd_genie_nonswap_fhc_nova_v08_full_lightmodel-lightup-calibdown_v1," 68 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.l_nd_genie_nonswap_fhc_nova_v08_full_ckv-proton-shift-down_v1," 69 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.h_nd_genie_nonswap_fhc_nova_v08_periods1235_calib-shift-nd-xyview-neg-offset_v1," 70 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.h_nd_genie_nonswap_fhc_nova_v08_periods1235_calib-shift-nd-xyview-pos-offset_v1," 71 "dataset_def_name_newest_snapshot prod_caf_R17-03-01-prod3reco.j_nd_genie_nonswap_fhc_nova_v08_full_calib-shift-nd-func_v1";
73 const int dataIdx = 0;
74 const int nominalIdx = 1;
79 std::vector<std::string> dataset_labels = {
"nominal",
"lightdown",
"lightup",
"ckv",
"calibneg",
"calibpos",
"calibshape"};
80 std::vector<ana::SpectrumLoaderBase*>
loaders;
85 for(
auto &
id: datasets)
93 std::vector<std::vector<ana::Spectrum*> > spec_totmc;
96 std::vector<std::vector<ana::Spectrum*> > spec_Nsig_fid_only;
99 std::vector<std::vector<ana::Spectrum*> > spec_NSel_Cuts;
102 std::vector<std::vector<ana::Spectrum*> > spec_Nbkg_Cuts;
110 std::vector<std::vector<ana::Spectrum*> > spec_totmc_flux;
113 std::vector<std::vector<ana::Spectrum*> > spec_Nsig_fid_only_flux;
116 std::vector<std::vector<ana::Spectrum*> > spec_NSel_Cuts_flux;
119 std::vector<std::vector<ana::Spectrum*> > spec_Nbkg_Cuts_flux;
127 std::vector<std::vector<ana::Spectrum*> > spec_totmc_xsec;
130 std::vector<std::vector<ana::Spectrum*> > spec_Nsig_fid_only_xsec;
133 std::vector<std::vector<ana::Spectrum*> > spec_NSel_Cuts_xsec;
136 std::vector<std::vector<ana::Spectrum*> > spec_Nbkg_Cuts_xsec;
141 for(
unsigned int idataset = 0; idataset < datasets.size(); ++idataset)
146 loaders.push_back(loader);
161 std::vector<std::string> taxes_labels = {
"BDTG Output"};
163 GenieMultiverseParameters verse(100,
"/nova/app/users/rbowles/tag_releaseS18-04-23/CAFAna/XSec/Utilities/knob_config.txt");
164 std::vector<std::map<const ISyst*, double> > genie_shifts = verse.
ShiftTables();
167 for(
unsigned int iload = 0; iload < loaders.size(); ++iload)
174 std::vector<ana::Spectrum*> vspec_totmc;
177 std::vector<ana::Spectrum*> vspec_Nsig_fid_only;
180 std::vector<ana::Spectrum*> vspec_NSel_Cuts;
183 std::vector<ana::Spectrum*> vspec_Nbkg_Cuts;
186 for(
int ivar = 0; ivar < nvar; ivar++)
207 std::vector<ana::Spectrum*> vspec_totmc_flux;
210 std::vector<ana::Spectrum*> vspec_Nsig_fid_only_flux;
213 std::vector<ana::Spectrum*> vspec_NSel_Cuts_flux;
216 std::vector<ana::Spectrum*> vspec_Nbkg_Cuts_flux;
222 std::vector<ana::Spectrum*> vspec_totmc_xsec;
225 std::vector<ana::Spectrum*> vspec_Nsig_fid_only_xsec;
228 std::vector<ana::Spectrum*> vspec_NSel_Cuts_xsec;
231 std::vector<ana::Spectrum*> vspec_Nbkg_Cuts_xsec;
234 for(
int iuniv = 0; iuniv < 100; iuniv++)
246 vspec_totmc_xsec.push_back(
new Spectrum(*loaders[iload],taxes[ivar],
Preselection,genie_shifts[iuniv],weight));
252 vspec_Nbkg_Cuts_xsec.push_back(
new Spectrum(*loaders[iload],taxes[ivar],
Preselection &&
Bkg,genie_shifts[iuniv],weight));
254 spec_totmc_xsec.push_back(vspec_totmc_xsec);
255 spec_Nsig_fid_only_xsec.push_back(vspec_Nsig_fid_only_xsec);
256 spec_NSel_Cuts_xsec.push_back(vspec_NSel_Cuts_xsec);
257 spec_Nbkg_Cuts_xsec.push_back(vspec_Nbkg_Cuts_xsec);
259 spec_totmc_flux.push_back(vspec_totmc_flux);
260 spec_Nsig_fid_only_flux.push_back(vspec_Nsig_fid_only_flux);
261 spec_NSel_Cuts_flux.push_back(vspec_NSel_Cuts_flux);
262 spec_Nbkg_Cuts_flux.push_back(vspec_Nbkg_Cuts_flux);
265 spec_totmc.push_back(vspec_totmc);
266 spec_Nsig_fid_only.push_back(vspec_Nsig_fid_only);
267 spec_NSel_Cuts.push_back(vspec_NSel_Cuts);
268 spec_Nbkg_Cuts.push_back(vspec_Nbkg_Cuts);
272 for(
unsigned int iload = 0; iload < loaders.size(); ++iload)
274 loaders[iload]->Go();
278 for(
unsigned int iload = 0; iload < loaders.size(); ++iload)
280 TDirectory*
d =
fout.mkdir(dataset_labels[iload].c_str());
283 for(
int ivar = 0; ivar < nvar; ++ivar)
285 std::cout<<
"loader "<<dataset_labels[iload]<<
" var "<<taxes_labels[ivar]<<
"\n";
286 spec_totmc[iload][ivar]->SaveTo(d->mkdir( (
"totmc_"+taxes_labels[ivar]).c_str()));
287 spec_Nsig_fid_only[iload][ivar]->SaveTo(d->mkdir( (
"Nsig_fid_only_"+taxes_labels[ivar]).c_str()));
288 spec_NSel_Cuts[iload][ivar]->SaveTo(d->mkdir( (
"NSel_Cuts_"+taxes_labels[ivar]).c_str()));
289 spec_Nbkg_Cuts[iload][ivar]->SaveTo(d->mkdir( (
"Nbkg_Cuts_"+taxes_labels[ivar]).c_str()));
293 TDirectory* dftmc =
fout.mkdir((
"flux_totmc_"+taxes_labels[ivar]).c_str());
294 TDirectory* dft =
fout.mkdir((
"flux_Nsig_fid_only_"+taxes_labels[ivar]).c_str());
295 TDirectory* dfp =
fout.mkdir((
"flux_NSel_Cuts_"+taxes_labels[ivar]).c_str());
296 TDirectory* dfb =
fout.mkdir((
"flux_Nbkg_Cuts_"+taxes_labels[ivar]).c_str());
298 TDirectory* dxtmc =
fout.mkdir((
"xsec_totmc_"+taxes_labels[ivar]).c_str());
299 TDirectory* dxt =
fout.mkdir((
"xsec_Nsig_fid_only_"+taxes_labels[ivar]).c_str());
300 TDirectory* dxp =
fout.mkdir((
"xsec_NSel_Cuts_"+taxes_labels[ivar]).c_str());
301 TDirectory* dxb =
fout.mkdir((
"xsec_Nbkg_Cuts_"+taxes_labels[ivar]).c_str());
303 for(
int iuniv = 0; iuniv < 100; iuniv++)
305 spec_totmc_flux[ivar][iuniv]->SaveTo(dftmc->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
306 spec_Nsig_fid_only_flux[ivar][iuniv]->SaveTo(dft->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
307 spec_NSel_Cuts_flux[ivar][iuniv]->SaveTo(dfp->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
308 spec_Nbkg_Cuts_flux[ivar][iuniv]->SaveTo(dfb->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
309 spec_totmc_xsec[ivar][iuniv]->SaveTo(dxtmc->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
310 spec_Nsig_fid_only_xsec[ivar][iuniv]->SaveTo(dxt->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
311 spec_NSel_Cuts_xsec[ivar][iuniv]->SaveTo(dxp->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
312 spec_Nbkg_Cuts_xsec[ivar][iuniv]->SaveTo(dxb->mkdir( (
"spec"+
std::to_string(iuniv)).c_str()));
_HistAxis< Var > HistAxis
Represent the binning of a Spectrum's x-axis.
Cuts and Vars for the 2020 FD DiF Study.
TFile fout(fname.c_str(),"RECREATE")
std::vector< Dataset > datasets
void SetSpillCut(const SpillCut &cut)
std::vector< Var > GetkPPFXFluxUnivWgt()
const SpillCut kTightBeamQualityCuts([](const caf::SRSpillProxy *s){if(s->ismc) return true; if(s->trigger==2) return true;if(s->spilltimesec==0 &&s->deltaspilltimensec==0 &&s->widthx==0) return bool(s->isgoodspill);if(std::abs(s->deltaspilltimensec) > 0.5e9) return false;if(s->spillpot< 2e12) return false;if(s->hornI< -202|| s->hornI >-198) return false;if(s->posx< -2.00|| s->posx >+2.00) return false;if(s->posy< -2.00|| s->posy >+2.00) return false;return kBeamWidthCut(s);})
std::vector< std::map< const ISyst *, double > > ShiftTables()
Return the tables of knob shift values.
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.
std::vector< float > Spectrum
const SystShifts kNoShift
Base class for the various types of spectrum loader.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
std::string to_string(ModuleType mt)
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
std::vector< std::string > parse_as_vector(std::string s)