NCPi0SemiIncCuts.h
Go to the documentation of this file.
1 #pragma once
2 #include "CAFAna/Core/Cut.h"
4 #include "CAFAna/Vars/Vars.h"
6 
8 
9 
10 #include "TMath.h"
11 #include "TVector3.h"
12 #include "TParticlePDG.h"
13 
14 namespace ana
15 {
16 
17  const Cut kIs1Vtx ([](const caf::SRProxy* sr)
18  {
19  if( sr->mc.nnu == 0)return false;
20  if (sr->vtx.nelastic == 0) return false;
21  assert(sr->mc.nnu == 1);
22  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
23  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
24 
25  return (sr->vtx.nelastic==1);
26  });
27 
28  const Cut kIs2Prongs ([](const caf::SRProxy* sr)
29  {
30 
31  if(sr->mc.nnu==0) return false;
32  if(sr->vtx.nelastic==0) return false;
33  assert(sr->mc.nnu == 1);
34  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
35  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
36 
37  return (sr->vtx.elastic[0].fuzzyk.npng == 2 );
38  });
39 
40 
41  const Cut kVtxInFiducial([](const caf::SRProxy* sr){
42 
43  if(sr->mc.nnu==0) return false;
44  if(sr->vtx.nelastic==0) return false;
45  assert(sr->mc.nnu == 1);
46  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
47  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
48 
49  if (sr->vtx.elastic[0].vtx.x < -130) return false;
50  if (sr->vtx.elastic[0].vtx.x > 160) return false;
51  if (sr->vtx.elastic[0].vtx.y < -150) return false;
52  if (sr->vtx.elastic[0].vtx.y > 120) return false;
53  if (sr->vtx.elastic[0].vtx.z < 225) return false;
54  if (sr->vtx.elastic[0].vtx.z > 950) return false;
55 
56  return true;
57  });
58 
59 
60  const Cut kShwStopContainment([](const caf::SRProxy* sr)
61  {
62  if(sr->mc.nnu==0) return false;
63  if(sr->vtx.nelastic==0) return false;
64  assert(sr->mc.nnu == 1);
65  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
66  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
67 
68 
69  for (unsigned int i=0; i< sr->vtx.elastic[0].fuzzyk.nshwlid; i++){
70 
71  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.x) < -130.0) return false;
72  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.x) > 140.0) return false;
73  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.y) < -150.0) return false;
74  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.y) > 150.0) return false;
75  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.z) < 300.0) return false;
76  if ((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.z) > 1025.0) return false;
77  }
78  return true;
79  });
80 
81 
82 
83 
84  const SpillTruthCut kIsMyNumuST([](const caf::SRNeutrinoProxy* nu)
85  {
86  return(nu->pdg == 14 && nu->pdgorig == 14);
87  });
88 
89  const Cut kIsMyNumu = CutFromSpillTruthCut(kIsMyNumuST);
90 
91  const SpillTruthCut kIsMyNueST([](const caf::SRNeutrinoProxy* nu)
92  {
93  return(nu->pdg == 12 && nu->pdgorig == 12);
94  });
95 
96  const Cut kIsMyNue = CutFromSpillTruthCut(kIsMyNueST);
97 
98  const SpillTruthCut kIsNCurrentST([](const caf::SRNeutrinoProxy* nu)
99  {
100 
101  return(nu->iscc == 0);
102  });
103 
104  const Cut kIsNCurrent = CutFromSpillTruthCut(kIsNCurrentST);
105 
106 
107  const SpillTruthCut kIsCCurrentST([](const caf::SRNeutrinoProxy* nu)
108  {
109 
110  return(nu->iscc == 1);
111  });
112 
113  const Cut kIsCCurrent = CutFromSpillTruthCut(kIsCCurrentST);
114 
115  const SpillTruthCut kIsPi0ST([](const caf::SRNeutrinoProxy* nu)
116  {
117  float MassOfPi0=0.135;
118  float kinetic=-10;
119  float en = -99;
120 
121  if(nu->prim.size() == 0) return false;
122 
123  //int countpi=0;
124  //float maximum=0;
125  int nbofprim=nu->prim.size();
126 
127  for(int i = 0; i < nbofprim; i++){
128  if(nu->prim[i].pdg == 111){
129  en= nu->prim[i].p.E;
130  kinetic = en - MassOfPi0;
131  }
132  }
133  if(kinetic > 0.1) return true;
134  return false;
135 
136  });
137 
138  const Cut kIsPi0 = CutFromSpillTruthCut(kIsPi0ST);
139 
140  const SpillTruthCut kIsAllPi0ST([](const caf::SRNeutrinoProxy* nu)
141  {
142  float MassOfPi0=0.135;
143  float kinetic=-10;
144  float en = -99;
145 
146  if(nu->prim.size() == 0) return false;
147 
148  //int countpi=0;
149  //float maximum=0;
150  int nbofprim=nu->prim.size();
151 
152  for(int i = 0; i < nbofprim; i++){
153  if(nu->prim[i].pdg == 111){
154  en= nu->prim[i].p.E;
155  kinetic = en - MassOfPi0;
156  }
157  }
158  if(kinetic > 0.0) return true;
159  return false;
160 
161  });
162 
163  const Cut kIsAllPi0 = CutFromSpillTruthCut(kIsAllPi0ST);
164 
165 
166  const Cut kIsReMId ([](const caf::SRProxy* sr)
167  {
168  if(sr->mc.nnu == 0) return false;
169  if(sr->vtx.nelastic == 0) return false;
170  assert(sr->mc.nnu == 1);
171  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
172  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
173  if(sr->sel.remid.pid < 0) return false;
174  return (sr->sel.remid.pid < 0.36);
175  });
176 
177 
178  const TVector3 vtxmin(-130,-150,225);
179  const TVector3 vtxmax(160,120,950);
180 
181  const SpillTruthCut kTrueFiducialST([]
182  (const caf::SRNeutrinoProxy* sr){
183  return (sr->vtx.X() < vtxmax.X() &&
184  sr->vtx.X() > vtxmin.X() &&
185  sr->vtx.Y() < vtxmax.Y() &&
186  sr->vtx.Y() > vtxmin.Y() &&
187  sr->vtx.Z() < vtxmax.Z() &&
188  sr->vtx.Z() > vtxmin.Z() );
189  });
190 
191 
192  const Cut kTrueVtxInFiducial = CutFromSpillTruthCut(kTrueFiducialST);
193 
194 
195  const SpillTruthCut kModeDIS ([] (const caf::SRNeutrinoProxy* sr)
196  {
197 
198  return (sr->mode==caf::kDIS);
199 
200  });
201 
202  const Cut kModeTypeDIS = CutFromSpillTruthCut(kModeDIS);
203 
204  const SpillTruthCut kModeRES([](const caf::SRNeutrinoProxy* sr)
205  {
206 
207  return (sr->mode==caf::kRes);
208 
209  });
210 
211  const Cut kModeTypeRES = CutFromSpillTruthCut(kModeRES);
212 
213 
214  const SpillTruthCut kModeCOH([](const caf::SRNeutrinoProxy* sr)
215  {
216 
217  return (sr->mode==caf::kCoh);
218  });
219 
220  const Cut kModeTypeCOH = CutFromSpillTruthCut(kModeCOH);
221 
222 
223  const SpillTruthCut kModeQE([](const caf::SRNeutrinoProxy* sr)
224  {
225 
226  return (sr->mode==caf::kQE);
227 
228  });
229 
230  const Cut kModeTypeQE = CutFromSpillTruthCut(kModeQE);
231 
232  const Cut kcut15hits([](const caf::SRProxy* sr){
233 
234  if(sr->mc.nnu==0) return false;
235  assert(sr->mc.nnu == 1);
236  if(sr->vtx.nelastic == 0) return false;
237  if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;
238  if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;
239 
240  float hit;
241  hit=sr->slc.nhit;
242  if (hit>15) return true;
243 
244  return false;
245  });
246 
247 
248  const Cut ktMC( [](const caf::SRProxy* sr){
249  if(sr->hdr.ismc) return true;
250  return false;
251  });
252 
253  //Since we consider "Neutrino induced" NC interactions so, neutrino can be numu or nue in forward horn current beam
254  const SpillTruthCut kIsMyNeutrinoST = (kIsMyNumuST||kIsMyNueST);
255  const Cut kIsMyNeutrino = (kIsMyNumu||kIsMyNue);
256 
257 
259  const Cut kIsSigDef = kIsMyNeutrino && kIsNCurrent && kIsPi0;
260 
261  //Signal in true fiducial
262  const SpillTruthCut kIsSignalST = kIsMyNeutrinoST && kIsNCurrentST && kIsPi0ST && kTrueFiducialST;
263  const Cut kIsSignal = kIsMyNeutrino && kIsNCurrent && kIsPi0 && kTrueVtxInFiducial;
264 
265  //Signal without kinmetic constraints, to be used in resolution studies where we don't apply anu cut on trueKE of a pi0
266  const SpillTruthCut kIsSignalNoEnThrsST = kIsMyNeutrinoST && kIsNCurrentST && kIsAllPi0ST && kTrueFiducialST;
267  const Cut kIsSignalNoEnThrs = kIsMyNeutrino && kIsNCurrent && kIsAllPi0 && kTrueVtxInFiducial;
268 
269 
270  //Total background
272  const Cut kIsBkg = !kIsSignal;
273 
274  //Signal with interaction types. PreSel cuts are not included in these defs.
275  const Cut kIsRESSignal = kIsSignal && kModeTypeRES;
276  const Cut kIsDISSignal = kIsSignal && kModeTypeDIS;
277  const Cut kIsOtherSignal = kIsSignal && !(kModeTypeDIS && kModeTypeRES);
278 
279  //Bkg with interaction types. PreSel cuts are not included in these defs.
280  const Cut kIsNCBkg = kIsBkg && kIsNCurrent;
281  const Cut kIsCCBkg = kIsBkg && kIsCCurrent;
282  const Cut kIsRESBkg = kIsBkg && kModeTypeRES;
283  const Cut kIsDISBkg = kIsBkg && kModeTypeDIS;
284  const Cut kIsOtherBkg = kIsBkg && !(kModeTypeDIS && kModeTypeRES);
285  const Cut kIsCCRESBkg = kIsBkg && kIsCCurrent && kModeTypeRES;
286  const Cut kIsNCRESBkg = kIsBkg && kIsNCurrent && kModeTypeRES;
287  const Cut kIsCCDISBkg = kIsBkg && kIsCCurrent && kModeTypeDIS;
288  const Cut kIsNCDISBkg = kIsBkg && kIsNCurrent && kModeTypeDIS;
289  const Cut kIsCCOtherBkg = kIsBkg && kIsCCurrent && !(kModeTypeDIS && kModeTypeRES);
290  const Cut kIsNCOtherBkg = kIsBkg && kIsNCurrent && !(kModeTypeDIS && kModeTypeRES);
291 
292 
293  struct SelDef{
296  };
297 
298  const int knumcutflow = 5;
299  const int knumchns = 18;
300 
302  {"Fid", kIs1Vtx && kVtxInFiducial },
303  {"Cont", kIs1Vtx && kVtxInFiducial && kShwStopContainment},
304  {"Pngs", kIs1Vtx && kVtxInFiducial && kShwStopContainment && kIs2Prongs},
305  {"Remid", kIs1Vtx && kVtxInFiducial && kShwStopContainment && kIs2Prongs && kIsReMId},
306  {"PreSel", kIsPreSel},
307  };
308 
309  const SelDef chns[knumchns] = {
310  {"TotMC", ktMC},
311  {"Sigall", ktMC && kIsSignalNoEnThrs},
312  {"Sig", ktMC && kIsSignal},
313  {"RESSig", ktMC && kIsRESSignal},
314  {"DISSig", ktMC && kIsDISSignal},
315  {"OthrSig", ktMC && kIsOtherSignal},
316  {"Bkg", ktMC && kIsBkg},
317  {"CCBkg", ktMC && kIsCCBkg },
318  {"NCBkg", ktMC && kIsNCBkg },
319  {"CCRESBkg", ktMC && kIsCCRESBkg},
320  {"NCRESBkg", ktMC && kIsNCRESBkg},
321  {"CCDISBkg", ktMC && kIsCCDISBkg},
322  {"NCDISBkg", ktMC && kIsNCDISBkg},
323  {"CCOtherBkg", ktMC && kIsCCOtherBkg},
324  {"NCOtherBkg", ktMC && kIsNCOtherBkg },
325  {"RESBkg", ktMC && kIsRESBkg },
326  {"DISBkg", ktMC && kIsDISBkg},
327  {"OthrBkg", ktMC && kIsOtherBkg},
328  };
329 
330 
331 
332 
333 }//end of namespace
const int knumcutflow
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
const Cut kIsPi0
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kIsNCOtherBkg
const SpillTruthCut kIsNCurrentST([](const caf::SRNeutrinoProxy *nu){return(nu->iscc==0);})
const Cut kIs1Vtx([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->vtx.nelastic==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;return(sr->vtx.nelastic==1);})
const Cut ktMC([](const caf::SRProxy *sr){if(sr->hdr.ismc) return true;return false;})
const SelDef cut_flow[knumcutflow]
const SpillTruthCut kIsSignalNoEnThrsST
const Cut kIsSigDef
const Cut kcut15hits([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.nelastic==0) return false;if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;float hit;hit=sr->slc.nhit;if(hit >15) return true;return false;})
const SelDef chns[knumchns]
const TVector3 vtxmin(-130,-176, 225)
const Cut kIsDISSignal
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kIsSignalNoEnThrs
const SpillTruthCut kModeDIS([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kDIS);})
const Cut kModeTypeRES
caf::Proxy< float > pid
Definition: SRProxy.h:1136
const SpillTruthCut kIsMyNueST([](const caf::SRNeutrinoProxy *nu){return(nu->pdg==12 &&nu->pdgorig==12);})
caf::Proxy< int > mode
Definition: SRProxy.h:543
const SpillTruthCut kIsPi0ST([](const caf::SRNeutrinoProxy *truth){return(!truth->iscc && truth->pdg==111 && truth->pdgorig==111);})
const NuTruthCut kTrueFiducialST([](const caf::SRNeutrinoProxy *sr){return(sr->vtx.X()< vtxmax.X()&& sr->vtx.X() > vtxmin.X()&& sr->vtx.Y() > vtxmin.Y()&& sr->vtx.Y()< vtxmax.Y()&& sr->vtx.Z() > vtxmin.Z()&& sr->vtx.Z()< vtxmax.Z());})
Definition: NumuCCIncCuts.h:31
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
const SpillTruthCut kModeRES([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kRes);})
const Cut kIsBkgNoEnThrs
const Cut kIsCCBkg
const Cut kIsNCRESBkg
const int knumchns
const SpillTruthCut kIsMyNeutrinoST
const SpillTruthCut kModeQE([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kQE);})
const Cut kIsNCBkg
const Cut kIsOtherBkg
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:573
const Cut kIsCCDISBkg
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const SpillTruthCut kIsSignalST
const Cut kIsDISBkg
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const Cut kIsNCDISBkg
caf::Proxy< float > z
Definition: SRProxy.h:108
if(dump)
const Cut kShwStopContainment([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->vtx.nelastic==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;for(unsigned int i=0;i< sr->vtx.elastic[0].fuzzyk.nshwlid;i++){if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.x)< -180.0) return false;if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.x) > 180.0) return false;if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.y)< -180.0) return false;if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.y) > 180.0) return false;if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.z)< 200.0) return false;if((sr->vtx.elastic[0].fuzzyk.png[i].shwlid.stop.z) > 1200.0) return false;}return true;})
const SpillTruthCut kIsMyNumuST([](const caf::SRNeutrinoProxy *nu){return(nu->pdg==14 &&nu->pdgorig==14);})
const Cut kModeTypeDIS
caf::Proxy< float > x
Definition: SRProxy.h:106
const SpillTruthCut kIsCCurrentST([](const caf::SRNeutrinoProxy *nu){return(nu->iscc==1);})
caf::Proxy< bool > iscc
Definition: SRProxy.h:538
const Cut kIsRESSignal
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
const SpillTruthCut kModeCOH([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kCoh);})
caf::StandardRecord * sr
const Cut kIsCCRESBkg
const Cut kIsNCurrent
caf::Proxy< caf::SRRemid > remid
Definition: SRProxy.h:1269
const Cut kIsPreSel
Definition: ncpi0Cuts.h:1099
const SpillTruthCut kIsAllPi0ST([](const caf::SRNeutrinoProxy *nu){float MassOfPi0=0.135;float kinetic=-10;float en=-99;if(nu->prim.size()==0) return false; int nbofprim=nu->prim.size();for(int i=0;i< nbofprim;i++){if(nu->prim[i].pdg==111){en=nu->prim[i].p.E;kinetic=en-MassOfPi0;}}if(kinetic > 0.0) return true;return false;})
const Cut kIs2Prongs([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->vtx.nelastic==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;return(sr->vtx.elastic[0].fuzzyk.npng==2);})
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const Cut kIsMyNumu
const Cut kIsAllPi0
caf::Proxy< short int > pdgorig
Definition: SRProxy.h:553
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
caf::Proxy< float > y
Definition: SRProxy.h:107
const Cut kIsOtherSignal
const Cut kIsMyNeutrino
Definition: structs.h:12
const Cut kVtxInFiducial([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->vtx.nelastic==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;if(sr->vtx.elastic[0].vtx.x< -80) return false;if(sr->vtx.elastic[0].vtx.x > 120) return false;if(sr->vtx.elastic[0].vtx.y< -148) return false;if(sr->vtx.elastic[0].vtx.y > 60) return false;if(sr->vtx.elastic[0].vtx.z< 225) return false;if(sr->vtx.elastic[0].vtx.z > 950) return false;return true;})
const Cut kTrueVtxInFiducial
caf::Proxy< bool > ismc
Definition: SRProxy.h:242
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
const Cut kModeTypeQE
assert(nhit_max >=nhit_nbins)
const Cut kModeTypeCOH
const Cut kIsCCOtherBkg
caf::Proxy< short int > pdg
Definition: SRProxy.h:552
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
Template for Cut and SpillCut.
Definition: Cut.h:15
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const TVector3 vtxmax(160, 160, 1000)
std::string name
const Cut kIsMyNue
#define for
Definition: msvc_pragmas.h:3
const Cut kIsSignal
Definition: ncpi0Cuts.h:1094
const Cut kIsRESBkg
caf::Proxy< std::vector< caf::SRTrueParticle > > prim
Definition: SRProxy.h:555
const Cut kIsBkg
const Cut kIsCCurrent
const Cut kIsReMId([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;if(sr->vtx.nelastic==0) return false;assert(sr->mc.nnu==1);if(sr->vtx.elastic[0].fuzzyk.nshwlid==0) return false;if(sr->vtx.elastic[0].fuzzyk.npng==0) return false;return(sr->sel.remid.pid< 0.36);})
enum BeamMode string