SINCpi0_Cuts.h
Go to the documentation of this file.
1 /*Cut definitions for FHC_SINCpi0 analysis.
2  Bryan Ramson, Fermilab PostDoc, bjrams87@fnal.gov, December 2019
3  For use with analysis scripts. Must be compiled for interactive use, or compiled or tarballed for use on grid.
4  Compilation command: $SRT_PUBLIC_CONTEXT/SRT_NOVA/scripts/novasoft_build -t */
5 
6 #pragma once
7 #include "CAFAna/Core/Cut.h"
9 #include "CAFAna/Vars/Vars.h"
11 //#include "NDAna/numucc_inc/NDXSecMuonPID.h"
13 
14 #include "TMath.h"
15 #include "TVector3.h"
16 #include "TParticlePDG.h"
17 
18 namespace ana
19 {
20 
21  /*================================================================================================
22  No Cuts for looking at Raw MC
23  ================================================================================================= */
24 
25  const Cut kNoCuts([](const caf::SRProxy* sr){
26  return true;
27  });
28 
29  /*================================================================================================
30  Base Level MC Truth level cuts.
31  ================================================================================================= */
32 
33  //const SpillTruthCut kTrueNuMuSpill([](const caf::SRNeutrinoProxy* nu){
34  //return(nu->pdg == 14 && nu->pdgorig == 14);
35  //});
36  //const Cut kTrueNuMuInTime = CutFromSpillTruthCut(kTrueNuMuSpill);
37  //const SpillTruthCut kTrueNuESpill([](const caf::SRNeutrinoProxy* nu){
38  //return(nu->pdg == 12 && nu->pdgorig == 12);
39  //});
40  //const Cut kTrueNuEInTime = CutFromSpillTruthCut(kTrueNuESpill);
41  //const SpillTruthCut kCCur([](const caf::SRNeutrinoProxy* nu){
42  // return(nu->iscc == 1);
43  //});
44  //const Cut kTrueCCur = CutFromSpillTruthCut(kCCur);
45  //const Cut kTrueNCur = CutFromSpillTruthCut(!kCCur);
46 
47  const Cut kTrueNuMu([](const caf::SRProxy* sr){
48  if(sr->vtx.elastic.IsValid == false) return false;
49  if(sr->mc.nnu == 0) return false;
50 
51  return(sr->mc.nu[0].pdg == 14);
52  });
53 
54  const Cut kTrueNuE([](const caf::SRProxy* sr){
55  if(sr->vtx.elastic.IsValid == false) return false;
56  if(sr->mc.nnu == 0) return false;
57 
58  return(sr->mc.nu[0].pdg == 12);
59  });
60 
61  const Cut kTrueCCur([](const caf::SRProxy* sr){
62  if(sr->vtx.elastic.IsValid == false) return false;
63  if(sr->mc.nnu == 0) return false;
64  assert(sr->mc.nnu == 1);
65 
66  return (sr->mc.nu[0].iscc == 1);
67  });
68 
69  const Cut kTrueNCur([](const caf::SRProxy *sr){
70  if(sr->vtx.elastic.IsValid == false) return false;
71  if(sr->mc.nnu == 0) return false;
72  assert(sr->mc.nnu == 1);
73 
74  return (sr->mc.nu[0].iscc == 0);
75  });
76 
77  const Cut kTruePi0([](const caf::SRProxy* sr){
78  if(sr->vtx.elastic.IsValid == false) return false;
79  if(sr->mc.nnu == 0) return false;
80  assert(sr->mc.nnu == 1);
81  if(sr->mc.nu[0].prim.size() == 0) return false;
82 
83  float Pi0Mass=0.134977;
84  float KE=-10.0;
85  float TE=-99.0;
86 
87  int nprim=sr->mc.nu[0].prim.size();
88  int npi0 = 0;
89 
90  for(int i=0;i<nprim;i++){
91  if(sr->mc.nu[0].prim[i].pdg == 111){
92  TE=sr->mc.nu[0].prim[i].p.E;
93  KE=pow(pow(TE,2.0)-pow(Pi0Mass,2.0),0.5);
94  if(KE>=0.0) npi0++;
95  }
96  }
97  if(npi0) {return true;}
98  return false;
99  });
100 
101  const Cut kTruePi0100MeV([](const caf::SRProxy* sr){
102  if(sr->vtx.elastic.IsValid == false) return false;
103  if(sr->mc.nnu == 0) return false;
104  assert(sr->mc.nnu == 1);
105  if(sr->mc.nu[0].prim.size() == 0) return false;
106 
107  float Pi0Mass=0.134977;
108  float KE=-10.0;
109  float TE=-99.0;
110 
111  int nprim=sr->mc.nu[0].prim.size();
112  int npi0 = 0;
113 
114  for(int i=0;i<nprim;i++){
115  if(sr->mc.nu[0].prim[i].pdg == 111){
116  TE=sr->mc.nu[0].prim[i].p.E;
117  KE=pow(pow(TE,2.0)-pow(Pi0Mass,2.0),0.5);
118  if(KE>=0.1) npi0++;
119  }
120  }
121  if(npi0) {return true;}
122  return false;
123  });
124  //const Cut kTruePi0Electron([](const caf::SRProxy* sr){
125  // if(sr->vtx.elastic.IsValid == false) return false;
126  // if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
127  // if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
128  // if(sr->mc.nnu == 0) return false;
129  // assert(sr->mc.nnu == 1);
130  // if(sr->mc.nu[0].prim.size() == 0) return false;
131 
132  // int nprim=sr->mc.nu[0].prim.size();
133  // for(int i=0;i<nprim;i++)
134 
135  const Cut kTrueVtxInFiducial([](const caf::SRProxy* sr){
136  if(sr->mc.nnu==0) return false;
137  assert(sr->mc.nnu == 1);
138  if(sr->vtx.elastic.IsValid == false) return false;
139 
140  if (sr->mc.nu[0].vtx.x < -130) return false;
141  if (sr->mc.nu[0].vtx.x > 160) return false;
142  if (sr->mc.nu[0].vtx.y < -150) return false;
143  if (sr->mc.nu[0].vtx.y > 120) return false;
144  if (sr->mc.nu[0].vtx.z < 225) return false;
145  if (sr->mc.nu[0].vtx.z > 950) return false;
146 
147  return true;
148  });
149 
150  const Cut kModeCoh([](const caf::SRProxy* sr){
151  //if(sr->mc.nnu==0) return false;
152  //if(sr->vtx.elastic.IsValid == false) return false;
153 
154  return (sr->mc.nu[0].mode==caf::kCoh); //Coherent
155  });
156 
157  const Cut kModeCohEl([](const caf::SRProxy* sr){
158  //if(sr->mc.nnu==0) return false;
159  //if(sr->vtx.elastic.IsValid == false) return false;
160 
161  return (sr->mc.nu[0].mode==caf::kCohElastic); //Coherent Elastic
162  });
163 
164  const Cut kModeRes([](const caf::SRProxy* sr){
165  //if(sr->mc.nnu==0) return false;
166  //if(sr->vtx.elastic.IsValid == false) return false;
167 
168  return (sr->mc.nu[0].mode==caf::kRes); //Resonant
169  });
170 
171  const Cut kModeQE([](const caf::SRProxy* sr){
172  //if(sr->mc.nnu==0) return false;
173  //if(sr->vtx.elastic.IsValid == false) return false;
174 
175  return (sr->mc.nu[0].mode==caf::kQE); //Quasi-Elastic
176  });
177 
178  const Cut kModeDIS([](const caf::SRProxy* sr){
179  //if(sr->mc.nnu==0) return false;
180  //if(sr->vtx.elastic.IsValid == false) return false;
181 
182  return (sr->mc.nu[0].mode==caf::kDIS); //DIS
183  });
184 
185  const Cut kModeMEC([](const caf::SRProxy* sr){
186  //if(sr->mc.nnu==0) return false;
187  //if(sr->vtx.elastic.IsValid == false) return false;
188 
189  return (sr->mc.nu[0].mode==caf::kMEC); //MEC
190  });
191 
192 
193  /*================================================================================================
194  Quality Cuts
195  ================================================================================================*/
196 
197 
198  /*================================================================================================
199  Reco level cuts.
200  ================================================================================================*/
201 
202  const Cut CVN5LabelMuonIDCut([](const caf::SRProxy* sr){
203  if(sr->vtx.elastic.IsValid == 0) return false;
204  if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
205  float maxscore = -999.9f;
206 
207  for(unsigned int i=0;i<sr->vtx.elastic.fuzzyk.npng;i++) if(maxscore < sr->vtx.elastic.fuzzyk.png[i].spprongcvnpart5label.muonid) maxscore=sr->vtx.elastic.fuzzyk.png[i].spprongcvnpart5label.muonid;
208 
209  return(maxscore<0.25);
210  });
211 
212  const Cut kMuonIDCut([](const caf::SRProxy* sr){
213  if(!(sr->vtx.elastic.IsValid)) return false;
214  // if(sr->mc.nnu == 0) return false;
215  //assert(sr->mc.nnu == 1);
216  //if(sr->mc.nu[0].prim.size() == 0) return false;
217  //if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
218  //if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return false;
219  int bestid = (int)sr->trk.kalman.idxmuonid;
220  int ntracks = (int) sr->trk.kalman.ntracks;
221  if(bestid >= ntracks) return true;
222  if(bestid < 0) return true;
223 
224  return (sr->trk.kalman.tracks[bestid].muonid<0.0);
225  });
226 
227  const Cut CVN2LabelEMIDPngOneCut([](const caf::SRProxy* sr){
228  if(sr->vtx.elastic.IsValid == 0) return false;
229  if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
230  if(sr->vtx.elastic.fuzzyk.npng<1) return false;
231 
232  return(float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpartnumuccemid.emid)>0.5);
233  });
234 
235  const Cut CVN2LabelEMIDPngTwoCut([](const caf::SRProxy* sr){
236  if(sr->vtx.elastic.IsValid == 0) return false;
237  if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
238  if(sr->vtx.elastic.fuzzyk.npng<2) return false;
239 
240  return(float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpartnumuccemid.emid)>0.5);
241  });
242 
243  const Cut CVN5LabelEMIDPngOneCut([](const caf::SRProxy* sr){
244  if(sr->vtx.elastic.IsValid == 0) return false;
245  if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
246  if(sr->vtx.elastic.fuzzyk.npng<1) return false;
247 
248  return((float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpart5label.photonid)+float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpart5label.electronid))>0.5);
249  });
250 
251  const Cut CVN5LabelEMIDPngTwoCut([](const caf::SRProxy* sr){
252  if(sr->vtx.elastic.IsValid == 0) return false;
253  if(sr->vtx.elastic.fuzzyk.npng == 0) return false;
254  if(sr->vtx.elastic.fuzzyk.npng<2) return false;
255 
256  return((float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpart5label.photonid)+float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpart5label.electronid))>0.5);
257  });
258 
259  const Cut kVtxInFiducial([](const caf::SRProxy* sr){
260  if(sr->vtx.elastic.IsValid==0) return false;
261 
262  if(sr->vtx.elastic.vtx.x < -130) return false;
263  if(sr->vtx.elastic.vtx.x > 160) return false;
264  if(sr->vtx.elastic.vtx.y < -150) return false;
265  if(sr->vtx.elastic.vtx.y > 120) return false;
266  if(sr->vtx.elastic.vtx.z < 225) return false;
267  if(sr->vtx.elastic.vtx.z > 950) return false;
268 
269  return true;
270  });
271 
272  const Cut kShwStopContainment([](const caf::SRProxy* sr){
273  if(sr->vtx.elastic.IsValid==false) return false;
274  if(sr->vtx.elastic.fuzzyk.npng==0) return false;
275 
276  for (unsigned int i=0;i<sr->vtx.elastic.fuzzyk.nshwlid; i++){
277  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.x) < -130.0) return false;
278  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.x) > 140.0) return false;
279  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.y) < -150.0) return false;
280  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.y) > 150.0) return false;
281  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.z) < 300.0) return false;
282  if((sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.z) > 1025.0) return false;
283  }
284  return true;
285  });
286 
287  const Cut kOneProng([](const caf::SRProxy* sr){
288  if(sr->vtx.elastic.IsValid==false) return false;
289  if(sr->vtx.elastic.fuzzyk.npng==0) return false;
290 
291  return(sr->vtx.elastic.fuzzyk.npng==1);
292  });
293 
294 
295  const Cut kTwoProng([](const caf::SRProxy* sr){
296  if(sr->vtx.elastic.IsValid==false) return false;
297  if(sr->vtx.elastic.fuzzyk.npng==0) return false;
298 
299  return((sr->vtx.elastic.fuzzyk.npng==2));
300  });
301 
302  const Cut kThreeProng([](const caf::SRProxy* sr){
303  if(sr->vtx.elastic.IsValid==false) return false;
304  if(sr->vtx.elastic.fuzzyk.npng==0) return false;
305 
306  return(sr->vtx.elastic.fuzzyk.npng==3);
307  });
308 
309 
310  /* const Cut kCCurPi0Bkg([](const caf::SRProxy* sr){
311  if(sr->mc.nnu == 0) return false;
312  if(sr->vtx.nelastic == 0) return false;
313  if(sr->mc.nu[0].prim.size() == 0) return false;
314  int nbofprim=sr->mc.nu[0].prim.size();
315  int countpi=0;
316  // bool ispi0=false;
317  for(int i=0;i<nbofprim;i++) if(sr->mc.nu[0].prim[i].pdg==111) countpi++;
318  if (countpi && sr->mc.nu[0].iscc) return true;
319  return false;
320  });
321 
322  const Cut kNCurPi0Bkg([](const caf::SRProxy* sr){
323  if(sr->mc.nnu == 0) return false;
324  if(sr->vtx.nelastic == 0) return false;
325  if(sr->mc.nu[0].prim.size() == 0) return false;
326  int nbofprim=sr->mc.nu[0].prim.size();
327  int countpi=0;
328  // bool ispi0=false;
329  for(int i=0;i<nbofprim;i++) if(sr->mc.nu[0].prim[i].pdg==111) countpi++;
330  if (countpi && !sr->mc.nu[0].iscc) return true;
331  return false;
332  });
333 
334  const Cut kCCurNonPi0Bkg([](const caf::SRProxy* sr){
335  if(sr->mc.nnu == 0) return false;
336  if(sr->vtx.nelastic == 0) return false;
337  if(sr->mc.nu[0].prim.size() == 0) return false;
338  int nbofprim=sr->mc.nu[0].prim.size();
339  int countpi=0;
340  // bool ispi0=false;
341  for(int i=0;i<nbofprim;i++) if(sr->mc.nu[0].prim[i].pdg==111) countpi++;
342  if (!countpi && sr->mc.nu[0].iscc) return true;
343  return false;
344  });
345 
346  const Cut kNCurNonPi0Bkg([](const caf::SRProxy* sr){
347  if(sr->mc.nnu == 0) return false;
348  if(sr->vtx.nelastic == 0) return false;
349  if(sr->mc.nu[0].prim.size() == 0) return false;
350  int nbofprim=sr->mc.nu[0].prim.size();
351  int countpi=0;
352 
353  for(int i=0;i<nbofprim;i++) {
354  if(sr->mc.nu[0].prim[i].pdg == 111)
355  {
356  countpi++;
357  }
358  }
359  if (!countpi && !sr->mc.nu[0].iscc) return true;
360  return false;
361  });
362 
363  */
364  /*=================================================================================================
365  Cut Flow Definition
366  ================================================================================================= */
367 
368 
369  //Signal
374 
375  //Backgrounds
377  const Cut kNCurPi0Bkg = kTrueNCur && kTruePi0 && !kTruePi0100MeV;
380  const Cut kOther = !kSignal && !kCCurPi0Bkg && !kNCurPi0Bkg && !kCCurNonPi0Bkg && !kNCurNonPi0Bkg;
381 
382  //RecoCuts
383 
386  const Cut kContCut = kTwoProng && kVtxInFiducial && kShwStopContainment;
387  const Cut kContCVNMuonCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut;
388  const Cut kContkMuonCut = kTwoProng && kVtxInFiducial && kShwStopContainment && kMuonIDCut;
389  const Cut kPreSel5PngOneCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN5LabelEMIDPngOneCut;
390  const Cut kPreSel5PngTwoCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN5LabelEMIDPngTwoCut;
391  const Cut kPreSel5TwoPngCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN5LabelEMIDPngOneCut && CVN5LabelEMIDPngTwoCut;
392  const Cut kPreSel2PngOneCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN2LabelEMIDPngOneCut;
393  const Cut kPreSel2PngTwoCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN2LabelEMIDPngTwoCut;
394  const Cut kPreSel2TwoPngCut = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut && CVN2LabelEMIDPngOneCut && CVN2LabelEMIDPngTwoCut;
395 
396  const Cut kPreSel = kTwoProng && kVtxInFiducial && kShwStopContainment && CVN5LabelMuonIDCut;
397 
398  struct CutArr{
401  };
402 
403  //const Cut CVNMuonIDBinCut[200];
404  //for(int i=0;i<200;i++) CVNMuonIDBinCut[i] = CVNMuonID < -1.0 + ((i*2)/200.0);
405  //const Cut kPreSelCut[200] = kCont && CVNMuonIDBinCut[200];
406 
407  const int sincpi0_presel_cutflow = 105;
408  const int sincpi0_channel_cutflow = 6;
409  const int ml_sel_array_cutflow = 4;
410 
412  {"true_ncpi0_nocut", kTrueFiduNCPi0}, //0
413 
414  {"nocut", kNoCut}, //1
415  {"true_signal_nocut", kSignal}, //2
416  {"true_bkg_nocut", kBackground}, //3
417  {"true_ccurpi0bkg_nocut", kCCurPi0Bkg}, //4
418  {"true_ncurpi0bkg_nocut", kNCurPi0Bkg}, //5
419  {"true_ccurnonpi0bkg_nocut", kCCurNonPi0Bkg}, //6
420  {"true_ncurnonpi0bkg_nocut", kNCurNonPi0Bkg}, //7
421  {"true_other_nocut", kOther}, //8
422 
423  {"preselcut", kPreSel}, //9
424  {"true_sig_preselcut", kSignal && kPreSel}, //10
425  {"true_bkg_preselcut", kBackground && kPreSel}, //11
426  {"true_ccurpi0bkg_preselcut", kCCurPi0Bkg && kPreSel}, //12
427  {"true_ncurpi0bkg_preselcut", kNCurPi0Bkg && kPreSel}, //13
428  {"true_ccurnonpi0bkg_preselcut", kCCurNonPi0Bkg && kPreSel}, //14
429  {"true_ncurnonpi0bkg_preselcut", kNCurNonPi0Bkg && kPreSel}, //15
430  {"true_other_preselcut", kOther && kPreSel}, //16
431 
432  {"twoprongcut", kTwoProngCut}, //17
433  {"true_sig_twoprongcut", kTwoProngCut && kSignal}, //18
434  {"true_bkg_twoprongcut", kTwoProngCut && kBackground}, //19
435  {"true_ccurpi0bkg_twoprongcut", kTwoProngCut && kCCurPi0Bkg}, //20
436  {"true_ncurpi0bkg_twoprongcut", kTwoProngCut && kNCurPi0Bkg}, //21
437  {"true_ccurnonpi0bkg_twoprongcut", kTwoProngCut && kCCurNonPi0Bkg}, //22
438  {"true_ncurnonpi0bkg_twoprongcut", kTwoProngCut && kNCurNonPi0Bkg}, //23
439  {"true_other_twoprongcut", kTwoProngCut && kOther}, //24
440 
441  {"fiduvtxcut", kFiduVtxCut}, //25
442  {"true_sig_fiduvtxcut", kFiduVtxCut && kSignal}, //26
443  {"true_bkg_fiduvtxcut", kFiduVtxCut && kBackground}, //27
444  {"true_ccurpi0bkg_fiduvtxcut", kFiduVtxCut && kCCurPi0Bkg}, //28
445  {"true_ncurpi0bkg_fiduvtxcut", kFiduVtxCut && kNCurPi0Bkg}, //29
446  {"true_ccurnonpi0bkg_fiduvtxcut", kFiduVtxCut && kCCurNonPi0Bkg}, //30
447  {"true_ncurnonpi0bkg_fiduvtxcut", kFiduVtxCut && kNCurNonPi0Bkg}, //31
448  {"true_other_fiduvtxcut", kFiduVtxCut && kOther}, //32
449 
450  {"contcut", kContCut}, //33
451  {"true_sig_contcut", kContCut && kSignal}, //34
452  {"true_bkg_contcut", kContCut && kBackground}, //35
453  {"true_ccurpi0bkg_contcut", kContCut && kCCurPi0Bkg}, //36
454  {"true_ncurpi0bkg_contcut", kContCut && kNCurPi0Bkg}, //37
455  {"true_ccurnonpi0bkg_contcut", kContCut && kCCurNonPi0Bkg}, //38
456  {"true_ncurnonpi0bkg_contcut", kContCut && kNCurNonPi0Bkg}, //39
457  {"true_other_contcut", kContCut && kOther}, //40
458 
459  {"contcvnmuoncut", kContCVNMuonCut}, //41
460  {"true_sig_contcvnmuoncut", kContCVNMuonCut && kSignal}, //42
461  {"true_bkg_contcvnmuoncut", kContCVNMuonCut && kBackground}, //43
462  {"true_ccurpi0bkg_contcvnmuoncut", kContCVNMuonCut && kCCurPi0Bkg}, //44
463  {"true_ncurpi0bkg_contcvnmuoncut", kContCVNMuonCut && kNCurPi0Bkg}, //45
464  {"true_ccurnonpi0bkg_contcvnmuoncut", kContCVNMuonCut && kCCurNonPi0Bkg}, //46
465  {"true_ncurnonpi0bkg_contcvnmuoncut", kContCVNMuonCut && kNCurNonPi0Bkg}, //47
466  {"true_other_contcvnmuoncut", kContCVNMuonCut && kOther}, //48
467 
468  {"contkmuoncut", kContkMuonCut}, //49
469  {"true_sig_contkmuoncut", kContkMuonCut && kSignal}, //50
470  {"true_bkg_contkmuoncut", kContkMuonCut && kBackground}, //51
471  {"true_ccurpi0bkg_contkmuoncut", kContkMuonCut && kCCurPi0Bkg}, //52
472  {"true_ncurpi0bkg_contkmuoncut", kContkMuonCut && kNCurPi0Bkg}, //53
473  {"true_ccurnonpi0bkg_contkmuoncut", kContkMuonCut && kCCurNonPi0Bkg}, //54
474  {"true_ncurnonpi0bkg_contkmuoncut", kContkMuonCut && kNCurNonPi0Bkg}, //55
475  {"true_other_contkmuon", kContkMuonCut && kOther}, //56
476 
477  {"presel2pngonecut", kPreSel2PngOneCut}, //57
478  {"true_sig_presel2pngonecut", kPreSel2PngOneCut && kSignal}, //58
479  {"true_bkg_presel2pngonecut", kPreSel2PngOneCut && kBackground}, //59
480  {"true_ccurpi0bkg_presel2pngonecut", kPreSel2PngOneCut && kCCurPi0Bkg}, //60
481  {"true_ncurpi0bkg_presel2pngonecut", kPreSel2PngOneCut && kNCurPi0Bkg}, //61
482  {"true_ccurnonpi0bkg_presel2pngonecut", kPreSel2PngOneCut && kCCurNonPi0Bkg}, //62
483  {"true_ncurnonpi0bkg_presel2pngonecut", kPreSel2PngOneCut && kNCurNonPi0Bkg}, //63
484  {"true_other_presel2pngonecut", kPreSel2PngOneCut && kOther}, //64
485 
486  {"presel2pngtwocut", kPreSel2PngTwoCut}, //65
487  {"true_sig_presel2pngtwocut", kPreSel2PngTwoCut && kSignal}, //66
488  {"true_bkg_presel2pngtwocut", kPreSel2PngTwoCut && kBackground}, //67
489  {"true_ccurpi0bkg_presel2pngtwocut", kPreSel2PngTwoCut && kCCurPi0Bkg}, //68
490  {"true_ncurpi0bkg_presel2pngtwocut", kPreSel2PngTwoCut && kNCurPi0Bkg}, //69
491  {"true_ccurnonpi0bkg_presel2pngtwocut", kPreSel2PngTwoCut && kCCurNonPi0Bkg}, //70
492  {"true_ncurnonpi0bkg_presel2pngtwocut", kPreSel2PngTwoCut && kNCurNonPi0Bkg}, //71
493  {"true_other_presel2pngtwocut", kPreSel2PngTwoCut && kOther}, //72
494 
495  {"presel2twopngcut", kPreSel2TwoPngCut}, //73
496  {"true_sig_presel2twopngcut", kPreSel2TwoPngCut && kSignal}, //74
497  {"true_bkg_presel2twopngcut", kPreSel2TwoPngCut && kBackground}, //75
498  {"true_ccurpi0bkg_presel2twopngcut", kPreSel2TwoPngCut && kCCurPi0Bkg}, //76
499  {"true_ncurpi0bkg_presel2twopngcut", kPreSel2TwoPngCut && kNCurPi0Bkg}, //77
500  {"true_ccurnonpi0bkg_presel2twopngcut", kPreSel2TwoPngCut && kCCurNonPi0Bkg}, //78
501  {"true_ncurnonpi0bkg_presel2twopngcut", kPreSel2TwoPngCut && kNCurNonPi0Bkg}, //79
502  {"true_other_presel2twopngcut", kPreSel2TwoPngCut && kOther}, //80
503 
504  {"presel5pngonecut", kPreSel5PngOneCut}, //81
505  {"true_sig_presel5pngonecut", kPreSel5PngOneCut && kSignal}, //82
506  {"true_bkg_presel5pngonecut", kPreSel5PngOneCut && kBackground}, //83
507  {"true_ccurpi0bkg_presel5pngonecut", kPreSel5PngOneCut && kCCurPi0Bkg}, //84
508  {"true_ncurpi0bkg_presel5pngonecut", kPreSel5PngOneCut && kNCurPi0Bkg}, //85
509  {"true_ccurnonpi0bkg_presel5pngonecut", kPreSel5PngOneCut && kCCurNonPi0Bkg}, //86
510  {"true_ncurnonpi0bkg_presel5pngonecut", kPreSel5PngOneCut && kNCurNonPi0Bkg}, //87
511  {"true_other_presel5pngonecut", kPreSel5PngOneCut && kOther}, //88
512 
513  {"presel5pngtwocut", kPreSel5PngTwoCut}, //89
514  {"true_sig_presel5pngtwocut", kPreSel5PngTwoCut && kSignal}, //90
515  {"true_bkg_presel5pngtwocut", kPreSel5PngTwoCut && kBackground}, //91
516  {"true_ccurpi0bkg_presel5pngtwocut", kPreSel5PngTwoCut && kCCurPi0Bkg}, //92
517  {"true_ncurpi0bkg_presel5pngtwocut", kPreSel5PngTwoCut && kNCurPi0Bkg}, //93
518  {"true_ccurnonpi0bkg_presel5pngtwocut", kPreSel5PngTwoCut && kCCurNonPi0Bkg}, //94
519  {"true_ncurnonpi0bkg_presel5pngtwocut", kPreSel5PngTwoCut && kNCurNonPi0Bkg}, //95
520  {"true_other_presel5pngtwocut", kPreSel5PngTwoCut && kOther}, //96
521 
522  {"presel5twopngcut", kPreSel5TwoPngCut}, //97
523  {"true_sig_presel5twopngcut", kPreSel5TwoPngCut && kSignal}, //98
524  {"true_bkg_presel5twopngcut", kPreSel5TwoPngCut && kBackground}, //99
525  {"true_ccurpi0bkg_presel5twopngcut", kPreSel5TwoPngCut && kCCurPi0Bkg}, //100
526  {"true_ncurpi0bkg_presel5twopngcut", kPreSel5TwoPngCut && kNCurPi0Bkg}, //101
527  {"true_ccurnonpi0bkg_presel5twopngcut", kPreSel5TwoPngCut && kCCurNonPi0Bkg}, //102
528  {"true_ncurnonpi0bkg_presel5twopngcut", kPreSel5TwoPngCut && kNCurNonPi0Bkg}, //103
529  {"true_other_presel5twopngcut", kPreSel5TwoPngCut && kOther} //104
530 
531  };
532 
534  {"true Coh Signal, presel", kSignal && kPreSel && kModeCoh}, //1
535  {"true Coh El Signal, presel", kSignal && kPreSel && kModeCohEl}, //2
536  {"true Res Signal, presel", kSignal && kPreSel && kModeRes}, //3
537  {"true QE Signal, presel", kSignal && kPreSel && kModeQE}, //4
538  {"true DIS Signal, presel", kSignal && kPreSel && kModeDIS}, //5
539  {"true MEC Signal, presel", kSignal && kPreSel && kModeMEC} //6
540  };
541 
542  //TrueCuts - MC Truth, From the generator/GEANT4
543  //const Cut kTrueNeutrino = (kTrueNuMu || kTrueNuE);
544  //const Cut kTrueNuNC = kTrueNeutrino && kTrueNCur;
545 
546  //const Cut kRecoTwoProngCCurPi0Bkg = kPreSel && kCCurPi0Bkg && kTwoProng;
547  //const Cut kRecoTwoProngNCurPi0Bkg = kPreSel && kTwoProng && (kTrueAllPi0 && !kTruePi0100MeV);
548  //const Cut kRecoTwoProngCCurNonPi0Bkg = kPreSel && kCCurNonPi0Bkg && kTwoProng;
549  //const Cut kRecoTwoProngNCurNonPi0Bkg = kPreSel && kNCurNonPi0Bkg && kTwoProng;
550 
551  //TrueReco Cuts - MC Truth, Reconstructed
552  //const Cut kTrueRecoSignal = kRecoTwoProngSignal && kTrueNeutrinoInTime && kTrueNCur && kTruePi0100MeVPresent;
553  //const Cut kTrueRecoOneProngSignal = kTrueRecoSignal && kOneProng;
554  //const Cut kTrueRecoTwoProngSignal = kTrueRecoSignal && kTwoProng;
555  //const Cut kTrueRecoThreeProngSignal = kTrueRecoSignal && kThreeProng;
556 
557 
558 
559  //const Cut kTrueFiduPi0100MeV = kTrueNeutrinoInTime && kTrueNCur && kTruePi0100MeVPresent && kTrueVtxInFiducial;
560  //const Cut kSignal = kTrueNeutrinoInTime && kTrueNCur && kTruePi0100MeVPresent;
561  // const SpillTruthCut kTrueSignal = ;
562  //const Cut kSignal = ;
563 }
564 
const Cut kPreSel
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
const Cut kModeRes([](const caf::SRProxy *sr){ return(sr->mc.nu[0].mode==caf::kRes);})
const Cut kNoCuts([](const caf::SRProxy *sr){return true;})
const Cut kTruePi0100MeV([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);if(sr->mc.nu[0].prim.size()==0) return false;float Pi0Mass=0.134977;float KE=-10.0;float TE=-99.0;int nprim=sr->mc.nu[0].prim.size();int npi0=0;for(int i=0;i< nprim;i++){if(sr->mc.nu[0].prim[i].pdg==111){TE=sr->mc.nu[0].prim[i].p.E;KE=pow(pow(TE, 2.0)-pow(Pi0Mass, 2.0), 0.5);if(KE >=0.1) npi0++;}}if(npi0){return true;}return false;})
const Cut CVN5LabelEMIDPngTwoCut([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==0) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->vtx.elastic.fuzzyk.npng< 2) return false;return((float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpart5label.photonid)+float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpart5label.electronid))>0.5);})
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kModeCohEl([](const caf::SRProxy *sr){ return(sr->mc.nu[0].mode==caf::kCohElastic);})
const Cut kNCurNonPi0Bkg
Definition: SINCpi0_Cuts.h:379
const Cut kContkMuonCut
Definition: SINCpi0_Cuts.h:388
const int ml_sel_array_cutflow
Definition: SINCpi0_Cuts.h:409
const int sincpi0_presel_cutflow
Definition: SINCpi0_Cuts.h:407
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
const Var kTrueNuE
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
constexpr T pow(T x)
Definition: pow.h:75
const Cut kTrueNuMu([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->mc.nnu==0) return false;return(sr->mc.nu[0].pdg==14);})
const SpillTruthCut kModeDIS([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kDIS);})
const Cut kFiduVtxCut
Definition: SINCpi0_Cuts.h:385
const Cut kCCurNonPi0Bkg
Definition: SINCpi0_Cuts.h:378
const Cut kPreSel2PngOneCut
Definition: SINCpi0_Cuts.h:392
const CutArr presel_sigchanarray[sincpi0_channel_cutflow]
Definition: SINCpi0_Cuts.h:533
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
const Cut kContCut
Definition: SINCpi0_Cuts.h:386
const Cut kTruePi0([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);if(sr->mc.nu[0].prim.size()==0) return false;float Pi0Mass=0.134977;float KE=-10.0;float TE=-99.0;int nprim=sr->mc.nu[0].prim.size();int npi0=0;for(int i=0;i< nprim;i++){if(sr->mc.nu[0].prim[i].pdg==111){TE=sr->mc.nu[0].prim[i].p.E;KE=pow(pow(TE, 2.0)-pow(Pi0Mass, 2.0), 0.5);if(KE >=0.0) npi0++;}}if(npi0){return true;}return false;})
const Cut kBackground
Definition: SINCpi0_Cuts.h:373
const Cut kPreSel5PngOneCut
Definition: SINCpi0_Cuts.h:389
const SpillTruthCut kModeQE([](const caf::SRNeutrinoProxy *sr){return(sr->mode==caf::kQE);})
const Cut kPreSel5PngTwoCut
Definition: SINCpi0_Cuts.h:390
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
const Cut kOther
Definition: SINCpi0_Cuts.h:380
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Cut kTrueNCur([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return(sr->mc.nu[0].iscc==0);})
const Cut kNCurPi0Bkg
Definition: SINCpi0_Cuts.h:377
const Cut kCCurPi0Bkg
Definition: SINCpi0_Cuts.h:376
caf::Proxy< float > z
Definition: SRProxy.h:108
if(dump)
const Cut CVN2LabelEMIDPngOneCut([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==0) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->vtx.elastic.fuzzyk.npng< 1) return false;return(float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpartnumuccemid.emid)>0.5);})
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
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;})
caf::Proxy< float > x
Definition: SRProxy.h:106
const Cut CVN5LabelEMIDPngOneCut([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==0) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->vtx.elastic.fuzzyk.npng< 1) return false;return((float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpart5label.photonid)+float(sr->vtx.elastic.fuzzyk.png[0].spprongcvnpart5label.electronid))>0.5);})
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
caf::StandardRecord * sr
const Cut kThreeProng([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return(sr->vtx.elastic.fuzzyk.npng==3);})
const Cut kTwoProng([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return((sr->vtx.elastic.fuzzyk.npng==2));})
const Cut kPreSel2TwoPngCut
Definition: SINCpi0_Cuts.h:394
const Cut kMuonIDCut
caf::Proxy< unsigned int > idxmuonid
Definition: SRProxy.h:1776
const Cut kOneProng([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return(sr->vtx.elastic.fuzzyk.npng==1);})
const Cut kPreSel5TwoPngCut
Definition: SINCpi0_Cuts.h:391
const CutArr presel_flowarray[sincpi0_presel_cutflow]
Definition: SINCpi0_Cuts.h:411
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const Cut kSignal
Definition: SINCpi0_Cuts.h:372
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
const Cut kTrueCCur([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==false) return false;if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return(sr->mc.nu[0].iscc==1);})
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
const int sincpi0_channel_cutflow
Definition: SINCpi0_Cuts.h:408
caf::Proxy< float > y
Definition: SRProxy.h:107
const Cut CVN5LabelMuonIDCut([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==0) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;float maxscore=-999.9f;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.npng;i++) if(maxscore< sr->vtx.elastic.fuzzyk.png[i].spprongcvnpart5label.muonid) maxscore=sr->vtx.elastic.fuzzyk.png[i].spprongcvnpart5label.muonid;return(maxscore< 0.25);})
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< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
const Cut kPreSel2PngTwoCut
Definition: SINCpi0_Cuts.h:393
assert(nhit_max >=nhit_nbins)
const Cut CVN2LabelEMIDPngTwoCut([](const caf::SRProxy *sr){if(sr->vtx.elastic.IsValid==0) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->vtx.elastic.fuzzyk.npng< 2) return false;return(float(sr->vtx.elastic.fuzzyk.png[1].spprongcvnpartnumuccemid.emid)>0.5);})
const Cut kTrueFiduNCPi0
Definition: SINCpi0_Cuts.h:371
const Cut kContCVNMuonCut
Definition: SINCpi0_Cuts.h:387
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
std::string name
Definition: SINCpi0_Cuts.h:399
const Cut kTrueNCPi0
Definition: SINCpi0_Cuts.h:370
Template for Cut and SpillCut.
Definition: Cut.h:15
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
#define for
Definition: msvc_pragmas.h:3
const Cut kModeMEC([](const caf::SRProxy *sr){ return(sr->mc.nu[0].mode==caf::kMEC);})
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
const Cut kModeCoh([](const caf::SRProxy *sr){ return(sr->mc.nu[0].mode==caf::kCoh);})
const Cut kTwoProngCut
Definition: SINCpi0_Cuts.h:384
enum BeamMode string