MRDiFCutsAndVars.h
Go to the documentation of this file.
1 #pragma once
2 
3 //#include "CAFAna/Core/Cut.h"
4 #include "CAFAna/Vars/Vars.h"
5 //#include "CAFAna/Cuts/Cuts.h"
10 
12 #include <cassert>
13 
14 /// Cuts and Vars for the 2020 FD DiF Study
15 
16 
17 
18 namespace ana {
19 
20 
21  //--------Vars-----------------------------------------
22 
23  //These are used to mimic the kNue2020ProngContain cut
24 
25  const Var kdistTop([](const caf::SRProxy* sr)
26  {
27  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
28  float y_val = sr->vtx.elastic.vtx.y;
29  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
30  {
31  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.y;
32  if (tmp > y_val) y_val = tmp;
33  }
34  float dist_to_top = 765 - y_val;
35  return dist_to_top;
36  });
37 
38  const Var kdistBottom([](const caf::SRProxy* sr)
39  {
40  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
41  float y_val = sr->vtx.elastic.vtx.y;
42  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
43  {
44  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.y;
45  if (tmp < y_val) y_val = tmp;
46  }
47  float dist_to_bot = y_val + 749;
48  return dist_to_bot;
49  });
50 
51  const Var kdistFront([](const caf::SRProxy* sr)
52  {
53  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
54  float z_val = sr->vtx.elastic.vtx.z;
55  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
56  {
57  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.z;
58  if (tmp < z_val) z_val = tmp;
59  }
60  return z_val;
61  });
62 
63  const Var kdistBack([](const caf::SRProxy* sr)
64  {
65  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
66  float z_val = sr->vtx.elastic.vtx.z;
67  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
68  {
69  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.z;
70  if (tmp > z_val) z_val = tmp;
71  }
72  return 5962 - z_val;
73  });
74 
75  const Var kdistWest([](const caf::SRProxy* sr)
76  {
77  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
78  float x_val = sr->vtx.elastic.vtx.x;
79  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
80  {
81  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.x;
82  if (tmp < x_val) x_val = tmp;
83  }
84  float dist_to_west = x_val + 758;
85  return dist_to_west;
86  });
87 
88  const Var kdistEast([](const caf::SRProxy* sr)
89  {
90  if (!sr->vtx.elastic.IsValid || !(sr->vtx.elastic.fuzzyk.png.size() >0)) return (float)-5;
91  float x_val = sr->vtx.elastic.vtx.x;
92  for(unsigned int pngID = 0; pngID < sr->vtx.elastic.fuzzyk.png.size(); pngID ++)
93  {
94  float tmp = sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.x;
95  if (tmp > x_val) x_val = tmp;
96  }
97  float dist_to_east = 765 - x_val;
98  return dist_to_east;
99  });
100 
101  /*
102  extern const Var kdistTop;
103  extern const Var kdistBottom;
104  extern const Var kdistFront;
105  extern const Var kdistBack;
106  extern const Var kdistEast;
107  extern const Var kdistWest;
108  */
109 
110  //------------Cuts-------------------------------------
111 
112  const Cut kDiFContainment = (kdistTop > 53 && kdistBottom > 12
113  && kdistFront > 18 && kdistBack > 18
114  && kdistEast > 12 && kdistWest >12);
115 
116  const Cut kSingleSlice([](const caf::SRProxy* sr) { return (sr->hdr.subevt < 2); });
117 
118  const Cut kDiFBasicQuality([](const caf::SRProxy* sr)
119  {
120  if(!sr->vtx.elastic.IsValid)
121  return false;
122  if(sr->vtx.elastic.fuzzyk.npng == 0)
123  return false;
124  return (kApplySecondAnalysisMask(sr) && kCosRejVeto(sr));
125  } );
126 
127  const Cut kLooseCVNeCut ([](const caf::SRProxy* sr) { return sr->sel.cvnloosepreselptp.nueid > 0.3;});
128 
129  /*
130  extern const Cut kSingleSlice;
131  extern const Cut kDiFBasicQuality;
132  extern const Cut kLooseCVNeCut;
133  */
134 
135  //Final preselection and selection cuts
136  //Note: in TimingCuts.h, there is MR studies specific timing cut to use as well
137 
140  && kDiFContainment);
141  const Cut kDiFSelectionCut = kDiFPreselectionCut && kNue2020PID;
142 
143 }
caf::Proxy< caf::SRCVNResult > cvnloosepreselptp
Definition: SRProxy.h:1254
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
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
const Cut kNue2020PID([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2020PIDRHC(sr);else return kNue2020PIDFHC(sr);})
Definition: NueCuts2020.h:61
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kSingleSlice([](const caf::SRProxy *sr){return(sr->hdr.subevt< 2);})
const Var kdistEast([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float x_val=sr->vtx.elastic.vtx.x;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.x;if(tmp > x_val) x_val=tmp;}float dist_to_east=765-x_val;return dist_to_east;})
const Cut kLooseCVNeCut([](const caf::SRProxy *sr){return sr->sel.cvnloosepreselptp.nueid > 0.3;})
Float_t tmp
Definition: plot.C:36
const Cut kDiFPreselectionCut
_Var< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:74
const Var kdistBottom([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float y_val=sr->vtx.elastic.vtx.y;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.y;if(tmp< y_val) y_val=tmp;}float dist_to_bot=y_val+749;return dist_to_bot;})
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Cut kCosRejVeto([](const caf::SRProxy *sr){return sr->sel.veto.keep &&kIsFarDet(sr);})
Definition: 3flavorCuts.h:10
caf::Proxy< float > z
Definition: SRProxy.h:108
const Cut kNue2020CoreBasicEventCut
Definition: NueCuts2020.h:32
caf::Proxy< short unsigned int > subevt
Definition: SRProxy.h:250
caf::Proxy< float > x
Definition: SRProxy.h:106
caf::Proxy< float > nueid
Definition: SRProxy.h:906
const Var kdistFront([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float z_val=sr->vtx.elastic.vtx.z;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.z;if(tmp< z_val) z_val=tmp;}return z_val;})
const Cut kDiFSelectionCut
_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 kDiFContainment
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< float > y
Definition: SRProxy.h:107
const Var kdistBack([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float z_val=sr->vtx.elastic.vtx.z;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.z;if(tmp > z_val) z_val=tmp;}return 5962-z_val;})
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
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 Var kdistWest([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float x_val=sr->vtx.elastic.vtx.x;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.x;if(tmp< x_val) x_val=tmp;}float dist_to_west=x_val+758;return dist_to_west;})
const Cut kDiFBasicQuality([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return(kApplySecondAnalysisMask(sr)&&kCosRejVeto(sr));})
const Var kdistTop([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid||!(sr->vtx.elastic.fuzzyk.png.size() >0)) return(float)-5;float y_val=sr->vtx.elastic.vtx.y;for(unsigned int pngID=0;pngID< sr->vtx.elastic.fuzzyk.png.size();pngID++){float tmp=sr->vtx.elastic.fuzzyk.png[pngID].shwlid.stop.y;if(tmp > y_val) y_val=tmp;}float dist_to_top=765-y_val;return dist_to_top;})