All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NueCuts.cxx
Go to the documentation of this file.
3 
4 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
5 
7 
8 namespace ana{
9 
10  // Basic reconstruction
11  const Cut kRecoShower(
12  [](const caf::SRSliceProxy* slc)
13  {
14  const int largestShwIdx(kLargestRecoShowerIdx(slc));
15  if ( largestShwIdx==-1 )
16  return false;
17 
18  return ( slc->reco.shw[largestShwIdx].bestplane_energy > 0.f && // nothing is terribly wrong
19  slc->reco.shw[largestShwIdx].bestplane_dEdx > 0.f &&
20  slc->reco.shw[largestShwIdx].conversion_gap > 0.f );
21  }
22  );
23 
24  // Basic reconstruction
25  const Cut kNueBasicCut(
26  [](const caf::SRSliceProxy* slc)
27  {
28  const int largestShwIdx(kLargestRecoShowerIdx(slc));
29  if ( largestShwIdx==-1 )
30  return false;
31 
32  return (slc->reco.shw[largestShwIdx].bestplane_energy > 0.2f &&
33  slc->reco.shw[largestShwIdx].bestplane_dEdx < 3 &&
34  slc->reco.shw[largestShwIdx].conversion_gap < 3 );
35  }
36  );
37 
38  const Cut kShowerEnergyCut(
39  [](const caf::SRSliceProxy* slc)
40  {
41  const int largestShwIdx(kLargestRecoShowerIdx(slc));
42  if ( largestShwIdx==-1 )
43  return false;
44 
45  return (slc->reco.shw[largestShwIdx].bestplane_energy > 0.2f );
46  }
47  );
48 
49  const Cut kShowerdEdxCut(
50  [](const caf::SRSliceProxy* slc)
51  {
52  const int largestShwIdx(kLargestRecoShowerIdx(slc));
53  if ( largestShwIdx==-1 )
54  return false;
55 
56  return (slc->reco.shw[largestShwIdx].bestplane_dEdx < 3.625f);
57  }
58  );
59 
60  const Cut kShowerConvGapCut(
61  [](const caf::SRSliceProxy* slc)
62  {
63  const int largestShwIdx(kLargestRecoShowerIdx(slc));
64  if ( largestShwIdx==-1 )
65  return false;
66 
67  return (slc->reco.shw[largestShwIdx].conversion_gap < 3.25f);
68  }
69  );
70 
71  // Basic reconstruction
72  const Cut kNueNumShowersCut(
73  [](const caf::SRSliceProxy* slc)
74  {
75  return ((unsigned int)kRecoShowers_EnergyCut(slc) == 1);
76  }
77  );
78 
79  const Cut kNueHasTrackCut(
80  [](const caf::SRSliceProxy* slc)
81  {
82  return slc->reco.ntrk > 0;
83  }
84  );
85 
87  [](const caf::SRSliceProxy* slc)
88  {
89  const int longestTrackIdx(kLongestTrackIdx(slc));
90  if (longestTrackIdx == -1)
91  return true;
92  return PtInVol(slc->reco.trk[longestTrackIdx].end, fvndExit);
93  }
94  );
95 
96  const Cut kNueTrackLenCut(
97  [](const caf::SRSliceProxy* slc)
98  {
99  return kLongestTrackLength(slc) < 110.f;
100  }
101  );
102 
103  const Cut kNueMuonCut(
104  [](const caf::SRSliceProxy* slc)
105  {
106  return (kLongestTrackLength(slc) < 80.f || kLongestTrackChi2Muon(slc) > 30.f || kLongestTrackChi2Proton(slc) < 60.f);
107  }
108  );
109 
110  const Cut kShowerDensityCut(
111  [](const caf::SRSliceProxy* slc)
112  {
113  const int largestShwIdx(kLargestRecoShowerIdx(slc));
114  if ( largestShwIdx==-1 )
115  return false;
116 
117  return (slc->reco.shw[largestShwIdx].density > 4.5);
118  }
119  );
120 
121  const Cut kShowerOpenAngleCut(
122  [](const caf::SRSliceProxy* slc)
123  {
124  return kRecoShower_OpenAngle(slc) < 12.f;
125  }
126  );
127 
130 
133 
135  [](const caf::SRSliceProxy* slc)
136  {
137  for (auto const& trk : slc->reco.trk)
138  {
139  if (trk.dazzle.pdg==13)
140  return false;
141  }
142  return true;
143  }
144  );
145 
147  [](const caf::SRSliceProxy* slc)
148  {
149  for (auto const& trk : slc->reco.trk)
150  {
151  if (trk.dazzle.muonScore > 0.8)
152  return false;
153  }
154  return true;
155  }
156  );
157 
158  // // Cut currently not working as it wants a caf::SRProxy and not caf::SRSliceProxy
159  // // Workaround is definiting it with the explicit branch i.e. slc->reco.shw[0].start.z instead of kRecoShower_StartZ
160  // const Cut kNueContainedFD(
161  // [](const caf::SRSliceProxy* slc){
162 
163  // bool xstart = (avfd_cryo1_cryo1.xmin < kRecoShower_StartX) && (kRecoShower_StartX < avfd_cryo1_cryo1.xmax);
164  // bool xend = (avfd_cryo1_cryo1.xmin < kRecoShower_EndX) && (kRecoShower_EndX < avfd_cryo1_cryo1.xmax);
165 
166  // bool ystart = (avfd_cryo1_cryo1.ymin < kRecoShower_StartY) && (kRecoShower_StartY < avfd_cryo1_cryo1.ymax);
167  // bool yend = (avfd_cryo1_cryo1.ymin < kRecoShower_EndY) && (kRecoShower_EndY < avfd_cryo1_cryo1.ymax);
168 
169  // bool zstart = (avfd_cryo1_cryo1.zmin < kRecoShower_StartZ) && (kRecoShower_StartZ < avfd_cryo1_cryo1.zmax);
170  // bool zend = (avfd_cryo1_cryo1.zmin < kRecoShower_EndZ) && (kRecoShower_EndZ < avfd_cryo1_cryo1.zmax);
171 
172  // return (xstart && xend && ystart && yend && zstart && zend);
173  // }
174  // );
175 
176  // TODO: find a better way to set the AV so we do not need to replicate code
177  // shw.end ha been added to the CAF so should be trivial for future iterations
178  const Cut kNueContainedND(
179  [](const caf::SRSliceProxy* slc){
180 
181  const int largestShwIdx(kLargestRecoShowerIdx(slc));
182  if ( largestShwIdx==-1 )
183  return false;
184 
185  double this_endx = slc->reco.shw[largestShwIdx].start.x + (slc->reco.shw[largestShwIdx].dir.x * slc->reco.shw[largestShwIdx].len);
186  double this_endy = slc->reco.shw[largestShwIdx].start.y + (slc->reco.shw[largestShwIdx].dir.y * slc->reco.shw[largestShwIdx].len);
187  double this_endz = slc->reco.shw[largestShwIdx].start.z + (slc->reco.shw[largestShwIdx].dir.z * slc->reco.shw[largestShwIdx].len);
188 
189  bool startx = (fvndAbs.xmin < std::abs(slc->reco.shw[largestShwIdx].start.x)) && (std::abs(slc->reco.shw[largestShwIdx].start.x) < fvndAbs.xmax);
190  bool endx = (fvndAbs.xmin < std::abs(this_endx)) && (std::abs(this_endx) < fvndAbs.xmax);
191 
192  bool starty = (fvndAbs.ymin < slc->reco.shw[largestShwIdx].start.y) && (slc->reco.shw[largestShwIdx].start.y < fvndAbs.ymax);
193  bool endy = (fvndAbs.ymin < this_endy) && (this_endy < fvndAbs.ymax);
194 
195  bool startz = (fvndAbs.zmin < slc->reco.shw[largestShwIdx].start.z) && (slc->reco.shw[largestShwIdx].start.z < fvndAbs.zmax);
196  bool endz = (fvndAbs.zmin < this_endz) && (this_endz < fvndAbs.zmax);
197 
198  return (startx && endx && starty && endy && startz && endz);
199  }
200  );
201 
202  const Cut kNueContainedFD(
203  [](const caf::SRSliceProxy* slc){
204 
205  const int largestShwIdx(kLargestRecoShowerIdx(slc));
206  if ( largestShwIdx==-1 )
207  return false;
208 
209  double this_endx = slc->reco.shw[largestShwIdx].start.x + (slc->reco.shw[largestShwIdx].dir.x * slc->reco.shw[largestShwIdx].len);
210  double this_endy = slc->reco.shw[largestShwIdx].start.y + (slc->reco.shw[largestShwIdx].dir.y * slc->reco.shw[largestShwIdx].len);
211  double this_endz = slc->reco.shw[largestShwIdx].start.z + (slc->reco.shw[largestShwIdx].dir.z * slc->reco.shw[largestShwIdx].len);
212 
213 
214  bool startx = (fvfd_cryo1.xmin < slc->reco.shw[largestShwIdx].start.x) && (slc->reco.shw[largestShwIdx].start.x < fvfd_cryo1.xmax);
215  bool endx = (fvfd_cryo1.xmin < this_endx) && (this_endx < fvfd_cryo1.xmax);
216 
217  bool starty = (fvfd_cryo1.ymin < slc->reco.shw[largestShwIdx].start.y) && (slc->reco.shw[largestShwIdx].start.y < fvfd_cryo1.ymax);
218  bool endy = (fvfd_cryo1.ymin < this_endy) && (this_endy < fvfd_cryo1.ymax);
219 
220  bool startz = (fvfd_cryo1.zmin < slc->reco.shw[largestShwIdx].start.z) && (slc->reco.shw[largestShwIdx].start.z < fvfd_cryo1.zmax);
221  bool endz = (fvfd_cryo1.zmin < this_endz) && (this_endz < fvfd_cryo1.zmax);
222 
223  return (startx && endx && starty && endy && startz && endz);
224  }
225  );
226 
227 }
const FidVol fvndExit
const Cut kShowerConvGapCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].conversion_gap< 3.25f);})
Definition: NueCuts.h:22
const Var kRecoShower_OpenAngle([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?180.*shw->open_angle/M_PI:-5.;})
Definition: NueVars.h:16
then if[["$THISISATEST"==1]]
Definition: neoSmazza.sh:95
const Cut kShowerDensityCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].density > 4.5);})
Definition: NueCuts.h:23
const Cut kNueContainedFD([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;double this_endx=slc->reco.shw[largestShwIdx].start.x+(slc->reco.shw[largestShwIdx].dir.x *slc->reco.shw[largestShwIdx].len);double this_endy=slc->reco.shw[largestShwIdx].start.y+(slc->reco.shw[largestShwIdx].dir.y *slc->reco.shw[largestShwIdx].len);double this_endz=slc->reco.shw[largestShwIdx].start.z+(slc->reco.shw[largestShwIdx].dir.z *slc->reco.shw[largestShwIdx].len);bool startx=(fvfd_cryo1.xmin< slc->reco.shw[largestShwIdx].start.x)&&(slc->reco.shw[largestShwIdx].start.x< fvfd_cryo1.xmax);bool endx=(fvfd_cryo1.xmin< this_endx)&&(this_endx< fvfd_cryo1.xmax);bool starty=(fvfd_cryo1.ymin< slc->reco.shw[largestShwIdx].start.y)&&(slc->reco.shw[largestShwIdx].start.y< fvfd_cryo1.ymax);bool endy=(fvfd_cryo1.ymin< this_endy)&&(this_endy< fvfd_cryo1.ymax);bool startz=(fvfd_cryo1.zmin< slc->reco.shw[largestShwIdx].start.z)&&(slc->reco.shw[largestShwIdx].start.z< fvfd_cryo1.zmax);bool endz=(fvfd_cryo1.zmin< this_endz)&&(this_endz< fvfd_cryo1.zmax);return(startx &&endx &&starty &&endy &&startz &&endz);})
Definition: NueCuts.h:34
const Var kLongestTrackChi2Proton([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_proton):-5.;})
Definition: NueVars.h:38
process_name opflashCryoW ana
const Cut kShowerEnergyCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].bestplane_energy > 0.2f);})
Definition: NueCuts.h:20
const Var kRecoShowers_EnergyCut([](const caf::SRSliceProxy *slc) -> unsigned{unsigned int counter(0);for(auto const &shw:slc->reco.shw){++counter;}return counter;})
Definition: NueVars.h:31
const Var kLongestTrackDazzleMuonScore([](const caf::SRSliceProxy *slc) -> float{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?(float) trk->dazzle.muonScore:-5.f;})
Definition: NueVars.h:43
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
const Cut kShowerRazzleElectronScoreCut
Definition: NueCuts.cxx:129
const FidVol fvfd_cryo1
const Cut kNueAllTrackDazzleMuonCut([](const caf::SRSliceProxy *slc){for(auto const &trk:slc->reco.trk){return false;}return true;})
Definition: NueCuts.h:30
T abs(T value)
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
const Cut kNueContainedND([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;double this_endx=slc->reco.shw[largestShwIdx].start.x+(slc->reco.shw[largestShwIdx].dir.x *slc->reco.shw[largestShwIdx].len);double this_endy=slc->reco.shw[largestShwIdx].start.y+(slc->reco.shw[largestShwIdx].dir.y *slc->reco.shw[largestShwIdx].len);double this_endz=slc->reco.shw[largestShwIdx].start.z+(slc->reco.shw[largestShwIdx].dir.z *slc->reco.shw[largestShwIdx].len);bool startx=(fvndAbs.xmin< std::abs(slc->reco.shw[largestShwIdx].start.x))&&(std::abs(slc->reco.shw[largestShwIdx].start.x)< fvndAbs.xmax);bool endx=(fvndAbs.xmin< std::abs(this_endx))&&(std::abs(this_endx)< fvndAbs.xmax);bool starty=(fvndAbs.ymin< slc->reco.shw[largestShwIdx].start.y)&&(slc->reco.shw[largestShwIdx].start.y< fvndAbs.ymax);bool endy=(fvndAbs.ymin< this_endy)&&(this_endy< fvndAbs.ymax);bool startz=(fvndAbs.zmin< slc->reco.shw[largestShwIdx].start.z)&&(slc->reco.shw[largestShwIdx].start.z< fvndAbs.zmax);bool endz=(fvndAbs.zmin< this_endz)&&(this_endz< fvndAbs.zmax);return(startx &&endx &&starty &&endy &&startz &&endz);})
Definition: NueCuts.h:33
const Cut kNueMuonCut([](const caf::SRSliceProxy *slc){return(kLongestTrackLength(slc)< 80.f||kLongestTrackChi2Muon(slc) > 30.f||kLongestTrackChi2Proton(slc)< 60.f);})
Definition: NueCuts.h:16
const Cut kNueHasTrackCut([](const caf::SRSliceProxy *slc){return slc->reco.ntrk > 0;})
Definition: NueCuts.h:11
const Var kLargestRecoShowerIdx([](const caf::SRSliceProxy *slc) -> int{int bestIdx(-1);double maxEnergy(-1);for(unsigned int i=0;i< slc->reco.nshw;i++){auto const &shw=slc->reco.shw[i];continue;if(shw.bestplane_energy > maxEnergy){bestIdx=i;maxEnergy=shw.bestplane_energy;}}return bestIdx;})
Definition: NueVars.h:9
const Cut kNueTrackLenCut([](const caf::SRSliceProxy *slc){return kLongestTrackLength(slc)< 110.f;})
Definition: NueCuts.h:13
const Var kRecoShowerRazzlePID([](const caf::SRSliceProxy *slc) -> int{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?(int) shw->razzle.pdg:-5;})
Definition: NueVars.h:44
const Cut kNueBasicCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].bestplane_energy > 0.2f &&slc->reco.shw[largestShwIdx].bestplane_dEdx< 3 &&slc->reco.shw[largestShwIdx].conversion_gap< 3);})
Definition: NueCuts.h:9
const Var kLongestTrackChi2Muon([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_muon):-5.;})
Definition: NueVars.h:35
const Cut kShowerdEdxCut([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].bestplane_dEdx< 3.625f);})
Definition: NueCuts.h:21
const Cut kNueLongestTrackDazzleMuonScoreCut
Definition: NueCuts.cxx:132
const Var kLongestTrackIdx([](const caf::SRSliceProxy *slc) -> int{int bestIdx(-1);double maxLength(-1);for(unsigned int i=0;i< slc->reco.ntrk;i++){auto const &trk=slc->reco.trk[i];continue;if(trk.len > maxLength){bestIdx=i;maxLength=trk.len;}}return bestIdx;})
Definition: NueVars.h:33
const Cut kRecoShower([](const caf::SRSliceProxy *slc){const int largestShwIdx(kLargestRecoShowerIdx(slc));return false;return(slc->reco.shw[largestShwIdx].bestplane_energy > 0.f &&slc->reco.shw[largestShwIdx].bestplane_dEdx > 0.f &&slc->reco.shw[largestShwIdx].conversion_gap > 0.f);})
Definition: NueCuts.h:8
const Cut kShowerOpenAngleCut([](const caf::SRSliceProxy *slc){return kRecoShower_OpenAngle(slc)< 12.f;})
Definition: NueCuts.h:24
const Cut kShowerRazzleElectronCut
Definition: NueCuts.cxx:128
Template for Cut and SpillCut.
Definition: Cut.h:16
const Var kRecoShowerRazzleElectronScore([](const caf::SRSliceProxy *slc) -> float{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?(float) shw->razzle.electronScore:-5.f;})
Definition: NueVars.h:45
const FidVol fvndAbs
const Cut kNueAllTrackDazzleMuonScoreCut([](const caf::SRSliceProxy *slc){for(auto const &trk:slc->reco.trk){return false;}return true;})
Definition: NueCuts.h:31
const Var kLongestTrackDazzlePID([](const caf::SRSliceProxy *slc) -> int{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?(int) trk->dazzle.pdg:-5;})
Definition: NueVars.h:42
bool PtInVol(const caf::SRVector3DProxy &pt, const FidVol &vol)
const Cut kNueTrackContainmentCut([](const caf::SRSliceProxy *slc){const int longestTrackIdx(kLongestTrackIdx(slc));return true;return PtInVol(slc->reco.trk[longestTrackIdx].end, fvndExit);})
Definition: NueCuts.h:12
const Cut kNueNumShowersCut([](const caf::SRSliceProxy *slc){return((unsigned int) kRecoShowers_EnergyCut(slc)==1);})
Definition: NueCuts.h:18
const Var kLongestTrackLength([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?double(trk->len):-5.;})
Definition: NueVars.h:34
const Cut kNueLongestTrackDazzleMuonCut
Definition: NueCuts.cxx:131