NueCuts2017.cxx
Go to the documentation of this file.
2 
4 
6 
7 #include <cassert>
8 
9 namespace ana
10 {
11  // --------------------------------------------------------------------------
13  {
14  return kApplySecondAnalysisMask(sr) && kNue2017Veto(sr) && kNueDQ2017CVN(sr);
15  }
16 
17  // --------------------------------------------------------------------------
18  const Cut kNueDQ2017CVN([](const caf::SRProxy* sr){
19  // Cut out FEB flashers
20  if(sr->sel.nuecosrej.hitsperplane >= 8)
21  return false;
22  // Basic Reco Quality Cuts
23  if(!sr->vtx.elastic.IsValid)
24  return false;
25  if(sr->vtx.elastic.fuzzyk.npng == 0)
26  return false;
27 
28  return true;
29  });
30 
31  // --------------------------------------------------------------------------
32  const Cut kNueDQ2017LID([](const caf::SRProxy* sr){
33  // Cut out FEB flashers
34  if(sr->sel.nuecosrej.hitsperplane >= 8)
35  return false;
36  // Basic Reco Quality Cuts
37  if(!sr->vtx.elastic.IsValid)
38  return false;
39  if(sr->vtx.elastic.fuzzyk.npng == 0)
40  return false;
41  if(sr->vtx.elastic.fuzzyk.nshwlid == 0)
42  return false;
43  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx <= 5 || sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity <= 5)
44  return false;
45  if(sr->vtx.elastic.fuzzyk.png[0].shwlid.gap > 100)
46  return false;
47  //angle between two leading showers
48  //TODO study using cosdang instead
49  if(sr->vtx.elastic.fuzzyk.nshwlid >= 2){
50  if ((sr->vtx.elastic.fuzzyk.png[0].shwlid.dir).
51  Dot(sr->vtx.elastic.fuzzyk.png[1].shwlid.dir) < -0.95)
52  //if(sr->sel.nuecosrej.cosdang < -0.95)
53  return false;
54  }
55  //asymmetry between x and y hits of most energetic shower
56 
57  float xyhitdiff = abs(sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx - sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity);
58  float xyhitsum = sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx + sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
59  if (xyhitdiff/xyhitsum >= 0.4) return false;
60  //fraction of hits in a 3D shower out of total slice
61  float nhitall = 0.0;
62  for(unsigned int j=0;j<sr->vtx.elastic.fuzzyk.nshwlid;j++){
63  nhitall += sr->vtx.elastic.fuzzyk.png[j].shwlid.nhit;
64  }
65  if (nhitall/sr->slc.nhit <= 0.7) return false;
66 
67  return true;
68  });
69 
70 
71  // --------------------------------------------------------------------------
72  const Cut kNue2017Veto([](const caf::SRProxy* sr){
73  return sr->sel.veto.keep;
74  });
75 
76  // --------------------------------------------------------------------------
77  const Cut kNearestSliceCosRejCore([](const caf::SRProxy* sr) {
78  if(kCVNe(sr) > 0.75 && kCVNe(sr) < 0.87){
79  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
80  sr->slc.closestsliceminfromtop < 400 && sr->slc.closestslicemindist < 500.);
81  }
82 
83  if(kCVNe(sr) > 0.87){
84  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
85  sr->slc.closestsliceminfromtop < 50 && sr->slc.closestslicemindist < 500.);
86  }
87  return false;
88  });
89 
90  // --------------------------------------------------------------------------
91  const Cut kNearestSliceCosRejPeripheral([](const caf::SRProxy* sr) {
93  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
94  sr->slc.closestsliceminfromtop < 50 && sr->slc.closestslicemindist < 500.);
95  }
96  return false;
97  });
98 
99  // --------------------------------------------------------------------------
101  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
102  sr->slc.closestsliceminfromtop < 50 && sr->slc.closestslicemindist < 500.);
103  });
104 
105  // --------------------------------------------------------------------------
106  const Cut kNearestSliceCosRejCoreSideband([](const caf::SRProxy* sr) {
107  if(kCVNe(sr) > 0.5 && kCVNe(sr) < 0.87){
108  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
109  sr->slc.closestsliceminfromtop < 400 && sr->slc.closestslicemindist < 500.);
110  }
111 
112  if(kCVNe(sr) > 0.87){
113  return !(sr->slc.closestslicetime > -100. && sr->slc.closestslicetime < 100. &&
114  sr->slc.closestsliceminfromtop < 50 && sr->slc.closestslicemindist < 500.);
115  }
116  return false;
117  });
118 
119  // --------------------------------------------------------------------------
120  const Cut kNue2017NDFiducial([](const caf::SRProxy* sr){
121  assert(sr->vtx.elastic.IsValid && "Must apply DQ cuts");
122  if (sr->vtx.elastic.vtx.X() < -100.0) return false;
123  if (sr->vtx.elastic.vtx.X() > 160.0) return false;
124  if (sr->vtx.elastic.vtx.Y() < -160.0) return false;
125  if (sr->vtx.elastic.vtx.Y() > 100.0) return false;
126  if (sr->vtx.elastic.vtx.Z() < 150.0) return false;
127  if (sr->vtx.elastic.vtx.Z() > 900.0) return false;
128  return true;
129  });
130 
131  // --------------------------------------------------------------------------
132  const Cut kNue2017NDContain([](const caf::SRProxy* sr){
133  for (unsigned int ix =0; ix<sr->vtx.elastic.fuzzyk.nshwlid; ++ix){
134  TVector3 start = sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;
135  TVector3 stop = sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;
136  if (std::min(start.X(),stop.X()) < -170.0) return false;
137  if (std::max(start.X(),stop.X()) > 170.0) return false;
138  if (std::min(start.Y(),stop.Y()) < -170.0) return false;
139  if (std::max(start.Y(),stop.Y()) > 170.0) return false;
140  if (std::min(start.Z(),stop.Z()) < 100.0) return false;
141  if (std::max(start.Z(),stop.Z()) > 1225.0) return false;
142  }
143  return true;
144  });
145 
146  // --------------------------------------------------------------------------
148  SIMPLEVAR(sel.contain.nplanestofront) > 6;
149 
150  // --------------------------------------------------------------------------
151  const Var kNue2017SelectionBin([](const caf::SRProxy *sr){
152  bool isPeri = kNue2017FDPeripheral(sr);
153  if (isPeri)
154  return float(3.5);
155  if (kCVNe(sr) > 0.75 && kCVNe(sr) < 0.87)
156  return float(0.5);
157  if (kCVNe(sr) > 0.87 && kCVNe(sr) < 0.95)
158  return float(1.5);
159  if (kCVNe(sr) > 0.95)
160  return float(2.5);
161  return float(-0.5);
162  });
163 
164  // --------------------------------------------------------------------------
165  const Var kNue2017AnaBin([](const caf::SRProxy *sr){
166  int selBin = kNue2017SelectionBin(sr);
167 
168  float nuE = kNueEnergy2017(sr);
169  int nuEBin = nuE/0.5;
170  assert(nuEBin <= 8 && "An event with nuE > 4.5 should never happen");
171 
172  int anaBin = 9*selBin + nuEBin;
173  return anaBin;
174  });
175 
176  const Binning kNue2017Binning = Binning::Simple(36,0,36);
177  const HistAxis kNue2017Axis("NuE Energy / Analysis Bin",
178  kNue2017Binning, kNue2017AnaBin);
179 
180  // --------------------------------------------------------------------------
181  const Var kNue2017AnaBinMergedPeripheral([](const caf::SRProxy *sr){
182  int anaBin = kNue2017AnaBin(sr);
183  anaBin = anaBin > 27 ? 29 : anaBin;
184  return anaBin;
185  });
186 
187  const Binning kNue2017BinningMergedPeripheral = Binning::Simple(32,0,32);
188 
189  const HistAxis kNue2017AxisMergedPeripheral("NuE Energy / Analysis Bin",
190  kNue2017BinningMergedPeripheral,
191  kNue2017AnaBinMergedPeripheral);
192 
193  // --------------------------------------------------------------------------
194  const Cut kNue2017MRParentSliceCut([](const caf::SRProxy* sr){
195  const caf::SRMRCCParentProxy& parent = sr->parent.mrccpar;
196  if(parent.eff < 0.9 || parent.pur < 0.9 )
197  return false;
198  // numu PID cut
199  if(parent.remid < 0.75)
200  return false;
201  // numu quality cut
202  if(parent.numuE < 0 ||
203  parent.nhit < 20 ||
204  parent.contplanes < 5 )
205  return false;
206  // numu fiducial cut
207  if(parent.firstplane < 2 ||
208  parent.lastplane > 211 ||
209  parent.muonstop.Z() > 1275 ||
210  parent.muonfwdcell < 5 ||
211  parent.muonbkcell < 9 ||
212  parent.hadEinmucat > 0.03 )
213  return false;
214  return true;
215  });
216 }
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
const Cut kNearestSliceCosRejCore([](const caf::SRProxy *sr){if(kCVNe(sr) > 0.75 &&kCVNe(sr)< 0.87){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&& sr->slc.closestsliceminfromtop< 400 &&sr->slc.closestslicemindist< 500.);}if(kCVNe(sr) > 0.87){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&& sr->slc.closestsliceminfromtop< 50 &&sr->slc.closestslicemindist< 500.);}return false;})
Definition: NueCuts2017.h:127
T max(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRVeto > veto
Definition: SRProxy.h:1274
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kNue2017Veto([](const caf::SRProxy *sr){return sr->sel.veto.keep;})
cosmic veto cut for FD
Definition: NueCuts2017.h:43
const Var kCVNe
PID
Definition: Vars.cxx:35
const Cut kApplySecondAnalysisMask([](const caf::SRProxy *sr){if(sr->hdr.det!=caf::kFARDET) return true; std::bitset< 14 > binary(sr->hdr.dibmask);std::pair< int, int > planesA=calcFirstLastLivePlane(sr->slc.firstplane, binary);std::pair< int, int > planesB=calcFirstLastLivePlane(sr->slc.lastplane, binary);if((planesA.first!=planesB.first)||(planesA.second!=planesB.second)) return false;return((planesA.second-planesA.first+1)/64 >=4);})
Definition: AnalysisMasks.h:18
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kNue2017CVNVsCosPID
Definition: NueCuts2017.h:146
const Cut kNueDQ2017CVN([](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: NueCuts2017.h:28
void abs(TH1 *hist)
caf::Proxy< float > closestslicetime
Definition: SRProxy.h:1302
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1265
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Cut kNearestSliceCosRejPeripheral([](const caf::SRProxy *sr){if(kNue2017PeripheralPresel(sr)&&kNue2017CVNVsCosPID(sr)){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&& sr->slc.closestsliceminfromtop< 50 &&sr->slc.closestslicemindist< 500.);}return false;})
Definition: NueCuts2017.h:149
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const Var kNueEnergy2017([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;return NueRecoE_2017FDFit(kCVNemE(sr), kCVNhadE(sr));})
Definition: NueEnergy2017.h:11
if(dump)
const Cut Energy
caf::Proxy< float > hitsperplane
Definition: SRProxy.h:1046
const Cut kNue2017FDPeripheral
Definition of the FD peripheral sample around our core selected events.
Definition: NueCuts2017.h:152
caf::StandardRecord * sr
const Cut kNueDQ2017LID([](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;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx<=5||sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity<=5) return false;if(sr->vtx.elastic.fuzzyk.png[0].shwlid.gap > 100) return false; if(sr->vtx.elastic.fuzzyk.nshwlid >=2){if((sr->vtx.elastic.fuzzyk.png[0].shwlid.dir). Dot(sr->vtx.elastic.fuzzyk.png[1].shwlid.dir)< -0.95) return false;}float xyhitdiff=abs(sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx-sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity);float xyhitsum=sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx+sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;if(xyhitdiff/xyhitsum >=0.4) return false;float nhitall=0.0;for(unsigned int j=0;j< sr->vtx.elastic.fuzzyk.nshwlid;j++){nhitall+=sr->vtx.elastic.fuzzyk.png[j].shwlid.nhit;}if(nhitall/sr->slc.nhit<=0.7) return false;return true;})
Definition: NueCuts2017.h:31
const Cut kNue2017NDFrontPlanes
No hits in the first 5 planes of the detector, doc 12879.
const double j
Definition: BetheBloch.cxx:29
bool kNue2017BasicPartFunc(const caf::SRProxy *sr)
Definition: NueCuts2017.cxx:12
caf::Proxy< float > closestsliceminfromtop
Definition: SRProxy.h:1299
const Cut kNue2017PeripheralPresel
Definition: NueCuts2017.h:110
const Var kNue2017SelectionBin([](const caf::SRProxy *sr){bool isPeri=kNue2017FDPeripheral(sr);if(isPeri) return float(3.5);if(kCVNe(sr) > 0.75 &&kCVNe(sr)< 0.87) return float(0.5);if(kCVNe(sr) > 0.87 &&kCVNe(sr)< 0.95) return float(1.5);if(kCVNe(sr) > 0.95) return float(2.5);return float(-0.5);})
Definition: NueCuts2017.h:310
const Var kNue2017AnaBin([](const caf::SRProxy *sr){int selBin=kNue2017SelectionBin(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;return anaBin;})
Definition: NueCuts2017.h:311
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
caf::Proxy< float > closestslicemindist
Definition: SRProxy.h:1294
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
const Cut kNue2017NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){TVector3 start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;TVector3 stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -170.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()) > 170.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;}return true;})
Loose containtment on start and end of all showers, docdb-12943.
Definition: NueCuts2017.h:259
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
assert(nhit_max >=nhit_nbins)
const Cut kNearestSliceCosRejCoreSideband([](const caf::SRProxy *sr){if(kCVNe(sr) > 0.5 &&kCVNe(sr)< 0.87){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&& sr->slc.closestsliceminfromtop< 400 &&sr->slc.closestslicemindist< 500.);}if(kCVNe(sr) > 0.87){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&&sr->slc.closestsliceminfromtop< 50 &&sr->slc.closestslicemindist< 500.);}return false;})
CosRej for the core sidebands.
Definition: NueCuts2017.h:232
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
T min(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const Cut kNearestSliceCosRejPeripheralSideband([](const caf::SRProxy *sr){return!(sr->slc.closestslicetime >-100.&&sr->slc.closestslicetime< 100.&& sr->slc.closestsliceminfromtop< 50 &&sr->slc.closestslicemindist< 500.);})
Definition: NueCuts2017.h:180
caf::Proxy< bool > keep
Definition: SRProxy.h:1205
const Cut kNue2017NDFiducial([](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;})
Cut on ND vertex position.
Definition: NueCuts2017.h:256