51 const std::string fnearcaffull =
"prod_decaf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1";
53 const std::string fneardatafull =
"prod_decaf_R17-03-01-prod3reco.d_nd_numi_fhc_full_nue_or_numu_or_nus_contain_v1_goodruns";
84 const Cut kNus17NDPtpCut(
88 if(partptp > 0.8)
return false;
97 std::string labelTop =
"Minimum Distance to Top Detector Face (cm)";
98 std::string labelBottom =
"Minimum Distance to Bottom Detector Face (cm)";
99 std::string labelEast =
"Minimum Distance to East Detector Face (cm)";
100 std::string labelWest =
"Minimum Distance to West Detector Face (cm)";
101 std::string labelFront =
"Minimum Distance to Front Detector Face (cm)";
102 std::string labelBack =
"Minimum Distance to Back Detector Face (cm)";
108 Binning kNusEBins = Binning::Simple(100, 0, 10);
109 Binning kNCAllEBins = Binning::Simple(200, 0, 20);
112 Binning kNearEdgeBins = Binning::Simple(160, 0., 800.);
114 Binning kHitBins = Binning::Simple(800, 0., 800.);
115 Binning kHpPBins = Binning::Simple(10, 0., 10.);
119 const HistAxis kAxisHpP (labelHpP, kHpPBins, kHpP);
149 const Cut kNM1CVNnc =
159 const Cut kNM1Energy =
165 const Cut kFidMinusX(
171 if(vtx.Y() < -100.0)
return false;
172 if(vtx.Y() > 100.0)
return false;
173 if(vtx.Z() < 150.0)
return false;
174 if(vtx.Z() > 1000.0)
return false;
177 const Cut kFidMinusY(
183 if(vtx.X() < -100.0)
return false;
184 if(vtx.X() > 100.0)
return false;
185 if(vtx.Z() < 150.0)
return false;
186 if(vtx.Z() > 1000.0)
return false;
189 const Cut kFidMinusZ(
195 if(vtx.X() < -100.0)
return false;
196 if(vtx.X() > 100.0)
return false;
197 if(vtx.Y() < -100.0)
return false;
198 if(vtx.Y() > 100.0)
return false;
202 const Cut kMinusTop =
209 const Cut kMinusBottom =
216 const Cut kMinusEast =
223 const Cut kMinusWest =
230 const Cut kMinusFront =
237 const Cut kMinusBack =
245 std::map<std::string, HistAxis*>
axes;
246 axes[
"RecoE"] =
new HistAxis(kNus17EAxis);
247 axes[
"RecoELong"] =
new HistAxis(kNCAllEAxis);
248 axes[
"HitpPlane"] =
new HistAxis(kAxisHpP);
249 axes[
"VtxX"] =
new HistAxis(kAxisVtxX);
250 axes[
"VtxY"] =
new HistAxis(kAxisVtxY);
251 axes[
"VtxZ"] =
new HistAxis(kAxisVtxZ);
252 axes[
"Top"] =
new HistAxis(kAxisTop);
253 axes[
"Bottom"] =
new HistAxis(kAxisBottom);
254 axes[
"East"] =
new HistAxis(kAxisEast);
255 axes[
"West"] =
new HistAxis(kAxisWest);
256 axes[
"Front"] =
new HistAxis(kAxisFront);
257 axes[
"Back"] =
new HistAxis(kAxisBack);
258 axes[
"CVN"] =
new HistAxis(kAxisCVN);
259 axes[
"NHit"] =
new HistAxis(kAxisNHit);
260 axes[
"PTP"] =
new HistAxis(kAxisPTP);
263 std::map<std::string, Cut*>
cuts;
266 cuts[
"EQFid"] =
new Cut(kNusEQFid);
274 std::map<std::string, std::pair<ana::Spectrum*, ana::CheatDecomp*> > loaded_specs =
277 std::map<std::string, Cut*> nm1s;
278 nm1s[
"VtxX"] =
new Cut(kNM1Fid && kFidMinusX);
279 nm1s[
"VtxY"] =
new Cut(kNM1Fid && kFidMinusY);
280 nm1s[
"VtxZ"] =
new Cut(kNM1Fid && kFidMinusZ);
281 nm1s[
"Top"] =
new Cut(kNM1Cont && kMinusTop);
282 nm1s[
"Bottom"] =
new Cut(kNM1Cont && kMinusBottom);
283 nm1s[
"East"] =
new Cut(kNM1Cont && kMinusEast);
284 nm1s[
"West"] =
new Cut(kNM1Cont && kMinusWest);
285 nm1s[
"Front"] =
new Cut(kNM1Cont && kMinusFront);
286 nm1s[
"Back"] =
new Cut(kNM1Cont && kMinusBack);
287 nm1s[
"CVN"] =
new Cut(kNM1CVNnc);
288 nm1s[
"PTP"] =
new Cut(kNM1Ptp);
289 nm1s[
"RecoE"] =
new Cut(kNM1Energy);
290 nm1s[
"RecoELong"] =
new Cut(kNM1Energy);
292 for(
const auto& nm1 : nm1s) {
296 loaded_specs[strcut + strNM1] =
300 axes[strcut], nm1.second,
kNoShift, kFluxMECWgt
309 TFile* rootOut =
new TFile(
outfile.c_str(),
"RECREATE");
311 for(
const auto& loaded_spec : loaded_specs) {
312 loaded_spec.second.first->SaveTo(rootOut, (loaded_spec.first +
"Data").c_str());
313 loaded_spec.second.second->SaveTo(rootOut, (loaded_spec.first +
"MC").c_str());
Near Detector underground.
const Cut kNus17EnergyCut([](const caf::SRProxy *sr){double energy=0.0;energy=kNus17Energy(sr);if(energy< 0.25) return false;if(energy > 10.0) return false;return true;})
const Var kPartPtp([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.partptp)|| std::isinf(1.*sr->sel.nuecosrej.partptp)) return-5.f;return float(sr->sel.nuecosrej.partptp);})
_HistAxis< Var > HistAxis
Represent the binning of a Spectrum's x-axis.
const Var kDistAllBottom([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngbottom)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngbottom);})
Distance of all showers in slice from the bottom edge of detector.
const Var kDistAllWest([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngwest)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngwest);})
Distance of all showers in slice from the west edge of detector.
const Var kDistAllTop([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngtop)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngtop);})
Distance of all showers in slice from the top edge of detector.
const Var kDistAllBack([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngback)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngback);})
Distance of all showers in slice from the back edge of detector.
Proxy for caf::StandardRecord.
Collection of SpectrumLoaders for many configurations.
const Cut kNus17NDFiducial([](const caf::SRProxy *sr){assert(sr->vtx.elastic.IsValid &&"Must apply EQ cuts");if(sr->vtx.elastic.vtx.X()< -100.0) return false;if(sr->vtx.elastic.vtx.X() > 100.0) return false;if(sr->vtx.elastic.vtx.Y()< -100.0) return false;if(sr->vtx.elastic.vtx.Y() > 100.0) return false;if(sr->vtx.elastic.vtx.Z()< 150.0) return false;if(sr->vtx.elastic.vtx.Z() > 1000.0) return false;return true;})
const Cut kNus17CVNnc([](const caf::SRProxy *sr){if(sr->slc.nhit < 25) return false;std::cout<< "ERROR::kNus17CVNnc. Looking for cvnProd3Train. Branch no longer exists."<< std::endl;abort();return true;})
void Go()
Call Go() on all the loaders.
const Var kNus17Energy([](const caf::SRProxy *sr){double cale=sr->slc.calE;double recoE=0.;if(sr->hdr.det==caf::kFARDET) recoE=FDscaleCalE17 *cale;if(sr->hdr.det==caf::kNEARDET) recoE=NDscaleCalE17 *cale;return recoE;})
const Var kDistAllEast([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngeast)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngeast);})
Distance of all showers in slice from the east edge of detector.
caf::Proxy< caf::SRElastic > elastic
caf::Proxy< caf::SRNueCosRej > nuecosrej
void SetSpillCut(const SpillCut &cut)
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
caf::Proxy< float > partptp
std::map< std::string, std::pair< Spectrum *, CheatDecomp * > > MakeMap(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, std::map< std::string, HistAxis * > axes, std::map< std::string, Cut * > cuts, const SystShifts &shift, const Var &wei)
const SystShifts kNoShift
const Cut kNus17NDContain
const Var kDistAllFront([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngfront)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngfront);})
Distance of all showers in slice from the front edge of detector.
caf::Proxy< bool > IsValid
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
caf::Proxy< caf::SRVector3D > vtx
const Binning kFinePIDBins
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
caf::Proxy< caf::SRIDBranch > sel
caf::Proxy< caf::SRVertexBranch > vtx
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
const Cut kNus17EventQuality([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->slc.ncontplanes<=2) return false;return true;})
Data Quality cuts from docdb 21113.