NuebarCCIncVars.cxx
Go to the documentation of this file.
2 
4 
6 
10 
13 
14 //#include "TMath.h"
15 #include "TVector3.h"
16 
17 //#include "TFile.h"
18 
19 namespace nuebarccinc
20 {
21  const ana::Var kNProngs([](const caf::SRProxy* sr)->int
22  {
23  if(!sr->vtx.elastic.IsValid) return -5;
24  return sr->vtx.elastic.fuzzyk.npng;
25  });
26 
27  const ana::Var kNHits([](const caf::SRProxy* sr)
28  {
29  return sr->slc.nhit;
30  });
31 
32 
33  // some basic kinematic vars
37 
39  {
40  int npngs = sr->vtx.elastic.fuzzyk.npng;
41  for(auto ipng = 0; ipng < npngs; ipng++)
42  if(abs(sr->vtx.elastic.fuzzyk.png[ipng].truth.pdg) == 11)
43  return ipng;
44  return -1;
45  }
46 
47  ////////////////////////////////////////////////////////////////////
48  //Analysis Variables
49  ////////////////////////////////////////////////////////////////////
50  const ana::Var kMuonID = ana::Var([](const caf::SRProxy*sr)
51  {
52  auto besttrk = sr->trk.kalman.idxmuonid;
53  if(besttrk >= sr->trk.kalman.tracks.size()) return -5.0f;
54 
55  return (float) sr->trk.kalman.tracks[besttrk].muonid;
56  });
57 
58  const ana::Var kCVNNueID = SIMPLEVAR(sel.cvnoldpresel.nueid);
59 
60  const ana::Var kRecoElectronCosTheta([](const caf::SRProxy* sr)->float
61  {
62  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
63  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
64 
65  TVector3 elecdir =
66  (TVector3) sr->vtx.elastic.fuzzyk.png[0].dir;
67  TVector3 beamdir =
69  return elecdir.Dot(beamdir);
70  });
71 
72 
73  const ana::Var kRecoElectronTheta([](const caf::SRProxy* sr)->float
74  {
75  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
76  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
77 
78  TVector3 elecdir =
79  (TVector3) sr->vtx.elastic.fuzzyk.png[0].dir;
80  TVector3 beamdir =
82  float theta = elecdir.Dot(beamdir);
83  return (float)TMath::ACos(theta) * 180/TMath::Pi();
84  });
85 
86  const ana::Var kElectronEFHCTuned([](const caf::SRProxy* sr) ->float
87  {
88  /*
89  double p0 = -0.0249;
90  double p1 = 0.251699;
91  double p2 = -0.0516;
92  double p3 = 0.00265349;
93  */
94 
95  double p0 = -0.10588;
96  double p1 = 0.57885;
97  double p2 = -0.408767;
98  double p3 = 0.153795;
99  double p4 = -0.0270565;
100  double p5 = 0.00171687;
101 
102  float energy = -1000.f;
103  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
104  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
105  float x = (sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);
106 
107  if(x < 0) return 0.0f;
108 
109  if(x <= 6)
110  energy = x - (p0 + x*p1 + p2*pow(x,2) +
111  p3*pow(x,3) + p4*pow(x,4) +
112  p5*pow(x,5));
113  else energy = x;
114 
115  if(energy < 0) energy = x;
116 
117  return energy;
118  });
119 
120  const ana::Var kElectronERHCTuned([](const caf::SRProxy* sr) ->float
121  {
122  // Chi2 = 4.78147
123  // NDf = 57
124  // p0 = -0.0861793 +/- 0.0460596
125  // p1 = 0.235812 +/- 0.0506663
126  // p2 = -0.0348964 +/- 0.0102995
127 
128  double p0 = -0.0861793;
129  double p1 = 0.235812;
130  double p2 = -0.0348964;
131 
132  float energy = -1000.f;
133  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
134  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
135  float x = (sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);
136 
137  if(x < 0) return 0.0f;
138  if(x <= 6)
139  energy = x - (p0 + x*p1 + p2*pow(x,2));
140  else energy = x;
141 
142  if(energy < 0) energy = x;
143 
144  return energy;
145  });
146 
147  const ana::Var kElectronEUntuned([](const caf::SRProxy* sr) ->float
148  {
149  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
150  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
151  float x = (sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);
152  return x;
153  });
154 
155  ////////////////////////////////////////////////////////////////////
156  //Analysis Variables, true electron
157  ////////////////////////////////////////////////////////////////////
158  const ana::Var kTrueElectronRecoCosTheta([](const caf::SRProxy* sr)->float
159  {
160  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
161  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
162  int true_electron_idx = true_electron_png(sr);
163  if(true_electron_idx < 0) return -5.f;
164  TVector3 elecdir =
165  (TVector3) sr->vtx.elastic.fuzzyk.png[true_electron_idx].dir;
166  TVector3 beamdir =
168  return elecdir.Dot(beamdir);
169  });
170 
171 
172  const ana::Var kTrueElectronRecoTheta([](const caf::SRProxy* sr)->float
173  {
174  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
175  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
176  int true_electron_idx = true_electron_png(sr);
177  if(true_electron_idx < 0) return -5.f;
178  TVector3 elecdir =
179  (TVector3) sr->vtx.elastic.fuzzyk.png[true_electron_idx].dir;
180  TVector3 beamdir =
182  float theta = elecdir.Dot(beamdir);
183  return (float)TMath::ACos(theta) * 180/TMath::Pi();
184  });
185 
186  const ana::Var kTrueElectronRecoEFHCTuned([](const caf::SRProxy* sr) ->float
187  {
188  double p0 = -0.10588;
189  double p1 = 0.57885;
190  double p2 = -0.408767;
191  double p3 = 0.153795;
192  double p4 = -0.0270565;
193  double p5 = 0.00171687;
194 
195  float energy = -1000.f;
196  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
197  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
198  int true_electron_idx = true_electron_png(sr);
199  if(true_electron_idx < 0) return -5.f;
200  float x = (sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);
201 
202  if(x < 0) return 0.0f;
203 
204  if(x <= 6)
205  energy = x - (p0 + x*p1 + p2*pow(x,2) +
206  p3*pow(x,3) + p4*pow(x,4) +
207  p5*pow(x,5));
208  else energy = x;
209 
210  if(energy < 0) energy = x;
211 
212  return energy;
213  });
214 
215  const ana::Var kTrueElectronRecoERHCTuned([](const caf::SRProxy* sr) ->float
216  {
217  // Chi2 = 4.78147
218  // NDf = 57
219  // p0 = -0.0861793 +/- 0.0460596
220  // p1 = 0.235812 +/- 0.0506663
221  // p2 = -0.0348964 +/- 0.0102995
222 
223  double p0 = -0.0861793;
224  double p1 = 0.235812;
225  double p2 = -0.0348964;
226 
227  float energy = -1000.f;
228  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
229  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
230  int true_electron_idx = true_electron_png(sr);
231  if(true_electron_idx < 0) return -5.f;
232  float x = (sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);
233 
234  if(x < 0) return 0.0f;
235 
236  if(x <= 6)
237  energy = x - (p0 + x*p1 + p2*pow(x,2));
238  else energy = x;
239 
240  if(energy < 0) energy = x;
241 
242  return energy;
243  });
244 
245  const ana::Var kTrueElectronRecoEUntuned([](const caf::SRProxy* sr) ->float
246  {
247  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
248  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
249 
250  int true_electron_idx = true_electron_png(sr);
251  if(true_electron_idx < 0) return -5.f;
252  float x = (sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);
253  return x;
254  });
255 
256  const ana::Var kRecoQ2
257  ([] (const caf::SRProxy * sr)
258  {
259  const double M_e_sqrd = std::pow(0.000511,2); //(0.511MeV)
260  double E_e = kElectronE(sr);
261  double E_nu = kRecoNeutrinoE(sr);
262  double cos_e = kRecoElectronCosTheta(sr);
263  double p_e = std::sqrt(std::pow(E_e,2) - M_e_sqrd);
264  return 2 * E_nu * (E_e - p_e * cos_e) - M_e_sqrd;
265  });
266 
267  ////////////////////////////////////////////////////////////////////
268  //Prong CVN stuff
269  ////////////////////////////////////////////////////////////////////
270 
271  const ana::Var kProngCVNElectronScore([](const caf::SRProxy* sr){
272  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
273  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
274 
275  int nProngs = sr->vtx.elastic.fuzzyk.npng;
276  float maxProngCVNe = -5.;
277  for(int iProng = 0; iProng < nProngs; iProng++){
278  if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid >
279  maxProngCVNe) {
280  maxProngCVNe =
281  sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;
282  }
283  }
284  return maxProngCVNe;
285  });
286 
287  const ana::Var kProngCVNElectronE([](const caf::SRProxy* sr){
288  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
289  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
290 
291  int nProngs = sr->vtx.elastic.fuzzyk.npng;
292  float maxProngCVNe = -5.;
293  float maxProngCVNe_ElecE = -5.;
294  for(int iProng = 0; iProng < nProngs; iProng++){
295  if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid >
296  maxProngCVNe) {
297  maxProngCVNe =
298  sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;
299  maxProngCVNe_ElecE =
300  sr->vtx.elastic.fuzzyk.png[iProng].calE;
301  }
302  }
303  return maxProngCVNe_ElecE;
304  });
305 
306  const ana::Var kProngCVNElectronCosTheta([](const caf::SRProxy* sr){
307  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
308  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
309 
310  int nProngs = sr->vtx.elastic.fuzzyk.npng;
311  float maxProngCVNe = -5.;
312  TVector3 elecdir = {0,0,0};
313  for(int iProng = 0; iProng < nProngs; iProng++){
314  if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid >
315  maxProngCVNe) {
316  maxProngCVNe =
317  sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;
318  elecdir = (TVector3) sr->vtx.elastic.fuzzyk.png[iProng].dir;
319  }
320  }
321  if(maxProngCVNe == -5) return -5.f;
322  TVector3 beamdir = ana::NuMIBeamDirection(caf::kNEARDET);
323  return (float)elecdir.Dot(beamdir);
324  });
325 
326  const ana::Var kProngCVNElectronTheta([](const caf::SRProxy* sr){
327  if ( !sr->vtx.elastic.IsValid ) return -1000.f;
328  if (sr->vtx.elastic.fuzzyk.npng < 1) return -1000.f;
329 
330  int nProngs = sr->vtx.elastic.fuzzyk.npng;
331  float maxProngCVNe = -5.;
332  TVector3 elecdir = {0,0,0};
333  for(int iProng = 0; iProng < nProngs; iProng++){
334  if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid >
335  maxProngCVNe) {
336  maxProngCVNe =
337  sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;
338  elecdir = (TVector3) sr->vtx.elastic.fuzzyk.png[iProng].dir;
339  }
340  }
341  if(maxProngCVNe == -5) return -5.f;
342  TVector3 beamdir = ana::NuMIBeamDirection(caf::kNEARDET);
343  float theta = elecdir.Dot(beamdir);
344  return (float)(TMath::ACos(theta)*180/TMath::Pi());
345  });
346 
347  ////////////////////////////////////////////////////////////////////
348  //MC Truth Variables
349  ////////////////////////////////////////////////////////////////////
352 
354 
356  {
357  float ee = -5;
358  int nprims = nu->prim.size();
359  for(int iprim = 0; iprim < nprims; iprim++){
360  if(abs(nu->prim[iprim].pdg) == 11){
361  double E= nu->prim[iprim].p.E;
362  ee = E;
363  }
364  }//end loop over primaries
365 
366  return ee;
367  });
368 
370  {
371  int nprims = nu->prim.size();
372  for(int iprim = 0; iprim < nprims; iprim++){
373  if(abs(nu->prim[iprim].pdg) == 11){
374 
375  TVector3 edir = nu->prim[iprim].p.Vect();
376  TVector3 beamdir = ana::NuMIBeamDirection(caf::kNEARDET);
377 
378  return edir.Unit().Dot(beamdir.Unit());
379 
380  }
381  }
382  return -5.0;
383  });
384 
386  {
387 
388  if(abs(nu->pdg) != 12 ||
389  !nu->iscc)
390  return -5.0;
391  int nprims = nu->prim.size();
392  for(int iprim = 0; iprim < nprims; iprim++){
393  if(abs(nu->prim[iprim].pdg) == 11){
394 
395  TVector3 edir = nu->prim[iprim].p.Vect();
396  TVector3 beamdir = ana::NuMIBeamDirection(caf::kNEARDET);
397 
398  float theta = edir.Unit().Dot(beamdir.Unit());
399  return (float)TMath::ACos(theta)*180/TMath::Pi();
400  }
401  }
402  return -5.0;
403  });
404 
405 }
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
Near Detector underground.
Definition: SREnums.h:10
const ana::Var kCVNNueID
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
const ana::Var kNHits([](const caf::SRProxy *sr){return sr->slc.nhit;})
const ana::Var kProngCVNElectronCosTheta([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic.fuzzyk.npng;float maxProngCVNe=-5.;TVector3 elecdir={0, 0, 0};for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[iProng].dir;}}if(maxProngCVNe==-5) return-5.f;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);return(float) elecdir.Dot(beamdir);})
const ana::Var kTrueElectronRecoERHCTuned([](const caf::SRProxy *sr) ->float{ double p0=-0.0861793;double p1=0.235812;double p2=-0.0348964;float energy=-1000.f;if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int true_electron_idx=true_electron_png(sr);if(true_electron_idx< 0) return-5.f;float x=(sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);if(x< 0) return 0.0f;if(x<=6) energy=x-(p0+x *p1+p2 *pow(x, 2));else energy=x;if(energy< 0) energy=x;return energy;})
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
const ana::Var kElectronERHCTuned([](const caf::SRProxy *sr) ->float{ double p0=-0.0861793;double p1=0.235812;double p2=-0.0348964;float energy=-1000.f;if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;float x=(sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);if(x< 0) return 0.0f;if(x<=6) energy=x-(p0+x *p1+p2 *pow(x, 2));else energy=x;if(energy< 0) energy=x;return energy;})
const ana::NuTruthVar kTrueVtxYST
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
void abs(TH1 *hist)
const ana::Var kTrueElectronRecoCosTheta([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int true_electron_idx=true_electron_png(sr);if(true_electron_idx< 0) return-5.f;TVector3 elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[true_electron_idx].dir;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);return elecdir.Dot(beamdir);})
const ana::NuTruthVar kTrueVtxXST
_Var< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:74
const ana::NuTruthVar kTrueNeutrinoEST
const ana::NuTruthVar kTrueHadronicYST
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
Double_t q2[12][num]
Definition: f2_nu.C:137
const ana::Var kElectronE
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
if(dump)
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
Float_t E
Definition: plot.C:20
caf::Proxy< bool > iscc
Definition: SRProxy.h:538
double energy
Definition: plottest35.C:25
const ana::Var kRecoElectronTheta([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;TVector3 elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[0].dir;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);float theta=elecdir.Dot(beamdir);return(float) TMath::ACos(theta)*180/TMath::Pi();})
caf::StandardRecord * sr
#define SIMPLENUTRUTHVAR(CAFNAME)
Definition: Var.h:89
caf::Proxy< unsigned int > idxmuonid
Definition: SRProxy.h:1776
const ana::Var kTrueElectronRecoEFHCTuned([](const caf::SRProxy *sr) ->float{double p0=-0.10588;double p1=0.57885;double p2=-0.408767;double p3=0.153795;double p4=-0.0270565;double p5=0.00171687;float energy=-1000.f;if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int true_electron_idx=true_electron_png(sr);if(true_electron_idx< 0) return-5.f;float x=(sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);if(x< 0) return 0.0f;if(x<=6) energy=x-(p0+x *p1+p2 *pow(x, 2)+p3 *pow(x, 3)+p4 *pow(x, 4)+p5 *pow(x, 5));else energy=x;if(energy< 0) energy=x;return energy;})
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
const ana::Var kProngCVNElectronTheta([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic.fuzzyk.npng;float maxProngCVNe=-5.;TVector3 elecdir={0, 0, 0};for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[iProng].dir;}}if(maxProngCVNe==-5) return-5.f;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);float theta=elecdir.Dot(beamdir);return(float)(TMath::ACos(theta)*180/TMath::Pi());})
const ana::Var kElectronEUntuned([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;float x=(sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);return x;})
const ana::NuTruthVar kTrueVtxZST
const ana::Var kNProngs([](const caf::SRProxy *sr) ->int{if(!sr->vtx.elastic.IsValid) return-5;return sr->vtx.elastic.fuzzyk.npng;})
TVector3 NuMIBeamDirection(caf::Det_t det)
Average direction of NuMI neutrinos in a given detector This function is a copy of geo::GeometryBase:...
Definition: Utilities.cxx:329
const ana::Var kProngCVNElectronScore([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic.fuzzyk.npng;float maxProngCVNe=-5.;for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;}}return maxProngCVNe;})
const ana::Var kTrueElectronRecoEUntuned([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int true_electron_idx=true_electron_png(sr);if(true_electron_idx< 0) return-5.f;float x=(sr->vtx.elastic.fuzzyk.png[true_electron_idx].shwlid.shwE);return x;})
caf::Proxy< short int > pdg
Definition: SRProxy.h:552
const ana::Var kProngCVNElectronE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic.fuzzyk.npng;float maxProngCVNe=-5.;float maxProngCVNe_ElecE=-5.;for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic.fuzzyk.png[iProng].cvnpart.electronid;maxProngCVNe_ElecE=sr->vtx.elastic.fuzzyk.png[iProng].calE;}}return maxProngCVNe_ElecE;})
int true_electron_png(const caf::SRProxy *sr)
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const ana::Var kElectronEFHCTuned([](const caf::SRProxy *sr) ->float{double p0=-0.10588;double p1=0.57885;double p2=-0.408767;double p3=0.153795;double p4=-0.0270565;double p5=0.00171687;float energy=-1000.f;if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;float x=(sr->vtx.elastic.fuzzyk.png[0].shwlid.shwE);if(x< 0) return 0.0f;if(x<=6) energy=x-(p0+x *p1+p2 *pow(x, 2)+p3 *pow(x, 3)+p4 *pow(x, 4)+p5 *pow(x, 5));else energy=x;if(energy< 0) energy=x;return energy;})
const ana::NuTruthVar kTrueElectronThetaST([](const caf::SRNeutrinoProxy *nu){if(abs(nu->pdg)!=12|| !nu->iscc) return-5.0;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11){TVector3 edir=nu->prim[iprim].p.Vect();TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);float theta=edir.Unit().Dot(beamdir.Unit());return(float) TMath::ACos(theta)*180/TMath::Pi();}}return-5.0;})
const ana::Var kMuonID
const ana::NuTruthVar kTrueQ2ST
const ana::Var kRecoNeutrinoE
const ana::Var kTrueElectronRecoTheta([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;int true_electron_idx=true_electron_png(sr);if(true_electron_idx< 0) return-5.f;TVector3 elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[true_electron_idx].dir;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);float theta=elecdir.Dot(beamdir);return(float) TMath::ACos(theta)*180/TMath::Pi();})
const ana::Var kRecoElectronCosTheta([](const caf::SRProxy *sr) ->float{if(!sr->vtx.elastic.IsValid) return-1000.f;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1000.f;TVector3 elecdir=(TVector3) sr->vtx.elastic.fuzzyk.png[0].dir;TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);return elecdir.Dot(beamdir);})
caf::Proxy< std::vector< caf::SRTrueParticle > > prim
Definition: SRProxy.h:555
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_e_sqrd=std::pow(0.000511, 2);double E_e=kElectronE(sr);double E_nu=kRecoNeutrinoE(sr);double cos_e=kRecoElectronCosTheta(sr);double p_e=std::sqrt(std::pow(E_e, 2)-M_e_sqrd);return 2 *E_nu *(E_e-p_e *cos_e)-M_e_sqrd;})
const ana::NuTruthVar kTrueElectronCosThetaST([](const caf::SRNeutrinoProxy *nu){int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11){TVector3 edir=nu->prim[iprim].p.Vect();TVector3 beamdir=ana::NuMIBeamDirection(caf::kNEARDET);return edir.Unit().Dot(beamdir.Unit());}}return-5.0;})
const ana::NuTruthVar kTrueElectronEST([](const caf::SRNeutrinoProxy *nu){float ee=-5;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11){double E=nu->prim[iprim].p.E;ee=E;}}return ee;})