nus17_fd_arrays.h
Go to the documentation of this file.
1 #include "CAFAna/Cuts/NueCutsSecondAna.h"
2 #include "NuXAna/Cuts/NusCuts.h"
4 #include "NuXAna/Vars/NusVars.h"
6 
7 using namespace ana;
8 
9 const int ncuts = 10;
10 
12  [](const caf::SRProxy* sr)
13  {
14  if(sr->sel.nuecosrej.cospidcontain < 0.57) return false;
15  return true;
16  });
17 
18 const Cut kNCPCut(
19  [](const caf::SRProxy* sr)
20  {
21  if(sr->sel.cosrej.numucontpid < 0.56) return false;
22  return true;
23  });
24 
25 //const Cut kNus17NCCosRejNCCKeras = kNCCosRejKerasAlt >= 0.83;
26 
27 const Cut cutsarray[ncuts] = {
30  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality,
31  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain,
32  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut,
33  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut && kNus17NCCosRejAlt,
34  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut && kNus17NCCosRejAlt && kNus17CVNnc,
35  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut && kNus17NCCosRejAlt && kNus17CVNnc && !(kNus17SlcTimeGap && kNus17SlcDist),
36  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut && kNus17NCCosRejAlt && kNus17CVNnc && !(kNus17SlcTimeGap && kNus17SlcDist) && !(kNus17ShwPtpLow || kNus17ShwPtpHigh),
37  kNus17Veto && kApplySecondAnalysisMask && kNus17EventQuality && kNus17FDContain && kNus17BackwardCut && kNus17NCCosRejAlt && kNus17CVNnc && !(kNus17SlcTimeGap && kNus17SlcDist) && !(kNus17ShwPtpLow || kNus17ShwPtpHigh) && kNus17EnergyCut
38 
39 };
40 
42  "nocut",
43  "veto",
44  "eq17",
45  "contain17",
46  "nueback17",
47  "cosrej17",
48  "cvn17",
49  "nus17time",
50  "nus17shw",
51  "nus17all"
52 };
53 
54 const int ncuts_nminus1 = 10;
55 
57  "nocut",
58  "veto",
59  "eq",
60  "contain",
61  "nueback",
62  "cosrej",
63  "cvnnc",
64  "time",
65  "shwptp",
66  "vise"
67 };
68 
80 
81 };
82 
83 
84 const Var kDummy(
85  [](const caf::SRProxy* sr)
86  {
87  return 1;
88  });
89 
90 const Var kNCP = SIMPLEVAR(sel.cosrej.numucontpid);
91 const Var kNumuSA = SIMPLEVAR(sel.cosrej.numuSAcontpid);
92 
93 const Var kNusEperH(
94  [](const caf::SRProxy* sr)
95  {
96  double nhit = (double)sr->slc.nhit;
97  if(nhit < 1.) return 0.;
98  double cale = sr->slc.calE;
99  double recoE = FDscaleCalE17*cale;
100  return recoE/nhit;
101  });
102 
103 
104 const HistAxis maxyptpaxis("Shower Max Y",Binning::Simple(320, -800., 800.), kMaxY,
105  "ptp",Binning::Simple(100, 0., 1.),kPartPtp);
106 
107 const HistAxis timedistaxis("Distance from Closest Slice (cm)",Binning::Simple(100, 0., 2000.),kClosestSlcMinDist,
108  "Closest Slice Dist. from Top", Binning::Simple(140, 0, 700), kClosestSlcMinTop);
109 
110 const HistAxis timeaxis("Time Gap (#mus)", Binning::Simple(100,-2000, 2000), kClosestSlcTime);
111 const HistAxis disttimeaxis("Distance from Closest Slice (cm)", Binning::Simple(100,0,2000),kClosestSlcMinDist);
112 const HistAxis disttimetopaxis("Closest Slice Dist. from Top", Binning::Simple(140, 0, 700), kClosestSlcMinTop);
113 
114 const Binning bins = Binning::Simple(1,0.5,1.5);
115 const HistAxis dummyaxis("dummy", bins, kDummy);
116 
117 const Binning ebins = Binning::Simple(1200,0,120);
118 const HistAxis eaxis("Visible Energy (GeV)", ebins, kNus17Energy);
119 
120 
121 const Binning cvnbins = Binning::Simple(100,0.,1.);
122 const HistAxis cvnaxis("CVN NC Classifier", cvnbins, kCVNnc);
123 const HistAxis cvneaxis("CVN nue Classifier", cvnbins, kCVNe);
124 const HistAxis cvnmaxis("CVN numu Classifier", cvnbins, kCVNm);
125 
126 const Binning ncidbins = Binning::Simple(100,0.,1.);
127 const Binning ncidgbins = Binning::Simple(100,-1.,1.);
128 
129 //const HistAxis ncid2axis("NC Cosmic Rejection GBDT", ncidgbins, kNCCosRejGAlt);
130 const HistAxis ncidaxis("NC Cosmic Rejection BDT", ncidbins, kNCCosRejAlt);
131 //const HistAxis kerasaxis("NC Cosmic Rejection Keras", ncidbins, kNCCosRejKerasAlt);
132 
133 const Binning zbins = Binning::Simple(1210, -50., 6000.);
134 const HistAxis zaxis("Shower Max Z", zbins, kMaxZ);
135 
137 const HistAxis nmichelaxis("Number of Michel Electrons", nmichelbins, kNMichels);
138 
139 
140 const Binning ybins = Binning::Simple(320, -800., 800.);
141 const HistAxis yaxis("Shower Max Y", ybins, kMaxY);
142 
143 const Binning ptpbins = Binning::Simple(100, 0., 1.);
144 const HistAxis ptpaxis("p_{T}/p", ptpbins, kPartPtp);
145 
146 const Binning distbins = Binning::Simple(160, 0., 800.);
147 const HistAxis distaxis("Distance to Top (cm)", distbins, kDistTop);
148 
149 const Binning hitbins = Binning::Simple(300,0,300);
150 const HistAxis hitaxis("Number of hits", hitbins, kNHit);
151 
152 const Binning lprongbins = Binning::Simple(300,0,600);
153 const HistAxis lprongaxis("Longest Prong", lprongbins, kLongestProng);
154 
155 const HistAxis distalltopaxis("Distance (all prongs) to Top (cm)", distbins, kDistAllTop);
156 
157 
158 const HistAxis distallbottomaxis("Distance (all prongs) to Bottom (cm)", distbins, kDistAllBottom);
159 const HistAxis distalleastaxis("Distance (all prongs) to East (cm)", distbins, kDistAllEast);
160 const HistAxis distallwestaxis("Distance (all prongs) to West (cm)", distbins, kDistAllWest);
161 const HistAxis distallfrontaxis("Distance (all prongs) to Front (cm)", distbins, kDistAllFront);
162 const HistAxis distallbackaxis("Distance (all prongs) to Back (cm)", distbins, kDistAllBack);
163 
164 const HistAxis numucontaxis("(numu) Cosmic Rejection BDT", cvnbins, kNCP);
165 const HistAxis numusaaxis("numuSA", cvnbins, kNumuSA);
166 
167 
168 const int nvars = 22;
172  zaxis, yaxis, ncidaxis,
177 
179  "time","disttime","disttimetop","lprong",
180  "nusE", "cvn", "cvne","cvnm",
181  "maxz", "maxy", "ncid",
182  "ptp", "disttop", "distalltop",
183  "distallbottom","distalleast",
184  "distallwest","distallfront",
185  "distallback", "numusa", "hits"};
186 
188  "Time Gap (#mus)",
189  "Distance from Closest Slice (cm)",
190  "Closest Slice Dist. from Top",
191  "Longest Prong",
192  "Visible Energy (GeV)",
193  "CVN NC Classifier",
194  "CVN nue Classifier",
195  "CVN numu Classifier",
196  "Shower Max Z",
197  "Shower Max Y",
198  "NC Cosmic Rejection BDT",
199  "p_{T}",
200  "Distance to Top (cm)",
201  "Distance (all prongs) to Top (cm)",
202  "Distance (all prongs) to Bottom (cm)",
203  "Distance (all prongs) to East (cm)",
204  "Distance (all prongs) to West (cm)",
205  "Distance (all prongs) to Front (cm)",
206  "Distance (all prongs) to Back (cm)",
207  "numuSA",
208  "Number of hits"
209  };
210 
212  "Time Gap (#mus)",
213  "Distance from Closest Slice (cm)",
214  "Closest Slice Dist. from Top (cm)",
215  "Longest Prong (cm)",
216  "Visible Energy (GeV)",
217  "CVN NC Classifier",
218  "CVN nue Classifier",
219  "CVN numu Classifier",
220  "Shower Max Z (cm)",
221  "Shower Max Y (cm)",
222  "NC Cosmic Rejection BDT",
223  "p_{T}/p",
224  "Distance to Top (cm)",
225  "Distance (all prongs) to Top (cm)",
226  "Distance (all prongs) to Bottom (cm)",
227  "Distance (all prongs) to East (cm)",
228  "Distance (all prongs) to West (cm)",
229  "Distance (all prongs) to Front (cm)",
230  "Distance (all prongs) to Back (cm)",
231  "numuSA",
232  "Number of hits"
233 };
234 
const Cut kNCPCut([](const caf::SRProxy *sr){if(sr->sel.cosrej.numucontpid< 0.56) return false;return true;})
const HistAxis disttimeaxis("Distance from Closest Slice (cm)", Binning::Simple(100, 0, 2000), kClosestSlcMinDist)
const HistAxis timedistaxis("Distance from Closest Slice (cm)", Binning::Simple(100, 0., 2000.), kClosestSlcMinDist,"Closest Slice Dist. from Top", Binning::Simple(140, 0, 700), kClosestSlcMinTop)
const Binning nmichelbins
const HistAxis disttimetopaxis("Closest Slice Dist. from Top", Binning::Simple(140, 0, 700), kClosestSlcMinTop)
const Cut kNus17EnergyCut([](const caf::SRProxy *sr){double energy=0.0;energy=kNus17Energy(sr);if(energy< 0.25) return false;if(energy > 10.0) return false;return true;})
Definition: NusCuts17.h:51
const Var kPartPtp([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.partptp)|| std::isinf(1.*sr->sel.nuecosrej.partptp)) return-5.f;return float(sr->sel.nuecosrej.partptp);})
Definition: NusVars.h:74
const HistAxis axisarray[nvars]
const HistAxis nmichelaxis("Number of Michel Electrons", nmichelbins, kNMichels)
const HistAxis distallfrontaxis("Distance (all prongs) to Front (cm)", distbins, kDistAllFront)
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kDistAllBottom([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngbottom)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngbottom);})
Distance of all showers in slice from the bottom edge of detector.
Definition: NueVars.h:33
const std::string axisarray_names_opt[nvars]
const Var kCVNnc
PID
Definition: Vars.cxx:44
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
const Binning zbins
Definition: NumuCCIncBins.h:21
const Var kDistAllWest([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngwest)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngwest);})
Distance of all showers in slice from the west edge of detector.
Definition: NueVars.h:36
const Var kDistTop([](const caf::SRProxy *sr){return std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop);})
Definition: NusVars.h:76
const HistAxis lprongaxis("Longest Prong", lprongbins, kLongestProng)
const Var kDistAllTop([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngtop)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngtop);})
Distance of all showers in slice from the top edge of detector.
Definition: NueVars.h:30
const Binning distbins
const Var kDistAllBack([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngback)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngback);})
Distance of all showers in slice from the back edge of detector.
Definition: NueVars.h:42
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2109
const Cut kNus17CVNnc([](const caf::SRProxy *sr){if(sr->slc.nhit < 25) return false;std::cout<< "ERROR::kNus17CVNnc. Looking for cvnProd3Train. Branch no longer exists."<< std::endl;abort();return true;})
Definition: NusCuts17.h:49
const Binning ebins
Definition: NumuCCIncBins.h:24
const HistAxis distalleastaxis("Distance (all prongs) to East (cm)", distbins, kDistAllEast)
nhit
Definition: demo1.py:25
const HistAxis cvnaxis("CVN NC Classifier", cvnbins, kCVNnc)
const Cut kNus17BackwardCut
FD backward photon rejection cut, inherited from nue, from docdb 21113.
Definition: NusCuts17.h:45
const HistAxis numucontaxis("(numu) Cosmic Rejection BDT", cvnbins, kNCP)
const Binning lprongbins
const Binning ncidbins
const HistAxis distallbottomaxis("Distance (all prongs) to Bottom (cm)", distbins, kDistAllBottom)
const Var kMaxZ([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.0f;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return-1000.0f;float maxzall=-999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;i++){maxzall=std::max(std::max(sr->vtx.elastic.fuzzyk.png[i].shwlid.start.Z(), sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.Z()), maxzall);}return maxzall;})
Definition: NueVars.h:76
caf::Proxy< caf::SRCosRej > cosrej
Definition: SRProxy.h:1231
const HistAxis cvneaxis("CVN nue Classifier", cvnbins, kCVNe)
const Var kNCCosRejAlt
Definition: NusVarsTemp.h:57
const Var kNus17Energy([](const caf::SRProxy *sr){double cale=sr->slc.calE;double recoE=0.;if(sr->hdr.det==caf::kFARDET) recoE=FDscaleCalE17 *cale;if(sr->hdr.det==caf::kNEARDET) recoE=NDscaleCalE17 *cale;return recoE;})
Definition: NusVars.h:62
const Var kDistAllEast([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngeast)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngeast);})
Distance of all showers in slice from the east edge of detector.
Definition: NueVars.h:39
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1244
const HistAxis cvnmaxis("CVN numu Classifier", cvnbins, kCVNm)
const Cut kNus17FDContain
FD Containment, nue-inspired, from docdb 21113.
Definition: NusCuts17.h:28
const HistAxis ncidaxis("NC Cosmic Rejection BDT", ncidbins, kNCCosRejAlt)
const Var kNCP
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1294
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
const Var kMaxY([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.0f;if(sr->vtx.elastic.fuzzyk.nshwlid==0) return-1000.0f;float maxyall=-999.0;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;i++){maxyall=std::max(std::max(sr->vtx.elastic.fuzzyk.png[i].shwlid.start.Y(), sr->vtx.elastic.fuzzyk.png[i].shwlid.stop.Y()), maxyall);}return maxyall;})
Definition: NueVars.h:60
const std::string cutnames[ncuts]
const Var kLongestProng([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return 0.f;if(sr->vtx.elastic.fuzzyk.npng==0) return 0.f;auto idx=sr->vtx.elastic.fuzzyk.longestidx;return float(sr->vtx.elastic.fuzzyk.png[idx].len);})
Definition: Vars.h:89
const Var kNumuSA
const HistAxis zaxis("Shower Max Z", zbins, kMaxZ)
const Var kNHit
Definition: Vars.cxx:71
const Cut kNus17SlcDist
Definition: NusCuts17.h:55
const HistAxis dummyaxis("dummy", bins, kDummy)
const HistAxis maxyptpaxis("Shower Max Y", Binning::Simple(320,-800., 800.), kMaxY,"ptp", Binning::Simple(100, 0., 1.), kPartPtp)
const HistAxis distalltopaxis("Distance (all prongs) to Top (cm)", distbins, kDistAllTop)
const Cut kCosPIDContainCut([](const caf::SRProxy *sr){if(sr->sel.nuecosrej.cospidcontain< 0.57) return false;return true;})
const Cut kNus17ShwPtpLow
Carve out space in shower maximum y and #p_{T}/p, from docdb 21113.
Definition: NusCuts17.h:58
caf::StandardRecord * sr
const Cut kNus17NCCosRejAlt
Until nccosrej branch is in CAFs, must use these cuts.
Definition: NusCuts17.h:70
const Binning hitbins
const std::string cutnames_nminus1[ncuts_nminus1]
const HistAxis distallbackaxis("Distance (all prongs) to Back (cm)", distbins, kDistAllBack)
const HistAxis distallwestaxis("Distance (all prongs) to West (cm)", distbins, kDistAllWest)
const Var kClosestSlcMinTop([](const caf::SRProxy *sr){return(float) sr->slc.closestsliceminfromtop;})
Definition: NusVars.h:82
const HistAxis eaxis("Visible Energy (GeV)", ebins, kNus17Energy)
const Var kNMichels([](const caf::SRProxy *sr){int n_me=0;for(int i=0;i< (int) sr->me.nslc;i++) if(sr->me.slc[i].mid > 1. &&sr->me.slc[i].deltat > 1200.) n_me++;for(int i=0;i< (int) sr->me.nkalman;i++) if(sr->me.trkkalman[i].mid > 0. &&sr->me.trkkalman[i].deltat > 800.) n_me++;if(n_me > 2) n_me=2;return n_me;})
Number of SlcME&#39;s assoc with slice.
Definition: Vars.h:85
const Binning cvnbins
const Binning ptpbins
const Binning bins
Definition: NumuCC_CPiBin.h:8
const Var kClosestSlcMinDist([](const caf::SRProxy *sr){return(float) sr->slc.closestslicemindist;})
Definition: NusVars.h:81
const int ncuts_nminus1
const Binning ybins
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Cut cutsarray[ncuts]
const Var kDistAllFront([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngfront)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngfront);})
Distance of all showers in slice from the front edge of detector.
Definition: NueVars.h:45
const Cut kNus17Veto([](const caf::SRProxy *sr){return sr->sel.veto.keep;})
Definition: NusCuts17.h:25
const int nvars
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2125
const Cut kNus17ShwPtpHigh
Definition: NusCuts17.h:59
caf::Proxy< float > calE
Definition: SRProxy.h:1271
const HistAxis hitaxis("Number of hits", hitbins, kNHit)
const HistAxis distaxis("Distance to Top (cm)", distbins, kDistTop)
const Cut kNus17SlcTimeGap
Closest slice cuts based on approximation in space and time, from from docdb 21113.
Definition: NusCuts17.h:54
const Var kDummy([](const caf::SRProxy *sr){return 1;})
caf::Proxy< float > cospidcontain
Definition: SRProxy.h:1014
const HistAxis ptpaxis("p_{T}/p", ptpbins, kPartPtp)
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2124
const HistAxis timeaxis("Time Gap (#mus)", Binning::Simple(100,-2000, 2000), kClosestSlcTime)
const double FDscaleCalE17
Definition: NusVars.cxx:50
const HistAxis numusaaxis("numuSA", cvnbins, kNumuSA)
const int ncuts
const Var kNusEperH([](const caf::SRProxy *sr){double nhit=(double) sr->slc.nhit;if(nhit< 1.) return 0.;double cale=sr->slc.calE;double recoE=FDscaleCalE17 *cale;return recoE/nhit;})
const Var kCVNm
PID
Definition: Vars.cxx:39
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:114
const Cut kNus17EventQuality([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;if(sr->slc.ncontplanes<=2) return false;return true;})
Data Quality cuts from docdb 21113.
Definition: NusCuts17.h:21
const Binning ncidgbins
const Var kClosestSlcTime([](const caf::SRProxy *sr){return(float) sr->slc.closestslicetime;})
Definition: NusVars.h:80
const HistAxis yaxis("Shower Max Y", ybins, kMaxY)
const Cut cutsarray_nminus1[ncuts_nminus1]
const std::string axisarray_names[nvars]
const std::string axisarray_names_xaxis[nvars]