NumuVars.cxx
Go to the documentation of this file.
1 #include <vector>
2 #include <iostream>
3 #include "TH1.h"
4 #include "TFile.h"
5 #include "CAFAna/Vars/Vars.h"
7 
9 
10 #include "Utilities/func/MathUtil.h"
11 
13 
14 #include <cassert>
15 
16 #include "TVector3.h"
17 
18 namespace
19 {
22 }
23 
24 namespace ana
25 {
26  const Var kNonQEE = SIMPLEVAR(energy.numu.trknonqeE);
27 
28  const Var kQEE = SIMPLEVAR(energy.numu.trkqeE);
29 
30  const Var kSliceTime(
31  [](const caf::SRProxy *sr)
32  {
33  return sr->slc.meantime/1000;
34  });
35 
36  const Var kSliceDuration(
37  [](const caf::SRProxy *sr)
38  {
39  return (sr->slc.endtime - sr->slc.starttime);
40  });
41 
42  const Var kDirX([](const caf::SRProxy *sr)
43  {
44  if(sr->trk.kalman.ntracks < 1) return -5.f;
45  return sr->trk.kalman.tracks[0].dir.X();
46  });
47 
48  const Var kDirY([](const caf::SRProxy *sr)
49  {
50  if(sr->trk.kalman.ntracks < 1) return -5.f;
51  return sr->trk.kalman.tracks[0].dir.Y();
52  });
53 
54  const Var kcosDirY([](const caf::SRProxy *sr)
55  {
56  if(sr->trk.kalman.ntracks < 1) return -5.f;
57  return (float)cos( kDirY(sr) );
58  });
59 
60  const Var kDirZ([](const caf::SRProxy *sr)
61  {
62  if(sr->trk.kalman.ntracks < 1) return -5.f;
63  return sr->trk.kalman.tracks[0].dir.Z();
64  });
65 
66  const Var kCosNumi(
67  [](const caf::SRProxy *sr)
68  {
69  if (sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999){
70  if (sr->hdr.det == 1){
71  return sr->trk.kalman.tracks[0].dir.Dot(beamDirND);
72  }
73  if (sr->hdr.det == 2){
74  return sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);
75  }
76  }
77  return -5.f;
78  });
79 
80  const Var kRecoThetaMu(
81  []( const caf::SRProxy* sr )
82  {
83  return acos( kCosNumi( sr ) ) * 180.0 / 3.1416;
84  });
85 
86  const Var kNumuMuonPtP([](const caf::SRProxy *sr) {
87  if (sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999){
88  if (sr->hdr.det == 1){
89  double Zbeam = sr->trk.kalman.tracks[0].dir.Dot(beamDirND);
90  double ptp = sqrt(1 - Zbeam*Zbeam);
91  return (float)ptp;
92  }
93  if (sr->hdr.det == 2){
94  double Zbeam = sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);
95  double ptp = sqrt(1 - Zbeam*Zbeam);
96  return (float)ptp;
97  }
98  }
99  return -5.f;
100  });
101 
102  const Var kNumuMuonPt(
103  []( const caf::SRProxy* sr )
104  {
105  if ( sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999 )
106  {
107  // Important: Use kMuE to pick up muon energy scale systematics
108  double pmu = sqrt( util::sqr( kMuE( sr ) ) - util::sqr( 0.1056 ) );
109  double Zbeam = kCosNumi( sr );
110  double pt = pmu * sqrt( 1 - Zbeam * Zbeam );
111  return (float)pt;
112  }
113  return -5.f;
114  });
115 
116  const Var kTrkStartX(
117  [](const caf::SRProxy *sr)
118  {
119  if(sr->trk.kalman.ntracks < 1)
120  return -10.0f;
121  return sr->trk.kalman.tracks[0].start.X()/100;
122  });
123  const Var kTrkStartY(
124  [](const caf::SRProxy *sr)
125  {
126  if(sr->trk.kalman.ntracks < 1)
127  return -10.0f;
128  return sr->trk.kalman.tracks[0].start.Y()/100;
129  });
130  const Var kTrkStartZ(
131  [](const caf::SRProxy *sr)
132  {
133  if(sr->trk.kalman.ntracks < 1)
134  return -10.0f;
135  return sr->trk.kalman.tracks[0].start.Z()/100;
136  });
137 
138  const Var kTrkEndX(
139  [](const caf::SRProxy *sr)
140  {
141  if(sr->trk.kalman.ntracks < 1)
142  return -10.0f;
143  return sr->trk.kalman.tracks[0].stop.X()/100;
144  });
145  const Var kTrkEndY(
146  [](const caf::SRProxy *sr)
147  {
148  if(sr->trk.kalman.ntracks < 1)
149  return -10.0f;
150  return sr->trk.kalman.tracks[0].stop.Y()/100;
151  });
152  const Var kTrkEndZ(
153  [](const caf::SRProxy *sr)
154  {
155  if(sr->trk.kalman.ntracks < 1)
156  return -10.0f;
157  return sr->trk.kalman.tracks[0].stop.Z()/100;
158  });
159 
160  const Var kTrkNhits(
161  [](const caf::SRProxy *sr)
162  {
163  if(sr->trk.kalman.ntracks < 1)
164  return 65535;
165  return int(sr->trk.kalman.tracks[0].nhit);
166  });
167 
168  const Var kHadNHit(
169  [](const caf::SRProxy *sr)
170  {
171  unsigned int nought = 0;
172  if(sr->trk.kalman.ntracks < 1) return nought;
173  return sr->slc.nhit - sr->trk.kalman.tracks[0].nhit;
174 
175  });
176 
177  const Var kHadEPerNHit(
178  [](const caf::SRProxy *sr)
179  {
180 
181  if(sr->trk.kalman.ntracks < 1) return 0.0f;
182  int nHit= sr->slc.nhit - sr->trk.kalman.tracks[0].nhit;
183  if(nHit<=0) return 0.0f;
184  float hadE = sr->energy.numu.hadcalE;
185  return hadE/nHit;
186 
187  });
188 
189  const Var kTrkLength(
190  [](const caf::SRProxy *sr)
191  {
192  if(sr->trk.kalman.ntracks < 1) return -5.f;
193  return sr->trk.kalman.tracks[0].len / 100;
194  });
195 
196  const Var kTrkCalE(
197  [](const caf::SRProxy *sr)
198  {
199  if(sr->trk.kalman.ntracks < 1) return 0.f;
200  return float(sr->trk.kalman.tracks[0].calE);
201  });
202 
203  const Var kTrkCalEPerNHit(
204  [](const caf::SRProxy *sr)
205  {
206  if(sr->trk.kalman.ntracks < 1) return 0.f;
207  return sr->trk.kalman.tracks[0].calE /
208  sr->trk.kalman.tracks[0].nhit;
209  });
210 
211  const Var kMuEPerNHit(
212  [](const caf::SRProxy *sr)
213  {
214  if(sr->trk.kalman.ntracks < 1) return 0.f;
215  return (float)kMuE(sr) / sr->trk.kalman.tracks[0].nhit;
216  });
217 
218  const Var kCosBackDist(
219  [](const caf::SRProxy *sr)
220  {
221  return sr->sel.contain.cosbakdist / 100.; // Nicer in m
222  });
223  const Var kCosFwdDist(
224  [](const caf::SRProxy *sr)
225  {
226  return sr->sel.contain.cosfwddist / 100.; // Nicer in m
227  });
228 
229  const Var kKalmanFwdDist(
230  [](const caf::SRProxy *sr)
231  {
232  return sr->sel.contain.kalfwddist / 100.; // Nicer in m
233  });
234  const Var kKalmanBackDist(
235  [](const caf::SRProxy *sr)
236  {
237  return sr->sel.contain.kalbakdist / 100.; // Nicer in m
238  });
239 
240  const Var kNonQeHadE(
241  [](const caf::SRProxy *sr)
242  {
243  if (sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999)
244  return float(sr->energy.numu.recotrkcchadE);
245  return -5.f;
246  });
247 
248  const Var kQeHadE(
249  [](const caf::SRProxy *sr)
250  {
251  if (sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999)
252  return sr->energy.numu.trkqeE - sr->energy.numu.recomuonE;
253  return -5.f;
254  });
255 
256  const Var kSlcUnCalibNHit(
257  [](const caf::SRProxy *sr)
258  {
259  return sr->slc.nhit - sr->slc.ncalhit;
260  });
261 
262  const Var kSlcMeanTime(
263  [](const caf::SRProxy *sr)
264  {
265  return sr->slc.meantime / 1000.; // Nicer in \mu s
266  });
267 
268  const Var kSlcStartTime(
269  [](const caf::SRProxy *sr)
270  {
271  return sr->slc.starttime / 1000.; // Nicer in \mu s
272  });
273 
274  const Var kSlcEndTime(
275  [](const caf::SRProxy *sr)
276  {
277  return sr->slc.endtime / 1000.; // Nicer in \mu s
278  });
279 
280  const Var kSlcMinX(
281  [](const caf::SRProxy *sr)
282  {
283  return sr->slc.boxmin.X() / 100.; // Nicer in m
284  });
285 
286  const Var kSlcMinY(
287  [](const caf::SRProxy *sr)
288  {
289  return sr->slc.boxmin.Y() / 100.; // Nicer in m
290  });
291 
292  const Var kSlcMinZ(
293  [](const caf::SRProxy *sr)
294  {
295  return sr->slc.boxmin.Z() / 100.; // Nicer in m
296  });
297 
298  const Var kSlcMaxX(
299  [](const caf::SRProxy *sr)
300  {
301  return sr->slc.boxmax.X() / 100.; // Nicer in m
302  });
303 
304  const Var kSlcMaxY(
305  [](const caf::SRProxy *sr)
306  {
307  return sr->slc.boxmax.Y() / 100.; // Nicer in m
308  });
309 
310  const Var kSlcMaxZ(
311  [](const caf::SRProxy *sr)
312  {
313  return sr->slc.boxmax.Z() / 100.; // Nicer in m
314  });
315 
316  const Var kSlcExtentX(
317  [](const caf::SRProxy *sr)
318  {
319  return (sr->slc.boxmax.X() - sr->slc.boxmin.X())/ 100.; // Nicer in m
320  });
321 
322  const Var kSlcExtentY(
323  [](const caf::SRProxy *sr)
324  {
325  return (sr->slc.boxmax.Y() - sr->slc.boxmin.Y())/ 100.; // Nicer in m
326  });
327 
328  const Var kSlcExtentZ(
329  [](const caf::SRProxy *sr)
330  {
331  return (sr->slc.boxmax.Z() - sr->slc.boxmin.Z())/ 100.; // Nicer in m
332  });
333 
334  const Var kTrkNPlaneGap(
335  [](const caf::SRProxy *sr)
336  {
337  if (sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999)
338  return int(sr->trk.kalman.tracks[0].nplanegap);
339  return 500;
340  });
341 
342  const Var kSlcCalEPerNHit(
343  [](const caf::SRProxy *sr)
344  {
345  if (sr->slc.nhit > 0) return sr->slc.calE / (1.78 * sr->slc.nhit);
346  return -5.;
347  });
348 
349  // const Var kNumuHadVisE(
350  // [](const caf::SRProxy *sr)
351  // {
352  // return sr->energy.numu.hadcalE + sr->energy.numu.hadtrkE;
353  // });
354 
355  //**********Variables useful for making muon energy resolution plots
356 
357  const Var kVisTrkCalE(
358  [](const caf::SRProxy *sr)
359  {
360  if(sr->trk.kalman.ntracks < 1) return 0.;
361  if(sr->energy.numu.trkccE <= 0) return 0.;
362  if(sr->energy.numu.hadtrkE < 0) return 0.;
363  return ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
364  });
365 
366  const Var kTrueMuonE(
367  [](const caf::SRProxy *sr)
368  {
369  if(sr->mc.nnu == 0) return 0.f;
370  if(sr->mc.nu[0].prim.empty()) return 0.f;
371  if(std::abs(sr->mc.nu[0].prim[0].pdg) != 13) return 0.f;
372  return float(sr->mc.nu[0].prim[0].p.E);
373  });
374 
376  [](const caf::SRProxy *sr)
377  {
378  if(sr->trk.kalman.ntracks < 1) return 0.f;
379  if(sr->energy.numu.trkccE <= 0) return 0.f;
380  if(sr->energy.numu.hadtrkE < 0) return 0.f;
381  return float(sr->energy.numu.recomuonE);
382  });
383 
385  [](const caf::SRProxy *sr)
386  {
387  if(sr->trk.kalman.ntracks < 1) return 0.;
388  if(sr->energy.numu.trkccE <= 0) return 0.;
389  if(sr->energy.numu.hadtrkE < 0) return 0.;
390  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
391  double offset = 0.32;
392  double slope1 = 1.01;
393  double slope2 = 1.504;
394  double stitch = 0.315;
395  if (visE<stitch){
396  return(visE*slope1 + offset);
397  }
398  else{
399  return(visE*slope2 + ((slope1-slope2)*stitch + offset));
400  }
401  });
402 
404  [](const caf::SRProxy *sr)
405  {
406  if(sr->trk.kalman.ntracks < 1) return 0.;
407  if(sr->energy.numu.trkccE <= 0) return 0.;
408  if(sr->energy.numu.hadtrkE < 0) return 0.;
409  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
410  double offset = 0.222;
411  double slope1 = 1.14;
412  double slope2 = 1.475;
413  double stitch = 0.312;
414  if (visE<stitch){
415  return(visE*slope1 + offset);
416  }
417  else{
418  return(visE*slope2 + ((slope1-slope2)*stitch + offset));
419  }
420  });
421 
423  [](const caf::SRProxy *sr)
424  {
425  if(sr->trk.kalman.ntracks < 1) return -1.;
426  if(sr->energy.numu.trkccE <= 0) return -1.;
427  if(sr->energy.numu.hadtrkE < 0) return -1.;
428  if(sr->mc.nnu == 0) return -1.;
429  if(sr->mc.nu[0].prim.empty()) return -1.;
430  if(std::abs(sr->mc.nu[0].prim[0].pdg) != 13) return -1.;
431  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
432  double offset = 0.32;
433  double slope1 = 1.01;
434  double slope2 = 1.504;
435  double stitch = 0.315;
436  double recoE = -5.0;
437  if (visE<stitch){
438  recoE = visE*slope1 + offset;
439  }
440  else{
441  recoE = visE*slope2 + ((slope1-slope2)*stitch + offset);
442  }
443  double trueE = sr->mc.nu[0].prim[0].p.E;
444  if (trueE <= 0.0) return -1.;
445  return((recoE - trueE)/trueE);
446  });
447 
449  [](const caf::SRProxy *sr)
450  {
451  if(sr->trk.kalman.ntracks < 1) return -1.;
452  if(sr->energy.numu.trkccE <= 0) return -1.;
453  if(sr->energy.numu.hadtrkE < 0) return -1.;
454  if(sr->mc.nnu == 0) return -1.;
455  if(sr->mc.nu[0].prim.empty()) return -1.;
456  if(std::abs(sr->mc.nu[0].prim[0].pdg) != 13) return -1.;
457  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
458  double offset = 0.222;
459  double slope1 = 1.14;
460  double slope2 = 1.475;
461  double stitch = 0.312;
462  double recoE = -5.0;
463  if (visE<stitch){
464  recoE = visE*slope1 + offset;
465  }
466  else{
467  recoE = visE*slope2 + ((slope1-slope2)*stitch + offset);
468  }
469  double trueE = sr->mc.nu[0].prim[0].p.E;
470  if (trueE <= 0.0) return -1.;
471  return((recoE - trueE)/trueE);
472  });
473 
475  [](const caf::SRProxy *sr)
476  {
477  if(sr->trk.kalman.ntracks < 1) return -1.;
478  if(sr->energy.numu.trkccE <= 0) return -1.;
479  if(sr->energy.numu.hadtrkE < 0) return -1.;
480  if(sr->mc.nnu == 0) return -1.;
481  if(sr->mc.nu[0].prim.empty()) return -1.;
482  if(std::abs(sr->mc.nu[0].prim[0].pdg) != 13) return -1.;
483  double recoE = sr->energy.numu.recomuonE;
484  double trueE = sr->mc.nu[0].prim[0].p.E;
485  if (trueE <= 0.0) return -1.;
486  return((recoE - trueE)/trueE);
487  });
488 
489  const Var kMuonRecoRelRecoFD(
490  [](const caf::SRProxy *sr)
491  {
492  if(sr->trk.kalman.ntracks < 1) return -1.;
493  if(sr->energy.numu.trkccE <= 0) return -1.;
494  if(sr->energy.numu.hadtrkE < 0) return -1.;
495  if(sr->mc.nnu == 0) return -1.;
496  if(sr->mc.nu[0].prim.empty()) return -1.;
497  if(std::abs(sr->mc.nu[0].prim[0].pdg) != 13) return -1.;
498  double recoETrkLen = sr->energy.numu.recomuonE;
499  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
500  double offset = 0.32;
501  double slope1 = 1.01;
502  double slope2 = 1.504;
503  double stitch = 0.315;
504  double recoE = -5.0;
505  if (visE<stitch){
506  recoE = visE*slope1 + offset;
507  }
508  else{
509  recoE = visE*slope2 + ((slope1-slope2)*stitch + offset);
510  }
511  if (recoETrkLen <= 0.0) return -1.;
512  return((recoE - recoETrkLen)/recoETrkLen);
513  });
514 
515  const Var kMuonRecoRelRecoND(
516  [](const caf::SRProxy *sr)
517  {
518  if(sr->trk.kalman.ntracks < 1) return -1.;
519  if(sr->energy.numu.trkccE <= 0) return -1.;
520  if(sr->energy.numu.hadtrkE < 0) return -1.;
521  double recoETrkLen = sr->energy.numu.recomuonE;
522  double visE = ((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;
523  double offset = 0.222;
524  double slope1 = 1.14;
525  double slope2 = 1.475;
526  double stitch = 0.312;
527  double recoE = -5.0;
528  if (visE<stitch){
529  recoE = visE*slope1 + offset;
530  }
531  else{
532  recoE = visE*slope2 + ((slope1-slope2)*stitch + offset);
533  }
534  if (recoETrkLen <= 0.0) return -1.;
535  return((recoE - recoETrkLen)/recoETrkLen);
536  });
537 
538  const Var kNumuHadCalE = SIMPLEVAR(energy.numu.hadcalE);
539  const Var kNumuHadTrkE = SIMPLEVAR(energy.numu.hadtrkE);
540  const Var kNKalman = SIMPLEVAR(trk.kalman.ntracks);
541  const Var kNumuHadVisE(
542  [](const caf::SRProxy *sr)
543  {
544  return kNumuHadCalE(sr) + kNumuHadTrkE(sr);
545  });
546 
547  const Var kNumuCosRejAngleKal = SIMPLEVAR(sel.cosrej.anglekal);
548  const Var kNumuCosRejAngleCos = SIMPLEVAR(sel.cosrej.anglecos);
549  const Var kCosmicForwardCell = SIMPLEVAR(sel.contain.cosfwdcell);
550  const Var kCosmicBackwardCell = SIMPLEVAR(sel.contain.cosbakcell);
551  const Var kKalmanForwardCell = SIMPLEVAR(sel.contain.kalfwdcell);
552  const Var kKalmanBackwardCell = SIMPLEVAR(sel.contain.kalbakcell);
553  const Var kNumuContPID = SIMPLEVAR(sel.cosrej.numucontpid2020);
554  const Var kNumuContPID2019 = SIMPLEVAR(sel.cosrej.numucontpid2019);
555  const Var kReMIdScatLLH = SIMPLEVAR(sel.remid.scatllh);
556  const Var kReMIdDEDxLLH = SIMPLEVAR(sel.remid.dedxllh);
557  const Var kReMIdMeasFrac = SIMPLEVAR(sel.remid.measfrac);
558  const Var kNplanesToFront = SIMPLEVAR(sel.contain.nplanestofront);
559  const Var kNplanesToBack = SIMPLEVAR(sel.contain.nplanestoback);
560  const Var kNcellsFromEdge = SIMPLEVAR(slc.ncellsfromedge);
561  const Var kNonQeE = SIMPLEVAR(energy.numu.trknonqeE);
562  const Var kQeE = SIMPLEVAR(energy.numu.trkqeE);
563  const Var kQeAngleE = SIMPLEVAR(energy.numu.angleE);
564  const Var kDirScore = SIMPLEVAR(sel.cosrej.kdirscore);
565 
566  /// Reconstructed four-momentum transfer invariant (Q^2)
567  const ana::Var kRecoQ2
568  ([] (const caf::SRProxy * sr)
569  {
570  const double M_mu_sqrd = util::sqr(0.1056);
571  double E_mu = kMuE(sr);
572  double p_mu = sqrt(util::sqr(E_mu) - M_mu_sqrd);
573  return 2 * kCCE(sr) * ( E_mu - p_mu * kCosNumi(sr) ) - M_mu_sqrd;
574  }
575  );
576 
577  /// Reconstructed three-momentum transfer
578  const Var kRecoQmag
579  ([] (const caf::SRProxy * sr)
580  {
581  // because q0 is just the energy transferred to the hadronic system
582  return sqrt(kRecoQ2(sr) + util::sqr(kHadE(sr)));
583  }
584  );
585 
586  /// Reconstructed invariant mass (W)
587  const Var kRecoW(
588  [](const caf::SRProxy *sr)
589  {
590  const double M_p = 0.938272;
591  double WSq = M_p * M_p + 2 * M_p * (kCCE(sr) - kMuE(sr)) - kRecoQ2(sr);
592  if (WSq > 0)
593  return sqrt(WSq);
594  else
595  return -5.;
596  });
597 }
const Var kHadE
Definition: NumuVars.h:23
Near Detector underground.
Definition: SREnums.h:10
const Var kHadNHit([](const caf::SRProxy *sr){unsigned int nought=0;if(sr->trk.kalman.ntracks< 1) return nought;return sr->slc.nhit-sr->trk.kalman.tracks[0].nhit;})
Definition: NumuVars.h:61
const Var kDirScore
Definition: NumuVars.cxx:564
caf::Proxy< float > trkccE
Definition: SRProxy.h:195
const Var kNonQEE
Energy estimator for non quasielastic CC events.
Definition: NumuVars.cxx:26
const Var kNKalman
Definition: NumuVars.cxx:540
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_mu_sqrd=util::sqr(0.1056);double E_mu=kMuE(sr);double p_mu=sqrt(util::sqr(E_mu)-M_mu_sqrd);return 2 *kCCE(sr)*(E_mu-p_mu *kCosNumi(sr))-M_mu_sqrd;})
Reconstructed four-momentum transfer invariant (Q^2)
Definition: NumuVars.h:146
caf::Proxy< float > cosbakdist
Definition: SRProxy.h:807
Far Detector at Ash River.
Definition: SREnums.h:11
const Var kNcellsFromEdge
Definition: NumuVars.cxx:560
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kReMIdScatLLH
Definition: NumuVars.cxx:555
const Var kSlcMeanTime([](const caf::SRProxy *sr){return sr->slc.meantime/1000.;})
Definition: NumuVars.h:83
const Var kKalmanBackwardCell
Definition: NumuVars.cxx:552
const Var kNumuHadTrkE
Definition: NumuVars.cxx:539
const Var kNumuMuonPt([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999){double pmu=sqrt(util::sqr(kMuE(sr))-util::sqr(0.1056));double Zbeam=kCosNumi(sr);double pt=pmu *sqrt(1-Zbeam *Zbeam);return(float) pt;}return-5.f;})
Definition: NumuVars.h:47
caf::Proxy< unsigned int > idxremid
Definition: SRProxy.h:1777
const Var kSlcMaxZ([](const caf::SRProxy *sr){return sr->slc.boxmax.Z()/100.;})
Definition: NumuVars.h:93
const Var kSlcCalEPerNHit([](const caf::SRProxy *sr){if(sr->slc.nhit > 0) return sr->slc.calE/(1.78 *sr->slc.nhit);return-5.;})
Definition: NumuVars.h:101
const Var kSlcMaxY([](const caf::SRProxy *sr){return sr->slc.boxmax.Y()/100.;})
Definition: NumuVars.h:92
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
const Var kNumuContPID
Definition: NumuVars.cxx:553
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
caf::Proxy< float > starttime
Definition: SRProxy.h:1319
const Var kRecoQmag([](const caf::SRProxy *sr){return sqrt(kRecoQ2(sr)+util::sqr(kHadE(sr)));})
Reconstructed three-momentum transfer.
Definition: NumuVars.h:149
const Var kNumuCosRejAngleKal
Definition: NumuVars.cxx:547
const TVector3 beamDirND
caf::Proxy< caf::SRContain > contain
Definition: SRProxy.h:1251
caf::Proxy< caf::SRNumuEnergy > numu
Definition: SRProxy.h:214
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
T sqrt(T number)
Definition: d0nt_math.hpp:156
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
const Var kTrkStartY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.Y()/100;})
Definition: NumuVars.h:52
caf::Proxy< float > hadtrkE
Definition: SRProxy.h:171
const Var kSliceTime([](const caf::SRProxy *sr){return sr->slc.meantime/1000;})
Definition: NumuVars.h:34
const Var kCosBackDist([](const caf::SRProxy *sr){return sr->sel.contain.cosbakdist/100.;})
Definition: NumuVars.h:71
const Var kSliceDuration([](const caf::SRProxy *sr){return(sr->slc.endtime-sr->slc.starttime);})
Definition: NumuVars.h:35
const Var kCosFwdDist([](const caf::SRProxy *sr){return sr->sel.contain.cosfwddist/100.;})
Definition: NumuVars.h:72
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
const Var kSlcExtentY([](const caf::SRProxy *sr){return(sr->slc.boxmax.Y()-sr->slc.boxmin.Y())/100.;})
Definition: NumuVars.h:96
const Var kTrkCalEPerNHit([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.f;return sr->trk.kalman.tracks[0].calE/sr->trk.kalman.tracks[0].nhit;})
Definition: NumuVars.h:68
const Var kMuonRecoRelTrueTrkLen([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-1.;if(sr->energy.numu.trkccE<=0) return-1.;if(sr->energy.numu.hadtrkE< 0) return-1.;if(sr->mc.nnu==0) return-1.;if(sr->mc.nu[0].prim.empty()) return-1.;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return-1.;double recoE=sr->energy.numu.recomuonE;double trueE=sr->mc.nu[0].prim[0].p.E;if(trueE<=0.0) return-1.;return((recoE-trueE)/trueE);})
Definition: NumuVars.h:116
const Var kReMIdMeasFrac
Definition: NumuVars.cxx:557
caf::Proxy< caf::SREnergyBranch > energy
Definition: SRProxy.h:2136
T acos(T number)
Definition: d0nt_math.hpp:54
const Var kRecoMuonEFromVisEND([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.;if(sr->energy.numu.trkccE<=0) return 0.;if(sr->energy.numu.hadtrkE< 0) return 0.;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.222;double slope1=1.14;double slope2=1.475;double stitch=0.312;if(visE< stitch){return(visE *slope1+offset);}else{return(visE *slope2+((slope1-slope2)*stitch+offset));}})
Definition: NumuVars.h:112
const Var kDirZ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-5.f;return sr->trk.kalman.tracks[0].dir.Z();})
Definition: NumuVars.h:39
const Var kTrkLength([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-5.f;return sr->trk.kalman.tracks[0].len/100;})
Definition: NumuVars.h:65
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
const Var kSlcMinX([](const caf::SRProxy *sr){return sr->slc.boxmin.X()/100.;})
Definition: NumuVars.h:87
const Var kHadEPerNHit([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.0f;int nHit=sr->slc.nhit-sr->trk.kalman.tracks[0].nhit;if(nHit<=0) return 0.0f;float hadE=sr->energy.numu.hadcalE;return hadE/nHit;})
Definition: NumuVars.h:63
const Var kRecoMuonEFromVisEFD([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.;if(sr->energy.numu.trkccE<=0) return 0.;if(sr->energy.numu.hadtrkE< 0) return 0.;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.32;double slope1=1.01;double slope2=1.504;double stitch=0.315;if(visE< stitch){return(visE *slope1+offset);}else{return(visE *slope2+((slope1-slope2)*stitch+offset));}})
Definition: NumuVars.h:111
const Var kNumuHadVisE([](const caf::SRProxy *sr){return kNumuHadCalE(sr)+kNumuHadTrkE(sr);})
Definition: NumuVars.h:124
const Var kSlcMaxX([](const caf::SRProxy *sr){return sr->slc.boxmax.X()/100.;})
Definition: NumuVars.h:91
const TVector3 beamDirFD
caf::Proxy< unsigned int > ncalhit
Definition: SRProxy.h:1312
float abs(float number)
Definition: d0nt_math.hpp:39
const Var kCosmicForwardCell
Definition: NumuVars.cxx:549
const Var kDirY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-5.f;return sr->trk.kalman.tracks[0].dir.Y();})
Definition: NumuVars.h:38
_Var< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:74
const Var kNumuHadCalE
Definition: NumuVars.cxx:538
const Var kMuonRecoRelTrueVisEND([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-1.;if(sr->energy.numu.trkccE<=0) return-1.;if(sr->energy.numu.hadtrkE< 0) return-1.;if(sr->mc.nnu==0) return-1.;if(sr->mc.nu[0].prim.empty()) return-1.;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return-1.;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.222;double slope1=1.14;double slope2=1.475;double stitch=0.312;double recoE=-5.0;if(visE< stitch){recoE=visE *slope1+offset;}else{recoE=visE *slope2+((slope1-slope2)*stitch+offset);}double trueE=sr->mc.nu[0].prim[0].p.E;if(trueE<=0.0) return-1.;return((recoE-trueE)/trueE);})
Definition: NumuVars.h:114
const Var kSlcMinY([](const caf::SRProxy *sr){return sr->slc.boxmin.Y()/100.;})
Definition: NumuVars.h:88
const Var kMuonRecoRelRecoFD([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-1.;if(sr->energy.numu.trkccE<=0) return-1.;if(sr->energy.numu.hadtrkE< 0) return-1.;if(sr->mc.nnu==0) return-1.;if(sr->mc.nu[0].prim.empty()) return-1.;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return-1.;double recoETrkLen=sr->energy.numu.recomuonE;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.32;double slope1=1.01;double slope2=1.504;double stitch=0.315;double recoE=-5.0;if(visE< stitch){recoE=visE *slope1+offset;}else{recoE=visE *slope2+((slope1-slope2)*stitch+offset);}if(recoETrkLen<=0.0) return-1.;return((recoE-recoETrkLen)/recoETrkLen);})
Definition: NumuVars.h:118
caf::Proxy< caf::SRVector3D > boxmin
Definition: SRProxy.h:1291
Track finder for cosmic rays.
const Var kRecoMuonEFromTrkLen([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.f;if(sr->energy.numu.trkccE<=0) return 0.f;if(sr->energy.numu.hadtrkE< 0) return 0.f;return float(sr->energy.numu.recomuonE);})
Definition: NumuVars.h:109
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
caf::Proxy< float > trkqeE
Definition: SRProxy.h:197
caf::Proxy< float > endtime
Definition: SRProxy.h:1303
const Var kKalmanFwdDist([](const caf::SRProxy *sr){return sr->sel.contain.kalfwddist/100.;})
Definition: NumuVars.h:74
const Var kMuonRecoRelTrueVisEFD([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-1.;if(sr->energy.numu.trkccE<=0) return-1.;if(sr->energy.numu.hadtrkE< 0) return-1.;if(sr->mc.nnu==0) return-1.;if(sr->mc.nu[0].prim.empty()) return-1.;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return-1.;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.32;double slope1=1.01;double slope2=1.504;double stitch=0.315;double recoE=-5.0;if(visE< stitch){recoE=visE *slope1+offset;}else{recoE=visE *slope2+((slope1-slope2)*stitch+offset);}double trueE=sr->mc.nu[0].prim[0].p.E;if(trueE<=0.0) return-1.;return((recoE-trueE)/trueE);})
Definition: NumuVars.h:113
if(dump)
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
const Var kMuonRecoRelRecoND([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-1.;if(sr->energy.numu.trkccE<=0) return-1.;if(sr->energy.numu.hadtrkE< 0) return-1.;double recoETrkLen=sr->energy.numu.recomuonE;double visE=((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;double offset=0.222;double slope1=1.14;double slope2=1.475;double stitch=0.312;double recoE=-5.0;if(visE< stitch){recoE=visE *slope1+offset;}else{recoE=visE *slope2+((slope1-slope2)*stitch+offset);}if(recoETrkLen<=0.0) return-1.;return((recoE-recoETrkLen)/recoETrkLen);})
Definition: NumuVars.h:119
const Var kNumuContPID2019
Definition: NumuVars.cxx:554
const Var kTrkStartZ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.Z()/100;})
Definition: NumuVars.h:53
const Var kCCE
Definition: NumuVars.h:21
const Var kNumuMuonPtP([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999){if(sr->hdr.det==1){double Zbeam=sr->trk.kalman.tracks[0].dir.Dot(beamDirND);double ptp=sqrt(1-Zbeam *Zbeam);return(float) ptp;}if(sr->hdr.det==2){double Zbeam=sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);double ptp=sqrt(1-Zbeam *Zbeam);return(float) ptp;}}return-5.f;})
Definition: NumuVars.h:49
double energy
Definition: plottest35.C:25
const Var kNonQeHadE([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999) return float(sr->energy.numu.recotrkcchadE);return-5.f;})
Definition: NumuVars.h:77
const Var kSlcStartTime([](const caf::SRProxy *sr){return sr->slc.starttime/1000.;})
Definition: NumuVars.h:84
const Var kVisTrkCalE([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.;if(sr->energy.numu.trkccE<=0) return 0.;if(sr->energy.numu.hadtrkE< 0) return 0.;return((sr->trk.kalman.tracks[0].calE)/1.78)-sr->energy.numu.hadtrkE;})
Definition: NumuVars.h:105
caf::Proxy< float > recotrkcchadE
Definition: SRProxy.h:191
const Var kTrkCalE([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.f;return float(sr->trk.kalman.tracks[0].calE);})
Definition: NumuVars.h:67
caf::StandardRecord * sr
const Var kKalmanForwardCell
Definition: NumuVars.cxx:551
caf::Proxy< float > hadcalE
Definition: SRProxy.h:169
const Var kQeE
Definition: NumuVars.cxx:562
const Var kKalmanBackDist([](const caf::SRProxy *sr){return sr->sel.contain.kalbakdist/100.;})
Definition: NumuVars.h:75
const Var kQeHadE([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999) return sr->energy.numu.trkqeE-sr->energy.numu.recomuonE;return-5.f;})
Definition: NumuVars.h:79
const Var kTrkStartX([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.X()/100;})
Definition: NumuVars.h:51
const Var kTrkEndZ([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].stop.Z()/100;})
Definition: NumuVars.h:57
const Var kMuEPerNHit([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 0.f;return(float) kMuE(sr)/sr->trk.kalman.tracks[0].nhit;})
Definition: NumuVars.h:69
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const Var kQeAngleE
Definition: NumuVars.cxx:563
const Var kRecoW([](const caf::SRProxy *sr){const double M_p=0.938272;double WSq=M_p *M_p+2 *M_p *(kCCE(sr)-kMuE(sr))-kRecoQ2(sr);if(WSq > 0) return sqrt(WSq);else return-5.;})
Reconstructed invariant mass (W)
Definition: NumuVars.h:152
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
const Var kTrkNPlaneGap([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999) return int(sr->trk.kalman.tracks[0].nplanegap);return 500;})
Definition: NumuVars.h:99
caf::Proxy< float > kalbakdist
Definition: SRProxy.h:819
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
const Var kTrkEndY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].stop.Y()/100;})
Definition: NumuVars.h:56
const Var kTrkEndX([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].stop.X()/100;})
Definition: NumuVars.h:55
const Var kNplanesToBack
Definition: NumuVars.cxx:559
caf::Proxy< float > calE
Definition: SRProxy.h:1292
const Var kSlcEndTime([](const caf::SRProxy *sr){return sr->slc.endtime/1000.;})
Definition: NumuVars.h:85
const Var kTrueMuonE([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return 0.f;if(sr->mc.nu[0].prim.empty()) return 0.f;if(std::abs(sr->mc.nu[0].prim[0].pdg)!=13) return 0.f;return float(sr->mc.nu[0].prim[0].p.E);})
Definition: NumuVars.h:107
const Var kDirX([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-5.f;return sr->trk.kalman.tracks[0].dir.X();})
Definition: NumuVars.h:37
const Var kRecoThetaMu([](const caf::SRProxy *sr){return acos(kCosNumi(sr))*180.0/3.1416;})
Definition: NumuVars.h:44
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:88
caf::Proxy< float > meantime
Definition: SRProxy.h:1311
caf::Proxy< float > cosfwddist
Definition: SRProxy.h:812
const Var kQEE
Energy estimator for quasielastic CC events.
Definition: NumuVars.cxx:28
caf::Proxy< float > recomuonE
Definition: SRProxy.h:190
T cos(T number)
Definition: d0nt_math.hpp:78
const Var kCosmicBackwardCell
Definition: NumuVars.cxx:550
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 Var kReMIdDEDxLLH
Definition: NumuVars.cxx:556
const Var kNplanesToFront
Definition: NumuVars.cxx:558
const Var kNonQeE
Definition: NumuVars.cxx:561
const Var kcosDirY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-5.f;return(float) cos(kDirY(sr));})
Definition: NumuVars.h:41
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
const Var kSlcExtentX([](const caf::SRProxy *sr){return(sr->slc.boxmax.X()-sr->slc.boxmin.X())/100.;})
Definition: NumuVars.h:95
const Var kMuE
Definition: NumuVars.h:22
caf::Proxy< float > kalfwddist
Definition: SRProxy.h:824
const Var kSlcExtentZ([](const caf::SRProxy *sr){return(sr->slc.boxmax.Z()-sr->slc.boxmin.Z())/100.;})
Definition: NumuVars.h:97
const Var kSlcUnCalibNHit([](const caf::SRProxy *sr){return sr->slc.nhit-sr->slc.ncalhit;})
Definition: NumuVars.h:81
const Var kCosNumi([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999){if(sr->hdr.det==1){return sr->trk.kalman.tracks[0].dir.Dot(beamDirND);}if(sr->hdr.det==2){return sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);}}return-5.f;})
Definition: NumuVars.h:43
const Var kSlcMinZ([](const caf::SRProxy *sr){return sr->slc.boxmin.Z()/100.;})
Definition: NumuVars.h:89
const Var kTrkNhits([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return 65535;return int(sr->trk.kalman.tracks[0].nhit);})
Definition: NumuVars.h:59
caf::Proxy< caf::SRVector3D > boxmax
Definition: SRProxy.h:1290
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232
const Var kNumuCosRejAngleCos
Definition: NumuVars.cxx:548