NueCuts2020.cxx
Go to the documentation of this file.
2 
4 
5 #include <cassert>
6 
7 namespace ana
8 {
9  //ECM this is copy paste with a better name
10  const Cut kNue2020RecoQuality([](const caf::SRProxy* sr) {
11  // Cut out FEB flashers
12  if(sr->sel.nuecosrej.hitsperplane >= 8)
13  return false;
14  // Basic Reco Quality Cuts
15  if(!sr->vtx.elastic.IsValid)
16  return false;
17  if(sr->vtx.elastic.fuzzyk.npng == 0)
18  return false;
19  return true;
20  });
21 
22  /*const Cut kNue2020FDVeto([](const caf::SRProxy* sr) {
23  if(!kIsFarDet(sr)) return false;
24  if(!sr->spill.cosmiccvn[0].passSel) return false;
25  if(!kNue2017Veto(sr)) return false;
26  return true;
27  });
28  */
29  const Cut kNue2020FDNearestSlice([](const caf::SRProxy* sr) {
30  const double hibin = kIsRHC(sr) ? kNue2020CVNRHCHighEdge : kNue2020CVNFHCHighEdge;
31  const double topcut = (kCVNe_looseptp(sr) >= hibin) ? 50 : 400;
32 
33  return (fabs(sr->slc.closestslicetime) >= 100 ||
34  sr->slc.closestsliceminfromtop >= topcut ||
35  sr->slc.closestslicemindist >= 500);
36  });
37  //************************************************************
38 
39  const Cut kNue2020PID([](const caf::SRProxy* sr) {
40  if(kIsRHC(sr)) return kNue2020PIDRHC(sr);
41  else return kNue2020PIDFHC(sr);
42  });
43 
44  const Cut kNue2020CosRej([](const caf::SRProxy* sr) {
45  if(kIsRHC(sr)) return kNue2020CosRejRHC(sr);
46  else return kNue2020CosRejFHC(sr);
47  });
48 
50  {
51  if(kIsRHC(sr)) return kNue2020CVN_VsCosPIDRHC(sr);
52 
53  else return kNue2020CVN_VsCosPIDFHC(sr);
54  }
55  //************************************************************
56 
58  {
60  }
61 
62  const Cut kNue2020CVNCutLP([](const caf::SRProxy* sr) {
63  if(kIsRHC(sr)) return kNue2020RHCCVNCutLP(sr);
64  else return kNue2020FHCCVNCutLP(sr);
65  });
66 
67  const Cut kNue2020CVNVsCosPIDLP([](const caf::SRProxy* sr){
68 
69  if(kNue2020CVN_VsCosPID(sr)) return false;
70 
71  if(kIsRHC(sr)) return kNue2020CVNVsCosPIDRHCLP(sr);
72 
73  else return kNue2020CVNVsCosPIDFHCLP(sr);
74 
75  });
76 
77  // MRBrem case:
79  {
81  }
82 
83  //************************************************************
84  // copy pasted
85  // --------------------------------------------------------------------------
86  const Cut kNue2020NDFiducial([](const caf::SRProxy* sr){
87  assert(sr->vtx.elastic.IsValid && "Must apply DQ cuts");
88  if (sr->vtx.elastic.vtx.X() < -100.0) return false;
89  if (sr->vtx.elastic.vtx.X() > 160.0) return false;
90  if (sr->vtx.elastic.vtx.Y() < -160.0) return false;
91  if (sr->vtx.elastic.vtx.Y() > 100.0) return false;
92  if (sr->vtx.elastic.vtx.Z() < 150.0) return false;
93  if (sr->vtx.elastic.vtx.Z() > 900.0) return false;
94  return true;
95  });
96 
97  //************************************************************
98  const Cut kNue2020NDContain([](const caf::SRProxy* sr){
99  for (unsigned int ix =0; ix<sr->vtx.elastic.fuzzyk.nshwlid; ++ix){
100  const caf::SRVector3DProxy& start = sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;
101  const caf::SRVector3DProxy& stop = sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;
102  if (std::min(start.X(),stop.X()) < -150.0) return false;
103  if (std::max(start.X(),stop.X()) > 170.0) return false;
104  if (std::min(start.Y(),stop.Y()) < -170.0) return false;
105  if (std::max(start.Y(),stop.Y()) > 150.0) return false;
106  if (std::min(start.Z(),stop.Z()) < 100.0) return false;
107  if (std::max(start.Z(),stop.Z()) > 1225.0) return false;
108  }
109 
110  // This was a separate cut in 2017...
111  if (sr->sel.contain.nplanestofront < 10) return false;
112 
113  return true;
114  });
115 
116  //************************************************************
117  const Var kNue2020SelectionBin([](const caf::SRProxy *sr){
118  bool isPeri = kNue2020FDPeripheral(sr);
119  if (isPeri)
120  return float(2.5);
121 
122  const double lowedge = kIsRHC(sr) ? kNue2020CVNRHCLowEdge : kNue2020CVNFHCLowEdge;
123  const double highedge = kIsRHC(sr) ? kNue2020CVNRHCHighEdge : kNue2020CVNFHCHighEdge;
124  if (sr->sel.cvnloosepreselptp.nueid >= lowedge && sr->sel.cvnloosepreselptp.nueid < highedge)
125  return float(0.5);
126  else if (sr->sel.cvnloosepreselptp.nueid >= highedge)
127  return float(1.5);
128  else return float(-5.0);
129 
130  return float(-5.0);
131  });
132 
133 
134  const Var kNue2020AnaBin([](const caf::SRProxy *sr){
135  int selBin = kNue2020SelectionBin(sr);
136  float nuE = kNueEnergy2020(sr);
137  int nuEBin = nuE/0.5;
138 
139  assert(nuEBin <= 8 && "An event with nuE > 4.5 should never happen");
140 
141  int anaBin = 9*selBin + nuEBin;
142 
143  return anaBin;
144  });
145 
146  const Binning kNue2020Binning = Binning::Simple(27,0,27);
147  /// Use this Axis for Ana2020, official Axis
148  const HistAxis kNue2020Axis("NuE Energy / Analysis Bin",
149  kNue2020Binning,kNue2020AnaBin);
150 
151  const Var kNue2020AnaBinMergedPeripheral([](const caf::SRProxy *sr){
152  int anaBin = kNue2020AnaBin(sr);
153  anaBin = anaBin > 18 ? 20 : anaBin;
154  return anaBin;
155  });
156 
157  const Binning kNue2020BinningMergedPeripheral = Binning::Simple(23,0,23);
158  const HistAxis kNue2020AxisMergedPeripheral("NuE Energy / Analysis Bin",
159  kNue2020BinningMergedPeripheral,
160  kNue2020AnaBinMergedPeripheral);
161 }
caf::Proxy< caf::SRCVNResult > cvnloosepreselptp
Definition: SRProxy.h:1233
caf::Proxy< size_t > npng
Definition: SRProxy.h:2020
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2022
T max(const caf::Proxy< T > &a, T b)
bool kNue2020FDPeripheralFunc(const caf::SRProxy *sr)
Use this cut for the full FD Peripheral sample, the same for RHC and FHC.
Definition: NueCuts2020.cxx:57
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2041
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kNue2020CVN_VsCosPIDFHC
Definition: NueCuts2020.h:75
const Cut kNue2020PeripheralBasicEventCut_MRBrem
Definition: NueCuts2020.h:147
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
const double kNue2020CVNRHCLowEdge
Definition: NueCuts2020.h:52
const Cut kNue2020FHCCVNCutLP
Definition: NueCuts2020.h:87
const Cut kNue2020PID([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2020PIDRHC(sr);else return kNue2020PIDFHC(sr);})
Definition: NueCuts2020.h:61
const Cut kNue2020FD_MRBrem
Definition: NueCuts2020.h:144
caf::Proxy< caf::SRContain > contain
Definition: SRProxy.h:1230
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2108
const Var kNue2020SelectionBin([](const caf::SRProxy *sr){bool isPeri=kNue2020FDPeripheral(sr);if(isPeri) return float(2.5);const double lowedge=kIsRHC(sr)?kNue2020CVNRHCLowEdge:kNue2020CVNFHCLowEdge;const double highedge=kIsRHC(sr)?kNue2020CVNRHCHighEdge:kNue2020CVNFHCHighEdge;if(sr->sel.cvnloosepreselptp.nueid >=lowedge &&sr->sel.cvnloosepreselptp.nueid< highedge) return float(0.5);else if(sr->sel.cvnloosepreselptp.nueid >=highedge) return float(1.5);else return float(-5.0);return float(-5.0);})
Definition: NueCuts2020.h:188
const double kNue2020CVNRHCHighEdge
Definition: NueCuts2020.h:53
const Cut kNue2020FDNearestSlice([](const caf::SRProxy *sr){const double hibin=kIsRHC(sr)?kNue2020CVNRHCHighEdge:kNue2020CVNFHCHighEdge;const double topcut=(kCVNe_looseptp(sr) >=hibin)?50:400;return(fabs(sr->slc.closestslicetime) >=100|| sr->slc.closestsliceminfromtop >=topcut|| sr->slc.closestslicemindist >=500);})
Definition: NueCuts2020.h:24
bool kNue2020CVN_VsCosPIDFunc(const caf::SRProxy *sr)
Definition: NueCuts2020.cxx:49
const Cut kNue2020CVN_VsCosPID(kNue2020CVN_VsCosPIDFunc)
const double kNue2020CVNFHCLowEdge
Definition: NueCuts2020.h:47
bool kNue2020FDPeripheralFunc_MRBrem(const caf::SRProxy *sr)
Definition: NueCuts2020.cxx:78
const Cut kNue2020CosRej([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2020CosRejRHC(sr);else return kNue2020CosRejFHC(sr);})
Definition: NueCuts2020.h:62
const Cut kNue2020CosRejRHC
Definition: NueCuts2020.h:59
caf::Proxy< float > closestslicetime
Definition: SRProxy.h:1281
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2100
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1244
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2025
const double kNue2020CVNFHCHighEdge
Definition: NueCuts2020.h:48
const Cut kNue2020RHCCVNCutLP
Definition: NueCuts2020.h:88
const Cut kNue2020NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;const caf::SRVector3DProxy &stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -150.0) return false;if(std::max(start.X(), stop.X()) > 170.0) return false;if(std::min(start.Y(), stop.Y())< -170.0) return false;if(std::max(start.Y(), stop.Y()) > 150.0) return false;if(std::min(start.Z(), stop.Z())< 100.0) return false;if(std::max(start.Z(), stop.Z()) > 1225.0) return false;}if(sr->sel.contain.nplanestofront< 10) return false;return true;})
Definition: NueCuts2020.h:167
const Cut kNue2020CVNCutLP([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2020RHCCVNCutLP(sr);else return kNue2020FHCCVNCutLP(sr);})
Definition: NueCuts2020.h:89
caf::Proxy< int > nplanestofront
Definition: SRProxy.h:808
caf::Proxy< float > nueid
Definition: SRProxy.h:885
const Cut Energy
const Cut kNue2020CVNVsCosPIDRHCLP
Definition: NueCuts2020.h:101
caf::Proxy< float > hitsperplane
Definition: SRProxy.h:1025
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
const Cut kNue2020PeripheralBasicEventCut
Definition: NueCuts2020.h:69
caf::StandardRecord * sr
caf::Proxy< float > closestsliceminfromtop
Definition: SRProxy.h:1278
const Cut kNue2020PIDFHC
Definition: NueCuts2020.h:56
const Cut kNue2020FD
Definition: NueCuts2020.h:65
const Cut kNue2020CVN_VsCosPIDRHC
Definition: NueCuts2020.h:74
const Cut kNue2020CVNVsCosPIDLP([](const caf::SRProxy *sr){if(kNue2020CVN_VsCosPID(sr)) return false;if(kIsRHC(sr)) return kNue2020CVNVsCosPIDRHCLP(sr);else return kNue2020CVNVsCosPIDFHCLP(sr);})
Definition: NueCuts2020.h:103
const Cut kIsRHC([](const caf::SRProxy *sr){return sr->spill.isRHC;})
Definition: Vars.h:16
const Cut kNue2020RecoQuality([](const caf::SRProxy *sr){if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(!sr->vtx.elastic.IsValid) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return true;})
Definition: NueCuts2020.h:16
const Var kNueEnergy2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;if(kIsRHC(sr)) return kNueEnergyRHC2020(sr);else return kNueEnergyFHC2020(sr);})
Nue energy with 3d prong info. only (old version of vars)
Definition: NueEnergy2020.h:38
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2040
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2124
caf::Proxy< float > closestslicemindist
Definition: SRProxy.h:1273
const Cut kNue2020NDFiducial([](const caf::SRProxy *sr){assert(sr->vtx.elastic.IsValid &&"Must apply DQ cuts");if(sr->vtx.elastic.vtx.X()< -100.0) return false;if(sr->vtx.elastic.vtx.X() > 160.0) return false;if(sr->vtx.elastic.vtx.Y()< -160.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() > 900.0) return false;return true;})
Definition: NueCuts2020.h:166
const Var kNue2020AnaBin([](const caf::SRProxy *sr){int selBin=kNue2020SelectionBin(sr);float nuE=kNueEnergy2020(sr);int nuEBin=nuE/0.5;assert(nuEBin<=8 &&"An event with nuE > 4.5 should never happen");int anaBin=9 *selBin+nuEBin;return anaBin;})
Use this Analysis Binning for Ana2020, official Binning.
Definition: NueCuts2020.h:191
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2055
assert(nhit_max >=nhit_nbins)
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2123
T min(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2128
const Cut kNue2020CosRejFHC
Definition: NueCuts2020.h:58
const Cut kNue2020FDPeripheral(kNue2020FDPeripheralFunc)
const Var kCVNe_looseptp
Definition: Vars.cxx:36
const Cut kNue2020PIDRHC
Definition: NueCuts2020.h:57
const Cut kNue2020CVNVsCosPIDFHCLP
Definition: NueCuts2020.h:102