NueCuts2018.cxx
Go to the documentation of this file.
2 
4 
5 #include <cassert>
6 #include <iostream>
7 
8 namespace ana
9 {
10  const Cut kNue2018CVNCut([](const caf::SRProxy* sr) {
11  if(kIsRHC(sr)) return kNue2018RHCCVNCut(sr);
12  else return kNue2018FHCCVNCut(sr);
13  });
14 
15  const Cut kNearestSliceCosRej2018([](const caf::SRProxy* sr) {
16  const double hibin = kIsRHC(sr) ? kNue2018CVNRHCHighEdge : kNue2018CVNFHCHighEdge;
17 
18  const double topcut = (kCVNSSe(sr) >= hibin) ? 50 : 400;
19 
20  return (fabs(sr->slc.closestslicetime) >= 100 ||
21  sr->slc.closestsliceminfromtop >= topcut ||
22  sr->slc.closestslicemindist >= 500);
23  });
24 
26  {
27  return (kNue2017BasicPart(sr) &&
28  !kNue2018CorePart(sr) &&
29  kNueEnergy2018(sr) < 4.5 &&
30  kNueEnergy2018(sr) >= 0 &&
31  kIsFarDet(sr));
32  }
33 
35  {
36  if(kIsRHC(sr)) return kNue2018CVNVsCosPIDRHC(sr);
37 
38  else return kNue2018CVNVsCosPIDFHC(sr);
39  }
40 
42  {
44  }
45 
46  const Cut kNue2018CVNCutLP([](const caf::SRProxy* sr) {
47  if(kIsRHC(sr)) return kNue2018RHCCVNCutLP(sr);
48  else return kNue2018FHCCVNCutLP(sr);
49  });
50 
51  const Cut kNue2018CVNVsCosPIDLP([](const caf::SRProxy* sr){
52 
53  if(kNue2018CVNVsCosPID(sr)) return false;
54 
55  if(kIsRHC(sr)) return kNue2018CVNVsCosPIDRHCLP(sr);
56 
57  else return kNue2018CVNVsCosPIDFHCLP(sr);
58 
59  });
60 
61  const Var kNue2018SelectionBin([](const caf::SRProxy *sr){
62  bool isPeri = kNue2018FDPeripheral(sr);
63 
64  if (isPeri)
65  return float(2.5);
66 
67  std::cout << "ERROR::kNue2018SelectionBin. Looking for cvnProd3Train. Branch no longer exists." << std::endl;
68  abort();
69  /*
70  const double lowedge = kIsRHC(sr) ? kNue2018CVNRHCLowEdge : kNue2018CVNFHCLowEdge;
71  const double highedge = kIsRHC(sr) ? kNue2018CVNRHCHighEdge : kNue2018CVNFHCHighEdge;
72  if (sr->sel.cvnProd3Train.nueid >= lowedge && sr->sel.cvnProd3Train.nueid < highedge)
73  return float(0.5);
74  else if (sr->sel.cvnProd3Train.nueid >= highedge)
75  return float(1.5);
76  else return float(-5.0);
77  */
78  return float(-5.0);
79  });
80 
81  const Var kNue2018AnaBin([](const caf::SRProxy *sr){
82  int selBin = kNue2018SelectionBin(sr);
83  float nuE = kNueEnergy2018(sr);
84  int nuEBin = nuE/0.5;
85 
86  assert(nuEBin <= 8 && "An event with nuE > 4.5 should never happen");
87 
88  int anaBin = 9*selBin + nuEBin;
89 
90  return anaBin;
91  });
92 
93  const Binning kNue2018Binning = Binning::Simple(27,0,27);
94 
95  const Var kNue2018AnaBinMergedPeripheral([](const caf::SRProxy *sr){
96  int anaBin = kNue2018AnaBin(sr);
97  anaBin = anaBin > 18 ? 20 : anaBin;
98  return anaBin;
99  });
100 
101  const Binning kNue2018BinningMergedPeripheral = Binning::Simple(23,0,23);
102 
103  const HistAxis kNue2018AxisMergedPeripheral("NuE Energy / Analysis Bin",
104  kNue2018BinningMergedPeripheral,
105  kNue2018AnaBinMergedPeripheral);
106 
107  const Var kNue2018AnaResBin([](const caf::SRProxy *sr){
108  int selBin = kNue2018SelectionBin(sr);
109  float nuERes = (kNueEnergy2018(sr) - kTrueE(sr))/kTrueE(sr);
110  int nuEBin = (nuERes + 1)*9 ;//double binning for resolution
111  int anaBin = 18*selBin + nuEBin;
112  return anaBin;
113  });
114 
115  const HistAxis kNue2018ResAxis("NuE Energy Resolution / Analysis Bin",
116  Binning::Simple(54, 0, 54), kNue2018AnaResBin);
117 
118 
119  const Var kNue2018AnaSuperBin([](const caf::SRProxy *sr){
120  int isPeri = 0;
121  if(kNue2018FDPeripheral(sr)) isPeri = 1 ;
122 
123  std::cout << "ERROR::kNue2018SelectionBin. Looking for cvnProd3Train. Branch no longer exists." << std::endl;
124  abort();
125  //double cvn = sr->sel.cvnProd3Train.nueid;
126  double cvn=-1;
127 
128  const double cvnlow = kIsRHC(sr) ? kNue2018CVNRHCLowEdge : kNue2018CVNFHCLowEdge;
129  const double cvnhigh = kIsRHC(sr) ? kNue2018CVNRHCHighEdge : kNue2018CVNFHCHighEdge;
130 
131  assert(cvn >= cvnlow && cvn<=1 && "Wrong cvn value");
132 
133  float nuE = kNueEnergy2018(sr);
134  int nuEBin = nuE/0.5;
135 
136 // assert(nuEBin <= 8 && "An event with nuE > 4.5 should never happen");
137 
138  int cvnbin =(int)(cvn/cvnhigh);// cvn binning always do [) same for energy bin
139 
140  cvnbin += isPeri;//peripheral shifted from highest to the last bin
141 
142  int anaBin = 9*cvnbin + nuEBin;
143  return anaBin;
144  });
145 
146  const Binning kNue2018SuperBinning = Binning::Simple(27,0,27);
147 
148  const HistAxis kNue2018SuperAxis("NuE Energy / Analysis Bin",
149  kNue2018SuperBinning,kNue2018AnaSuperBin);
150 
151  const Var kNue2018AnaSuperBinMergedPeripheral([](const caf::SRProxy *sr){
152  int anaBin = kNue2018AnaSuperBin(sr);
153  anaBin = anaBin > 18 ? 20: anaBin;
154  return anaBin;
155  });
156 
157  const Binning kNue2018SuperBinningMergedPeripheral = Binning::Simple(23,0,23);
158 
159  const HistAxis kNue2018SuperAxisMergedPeripheral("NuE Energy / Analysis Bin",
160  kNue2018SuperBinningMergedPeripheral,
161  kNue2018AnaSuperBinMergedPeripheral);
162 }
const Cut kNue2018CVNVsCosPIDFHCLP
Definition: NueCuts2018.h:102
const Cut kNue2018RHCCVNCutLP
Definition: NueCuts2018.h:84
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kNue2018RHCCVNCut
Definition: NueCuts2018.h:47
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
const double kNue2018CVNFHCHighEdge
Definition: NueCuts2018.h:41
const Cut kNue2018CVNVsCosPIDRHC
Definition: NueCuts2018.h:64
const Cut kNue2018PeripheralPresel(kNue2018PeripheralPreselFunc)
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Cut kNue2017BasicPart(kNue2017BasicPartFunc)
const Cut kNue2018CVNVsCosPIDRHCLP
Definition: NueCuts2018.h:100
const Cut kIsFarDet([](const caf::SRProxy *sr){return sr->hdr.det==caf::kFARDET;})
Definition: Cuts.h:94
Defines an enumeration for prong classification.
const Cut kNue2018CVNCut([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2018RHCCVNCut(sr);else return kNue2018FHCCVNCut(sr);})
Definition: NueCuts2018.h:49
const Cut kNue2018FHCCVNCutLP
Definition: NueCuts2018.h:83
const Var kNue2018AnaBin([](const caf::SRProxy *sr){int selBin=kNue2018SelectionBin(sr);float nuE=kNueEnergy2018(sr);int nuEBin=nuE/0.5;assert(nuEBin<=8 &&"An event with nuE > 4.5 should never happen");int anaBin=9 *selBin+nuEBin;return anaBin;})
Use this Analysis Binning for Ana2018, official Binning.
Definition: NueCuts2018.h:171
caf::Proxy< float > closestslicetime
Definition: SRProxy.h:1302
const Cut kNue2018CVNVsCosPIDLP([](const caf::SRProxy *sr){if(kNue2018CVNVsCosPID(sr)) return false;if(kIsRHC(sr)) return kNue2018CVNVsCosPIDRHCLP(sr);else return kNue2018CVNVsCosPIDFHCLP(sr);})
Definition: NueCuts2018.h:104
const XML_Char int const XML_Char * value
Definition: expat.h:331
const Var kNueEnergy2018([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;if(kIsRHC(sr)) return kNueEnergyRHC(sr);else return kNueEnergyFHC(sr);})
Definition: NueEnergy2018.h:25
const Var kNue2018SelectionBin([](const caf::SRProxy *sr){bool isPeri=kNue2018FDPeripheral(sr);double cvn=sr->sel.cvnProd3Train.nueid;if(isPeri) return float(3.5);if(cvn > 0.75 &&cvn< 0.87) return float(0.5);if(cvn > 0.87 &&cvn< 0.95) return float(1.5);if(cvn > 0.95) return float(2.5);return float(-0.5);})
const Cut Energy
const Cut kNue2018CVNVsCosPIDFHC
Definition: NueCuts2018.h:66
_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 Var kNue2018SelectionBin([](const caf::SRProxy *sr){bool isPeri=kNue2018FDPeripheral(sr);if(isPeri) return float(2.5);std::cout<< "ERROR::kNue2018SelectionBin. Looking for cvnProd3Train. Branch no longer exists."<< std::endl;abort();return float(-5.0);})
Definition: NueCuts2018.h:168
caf::Proxy< float > closestsliceminfromtop
Definition: SRProxy.h:1299
const Var kCVNSSe([](const caf::SRProxy *sr){throw std::runtime_error("kCVNSSe is no longer available. Fix your macro so you don't use it.");return-5.;})
2018 nue PID
Definition: Vars.h:52
const Cut kNue2018FDPeripheral(kNue2018FDPeripheralFunc)
OStream cout
Definition: OStream.cxx:6
const Cut kNue2018CVNCutLP([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2018RHCCVNCutLP(sr);else return kNue2018FHCCVNCutLP(sr);})
Definition: NueCuts2018.h:86
const Cut kNue2018CVNVsCosPID(kNue2018CVNVsCosPIDFunc)
const Cut kIsRHC([](const caf::SRProxy *sr){return sr->spill.isRHC;})
Definition: Vars.h:16
bool kNue2018CVNVsCosPIDFunc(const caf::SRProxy *sr)
Definition: NueCuts2018.cxx:34
bool kNue2018PeripheralPreselFunc(const caf::SRProxy *sr)
Definition: NueCuts2018.cxx:25
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
caf::Proxy< float > closestslicemindist
Definition: SRProxy.h:1294
assert(nhit_max >=nhit_nbins)
const double kNue2018CVNRHCHighEdge
Definition: NueCuts2018.h:44
const Cut kNearestSliceCosRej2018([](const caf::SRProxy *sr){const double hibin=kIsRHC(sr)?kNue2018CVNRHCHighEdge:kNue2018CVNFHCHighEdge;const double topcut=(kCVNSSe(sr) >=hibin)?50:400;return(fabs(sr->slc.closestslicetime) >=100|| sr->slc.closestsliceminfromtop >=topcut|| sr->slc.closestslicemindist >=500);})
Definition: NueCuts2018.h:51
const Cut kNue2018CorePart
Definition: NueCuts2018.h:29
Template for Cut and SpillCut.
Definition: Cut.h:15
bool kNue2018FDPeripheralFunc(const caf::SRProxy *sr)
Use this cut for the full FD Peripheral sample, the same for RHC and FHC.
Definition: NueCuts2018.cxx:41
const Cut kNue2018FHCCVNCut
Definition: NueCuts2018.h:46