reduce_nus_ana2019.C
Go to the documentation of this file.
1 #include "CAFAna/Cuts/Cuts.h"
3 #include "CAFAna/Vars/Vars.h"
5 
6 // For the FD cuts for now
7 #include "NuXAna/Cuts/NusCuts.h"
9 
10 using namespace ana;
11 
12 Cut DetectorHornSwitcher(const Cut &ndCutFHC, const Cut &ndCutRHC, const Cut &fdCutFHC, const Cut &fdCutRHC)
13 {
14  return Cut([&ndCutFHC, &ndCutRHC, &fdCutFHC, &fdCutRHC](const caf::SRProxy* sr)
15  {
16  if (sr->hdr.det == caf::kFARDET && sr->spill.isFHC){
17  return fdCutFHC(sr);
18  }
19  else if(sr->hdr.det == caf::kFARDET && sr->spill.isRHC){
20  return fdCutRHC(sr);
21  }
22  else if(sr->hdr.det == caf::kNEARDET && sr->spill.isFHC){
23  return ndCutFHC(sr);
24  }
25  else{
26  return ndCutRHC(sr);
27  }
28  });
29 }
30 
32 {
33  FileReducer reduce(fname, outname);
34  reduce.SetMetadata("nova.decaf_skim", "nus_contain");
35 
36  // ND / FD kNus cuts, event quality and loose fiducial + cvn decaf cut (NusCuts18.h)
41 
42  const Cut whichCut = DetectorHornSwitcher(ndCutFHC, ndCutRHC, fdCutFHC, fdCutRHC);
43 
44  reduce.AddEventCut(whichCut);
45 
46  // This does most of the work
49  reduce.Go();
50 }
caf::Proxy< caf::SRSpill > spill
Definition: SRProxy.h:2143
Near Detector underground.
Definition: SREnums.h:10
void ReduceForNusDecaf(caf::StandardRecord *sr)
Definition: FileReducer.cxx:80
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kNus18FHCDecafCut
Definition: NusCuts18.h:154
void AddSpillReductionStep(const std::function< SpillReductionFunc > &f)
Run the specified reduction function over each spill.
Definition: FileReducer.h:90
const Cut kNusEventQuality([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.gap >=100.) return false;if(sr->slc.ncontplanes<=2) return false;return true;})
Data Quality cuts from docdb 14241.
Definition: NusCuts.h:14
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kNus18RHCDecafCut
Definition: NusCuts18.h:155
void SetMetadata(const std::string &key, const std::string &val)
Cause the output file to be systematically shifted.
Definition: FileReducer.h:102
const Cut kNusFDFidLoose([](const caf::SRProxy *sr){double buf=10.;if(!sr->vtx.elastic.IsValid) return false;const TVector3 vtx=sr->vtx.elastic.vtx;if(vtx.X()< (FDL+buf)) return false;if(vtx.X() >(FDR-buf)) return false;if(vtx.Y()< (FDB+buf)) return false;if(vtx.Y() >(FDT-buf)) return false;if(vtx.Z()< (FDF+buf)) return false;if(vtx.Z() >(FDE-buf)) return false;return true;})
Definition: NusCuts.h:21
const Cut kNusNDFidLoose([](const caf::SRProxy *sr){double buf=10.;if(!sr->vtx.elastic.IsValid) return false;const TVector3 vtx=sr->vtx.elastic.vtx;if(vtx.X()< (NDL+buf)) return false;if(vtx.X() >(NDR-buf)) return false;if(vtx.Y()< (NDB+buf)) return false;if(vtx.Y() >(NDT-buf)) return false;if(vtx.Z()< (NDF+buf)) return false;if(vtx.Z() >(NDE-buf)) return false;return true;})
Definition: NusCuts.h:55
void AddReductionStep(const std::function< ReductionFunc > &f)
Run the specified reduction function over each event.
Definition: FileReducer.h:85
caf::Proxy< bool > isFHC
Definition: SRProxy.h:1375
void AddEventCut(const Cut &cut)
Only copy records to the output file if they pass this cut.
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
caf::StandardRecord * sr
virtual void Go() override
Load all the registered spectra.
void reduce_nus_ana2019(std::string fname, std::string outname)
Create smaller CAFs.
Definition: FileReducer.h:56
Cut DetectorHornSwitcher(const Cut &ndCutFHC, const Cut &ndCutRHC, const Cut &fdCutFHC, const Cut &fdCutRHC)
void CleanSpillQualityInfo(caf::SRSpill *spill, const caf::SRSpillProxy *spillProxy)
caf::Proxy< bool > isRHC
Definition: SRProxy.h:1376
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232
enum BeamMode string