NumuVars.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Specific variables. When this file gets too crowded it should be split up
4 
5 // See Cuts.h for a walkthrough of how to define this kind of object
6 
8 #include "CAFAna/Core/Var.h"
9 
11 #include "CAFAna/Vars/Vars.h"
12 
13 #include "CAFAna/Core/Utilities.h"
14 #include "CAFAna/Core/Cut.h"
17 
18 namespace ana
19 {
20  //Numu energy estimator for all CC events
21  const Var kCCE = kNumuE2020;
25 
26  /// Energy estimator for non quasielastic CC events
27  extern const Var kNonQEE;
28 
29  /// Energy estimator for quasielastic CC events
30  extern const Var kQEE;
31 
32 
33  // Variables for Data/MC comparison
34  extern const Var kSliceTime;
35  extern const Var kSliceDuration;
36 
37  extern const Var kDirX;
38  extern const Var kDirY;
39  extern const Var kDirZ;
40 
41  extern const Var kcosDirY;
42 
43  extern const Var kCosNumi;
44  extern const Var kRecoThetaMu;
45 
46  // Reconstructed muon transverse momentum Pt
47  extern const Var kNumuMuonPt;
48  // Reconstructed muon Pt/P
49  extern const Var kNumuMuonPtP;
50 
51  extern const Var kTrkStartX;
52  extern const Var kTrkStartY;
53  extern const Var kTrkStartZ;
54 
55  extern const Var kTrkEndX;
56  extern const Var kTrkEndY;
57  extern const Var kTrkEndZ;
58 
59  extern const Var kTrkNhits;
60 
61  extern const Var kHadNHit;
62 
63  extern const Var kHadEPerNHit;
64 
65  extern const Var kTrkLength;
66 
67  extern const Var kTrkCalE;
68  extern const Var kTrkCalEPerNHit;
69  extern const Var kMuEPerNHit;
70 
71  extern const Var kCosBackDist;
72  extern const Var kCosFwdDist;
73 
74  extern const Var kKalmanFwdDist;
75  extern const Var kKalmanBackDist;
76 
77  extern const Var kNonQeHadE;
78 
79  extern const Var kQeHadE;
80 
81  extern const Var kSlcUnCalibNHit;
82 
83  extern const Var kSlcMeanTime;
84  extern const Var kSlcStartTime;
85  extern const Var kSlcEndTime;
86 
87  extern const Var kSlcMinX;
88  extern const Var kSlcMinY;
89  extern const Var kSlcMinZ;
90 
91  extern const Var kSlcMaxX;
92  extern const Var kSlcMaxY;
93  extern const Var kSlcMaxZ;
94 
95  extern const Var kSlcExtentX;
96  extern const Var kSlcExtentY;
97  extern const Var kSlcExtentZ;
98 
99  extern const Var kTrkNPlaneGap;
100 
101  extern const Var kSlcCalEPerNHit;
102 
103  //**********Variables useful for making muon energy resolution plots
104 
105  extern const Var kVisTrkCalE;
106 
107  extern const Var kTrueMuonE;
108 
109  extern const Var kRecoMuonEFromTrkLen;
110 
111  extern const Var kRecoMuonEFromVisEFD;
112  extern const Var kRecoMuonEFromVisEND;
115 
117 
118  extern const Var kMuonRecoRelRecoFD;
119  extern const Var kMuonRecoRelRecoND;
120 
121  extern const Var kNumuHadCalE;
122  extern const Var kNumuHadTrkE;
123  extern const Var kNKalman;
124  extern const Var kNumuHadVisE;
125 
126  extern const Var kNumuCosRejAngleKal;
127  extern const Var kNumuCosRejAngleCos;
128  extern const Var kCosmicForwardCell;
129  extern const Var kCosmicBackwardCell;
130  extern const Var kKalmanForwardCell;
131  extern const Var kKalmanBackwardCell;
132  extern const Var kNumuContPID;
133  extern const Var kNumuContPID2019;
134  extern const Var kReMIdScatLLH;
135  extern const Var kReMIdDEDxLLH;
136  extern const Var kReMIdMeasFrac;
137  extern const Var kNplanesToFront;
138  extern const Var kNplanesToBack;
139  extern const Var kNcellsFromEdge;
140  extern const Var kNonQeE;
141  extern const Var kQeE;
142  extern const Var kQeAngleE;
143  extern const Var kDirScore;
144 
145  /// Reconstructed four-momentum transfer invariant (Q^2)
146  extern const Var kRecoQ2;
147 
148  /// Reconstructed three-momentum transfer
149  extern const Var kRecoQmag;
150 
151  /// Reconstructed invariant mass (W)
152  extern const Var kRecoW;
153 
154 } // namespace
const Var kHadE
Definition: NumuVars.h:23
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
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
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
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
const Var kNumuContPID
Definition: NumuVars.cxx:553
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 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
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
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
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
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 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
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
const Var kNumuE2020
Definition: NumuEFxs.h:217
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
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
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 kHadEFrac
Definition: NumuVars.h:24
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
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
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
const Var kKalmanForwardCell
Definition: NumuVars.cxx:551
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
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
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
const Var kNumuHadEFrac2020
Definition: NumuEFxs.h:218
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
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
const Var kQEE
Energy estimator for quasielastic CC events.
Definition: NumuVars.cxx:28
const Var kCosmicBackwardCell
Definition: NumuVars.cxx:550
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
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
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 kNumuMuE2020
Definition: NumuEFxs.h:198
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
const Var kNumuHadE2020
Definition: NumuEFxs.h:199
const Var kNumuCosRejAngleCos
Definition: NumuVars.cxx:548