TruthCuts.cxx
Go to the documentation of this file.
2 
4 
5 #include <cassert>
6 
7 namespace ana
8 {
9  const Cut kIsNC([](const caf::SRProxy* sr)
10  {
11  if(sr->mc.nnu == 0) return false;
12  assert(sr->mc.nnu == 1);
13  return !sr->mc.nu[0].iscc;
14  });
15 
16  const Cut kIsNue([](const caf::SRProxy* sr){
17  return (sr->mc.nnu == 1 && abs(sr->mc.nu[0].pdg) ==12);});
18 
19  const Cut kIsNumu([](const caf::SRProxy* sr){
20  return (sr->mc.nnu == 1 && abs(sr->mc.nu[0].pdg) ==14);});
21 
22  const NuTruthCut kIsTau_NT([](const caf::SRNeutrinoProxy* truth){
23  return (abs(truth->pdg) == 16);});
24 
26 
27  const NuTruthCut kIsNC_NT([](const caf::SRNeutrinoProxy* truth)
28  {
29  return !truth->iscc;
30  });
31 
32  bool CCFlavSel::operator()(const caf::SRProxy* sr) const
33  {
34  if(sr->mc.nnu == 0) return false;
35  assert(sr->mc.nnu == 1);
36  return (sr->mc.nu[0].iscc &&
37  abs(sr->mc.nu[0].pdg) == fPdg &&
38  abs(sr->mc.nu[0].pdgorig) == fPdgOrig);
39  }
40 
41  const NuTruthCut kIsNumuCC_NT([](const caf::SRNeutrinoProxy* truth)
42  {
43  return (
44  truth->iscc &&
45  abs(truth->pdg) == 14 &&
46  abs(truth->pdgorig) == 14
47  );
48  });
49 
50  const NuTruthCut kIsBeamNue_NT([](const caf::SRNeutrinoProxy* truth)
51  {
52  return (
53  truth->iscc &&
54  abs(truth->pdg) == 12 &&
55  abs(truth->pdgorig) == 12
56  );
57  });
58 
59  const NuTruthCut kIsSig_NT([](const caf::SRNeutrinoProxy* truth)
60  {
61  return (
62  truth->iscc &&
63  abs(truth->pdg) == 12 &&
64  abs(truth->pdgorig) == 14
65  );
66  });
67 
68  const Cut kIsAntiNu([](const caf::SRProxy* sr)
69  {
70  if(sr->mc.nnu == 0) return false;
71  assert(sr->mc.nnu == 1);
72  return sr->mc.nu[0].pdg < 0;
73  });
74 
75  const Cut kIsNu([](const caf::SRProxy* sr)
76  {
77  if(sr->mc.nnu == 0) return false;
78  assert(sr->mc.nnu == 1);
79  return sr->mc.nu[0].pdg > 0;
80  });
81 
82  const Cut kHasNu([](const caf::SRProxy* sr)
83  {
84  if(sr->mc.nnu == 0) return false;
85  assert(sr->mc.nnu == 1);
86  return true;
87  });
88 
89  const NuTruthCut kIsAntiNu_NT([](const caf::SRNeutrinoProxy* truth)
90  {
91  return truth->pdg < 0;
92  });
93 
94  const Cut kHasNeutrino(
95  [](const caf::SRProxy* sr)
96  { return (sr->mc.nnu != 0); }
97  );
98 
99  const NuTruthCut kIsQE_NT([](const caf::SRNeutrinoProxy* truth)
100  {
101  return (truth->mode == caf::kQE);
102  });
103 
105 
106  const NuTruthCut kIsRes_NT([](const caf::SRNeutrinoProxy* truth)
107  {
108  return (truth->mode == caf::kRes);
109  });
110 
112 
113  const NuTruthCut kIsDIS_NT([](const caf::SRNeutrinoProxy* truth)
114  {
115  return (truth->mode == caf::kDIS);
116  });
117 
119 
120  //// Select neutrinos by their parents type
121  const Cut kIsNumuFromKaon([](const caf::SRProxy* sr){
122  return (sr->mc.nnu == 1 &&
123  sr->mc.nu[0].iscc ==1 &&
124  (abs(sr->mc.nu[0].beam.ptype) == 321 || sr->mc.nu[0].beam.ptype == 310 || sr->mc.nu[0].beam.ptype == 311 || sr->mc.nu[0].beam.ptype == 130) &&
125  abs(sr->mc.nu[0].pdg) == 14);
126  });
127 
128  const NuTruthCut kIsCoh_NT([](const caf::SRNeutrinoProxy* truth)
129  {
130  return (truth->mode == caf::kCoh);
131  });
132 
134 
135  const Cut kIsKaon([](const caf::SRProxy* sr){
136  return (abs(sr->mc.nu[0].beam.ptype) == 321 || sr->mc.nu[0].beam.ptype == 310 || sr->mc.nu[0].beam.ptype == 311 || sr->mc.nu[0].beam.ptype == 130);
137  });
138 
139  const Cut kIsNumuFromPion([](const caf::SRProxy* sr){
140  return (sr->mc.nnu == 1 &&
141  sr->mc.nu[0].iscc ==1 &&
142  (abs(sr->mc.nu[0].beam.ptype) == 211 || sr->mc.nu[0].beam.ptype == 111) &&
143  abs(sr->mc.nu[0].pdg) == 14);
144  });
145 
146  const Cut kIsPion([](const caf::SRProxy* sr){
147  return (abs(sr->mc.nu[0].beam.ptype) == 211 || sr->mc.nu[0].beam.ptype == 111);
148  });
149 
150  const Cut kIsNumuFromMuon([](const caf::SRProxy* sr){
151  return (sr->mc.nnu == 1 &&
152  sr->mc.nu[0].iscc ==1 &&
153  abs(sr->mc.nu[0].beam.ptype) == 13 &&
154  abs(sr->mc.nu[0].pdg) == 14);
155  });
156 
157  const Cut kIsMuon([](const caf::SRProxy* sr){
158  return (abs(sr->mc.nu[0].beam.ptype) == 13);
159  });
160 
161  const Cut kIsNueFromKaon([](const caf::SRProxy* sr){
162  return (sr->mc.nnu == 1 &&
163  sr->mc.nu[0].iscc ==1 &&
164  (abs(sr->mc.nu[0].beam.ptype) == 321 || sr->mc.nu[0].beam.ptype == 310 || sr->mc.nu[0].beam.ptype == 311 || sr->mc.nu[0].beam.ptype == 130) &&
165  abs(sr->mc.nu[0].pdg) == 12);
166  });
167 
168  const Cut kIsNueFromPion([](const caf::SRProxy* sr){
169  return (sr->mc.nnu == 1 &&
170  sr->mc.nu[0].iscc ==1 &&
171  (abs(sr->mc.nu[0].beam.ptype) == 211 || sr->mc.nu[0].beam.ptype == 111) &&
172  abs(sr->mc.nu[0].pdg) == 12);
173  });
174 
175  const Cut kIsNueFromMuon([](const caf::SRProxy* sr){
176  return (sr->mc.nnu == 1 &&
177  sr->mc.nu[0].iscc ==1 &&
178  abs(sr->mc.nu[0].beam.ptype) == 13 &&
179  abs(sr->mc.nu[0].pdg) == 12);
180  });
181 
182  const NuTruthCut kIsDytmanMEC_NT([](const caf::SRNeutrinoProxy* truth)
183  {
184  return (truth->mode == caf::kMEC);
185  });
186 
188 
189  const Cut kIsVtxCont([](const caf::SRProxy* sr)
190  {
191  return(sr->mc.nnu==1 && sr->mc.nu[0].isvtxcont);
192  });
193 
194  const NuTruthCut kIsVtxCont_NT([](const caf::SRNeutrinoProxy* truth)
195  {
196  return(truth->isvtxcont);
197  });
198 }
const Cut kIsQE
Definition: TruthCuts.cxx:104
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
bool operator()(const caf::SRProxy *sr) const
Definition: TruthCuts.cxx:32
const NuTruthCut kIsCoh_NT([](const caf::SRNeutrinoProxy *truth){return(truth->mode==caf::kCoh);})
Definition: TruthCuts.h:73
const Cut kIsNumu([](const caf::SRProxy *sr){return(sr->mc.nnu==1 &&abs(sr->mc.nu[0].pdg)==14);})
Definition: TruthCuts.h:10
const Cut kIsRes
Definition: TruthCuts.cxx:111
const NuTruthCut kIsRes_NT([](const caf::SRNeutrinoProxy *truth){return(truth->mode==caf::kRes);})
Definition: TruthCuts.h:67
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2108
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:597
const Cut kIsAntiNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return sr->mc.nu[0].pdg< 0;})
Is this truly an antineutrino?
Definition: TruthCuts.h:53
const Cut kIsNumuFromKaon([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && (abs(sr->mc.nu[0].beam.ptype)==321||sr->mc.nu[0].beam.ptype==310||sr->mc.nu[0].beam.ptype==311||sr->mc.nu[0].beam.ptype==130)&& abs(sr->mc.nu[0].pdg)==14);})
Definition: TruthCuts.h:77
void abs(TH1 *hist)
caf::Proxy< short int > nnu
Definition: SRProxy.h:596
const Cut kIsDIS
Definition: TruthCuts.cxx:118
const Cut kIsTau
Definition: TruthCuts.cxx:25
const Cut kIsVtxCont([](const caf::SRProxy *sr){return(sr->mc.nnu==1 &&sr->mc.nu[0].isvtxcont);})
Definition: TruthCuts.h:93
const Cut kIsKaon([](const caf::SRProxy *sr){return(abs(sr->mc.nu[0].beam.ptype)==321||sr->mc.nu[0].beam.ptype==310||sr->mc.nu[0].beam.ptype==311||sr->mc.nu[0].beam.ptype==130);})
Definition: TruthCuts.h:83
const NuTruthCut kIsTau_NT([](const caf::SRNeutrinoProxy *truth){return(abs(truth->pdg)==16);})
Definition: TruthCuts.h:12
const Cut kIsNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return sr->mc.nu[0].pdg > 0;})
Definition: TruthCuts.h:54
_Cut< caf::SRNeutrinoProxy > NuTruthCut
Cut designed to be used over the nuTree, ie all neutrinos, not just those that got slices...
Definition: Cut.h:104
const NuTruthCut kIsDIS_NT([](const caf::SRNeutrinoProxy *truth){return(truth->mode==caf::kDIS);})
Definition: TruthCuts.h:70
const Cut kIsDytmanMEC
Definition: TruthCuts.cxx:187
const NuTruthCut kIsAntiNu_NT([](const caf::SRNeutrinoProxy *truth){return truth->pdg< 0;})
Definition: TruthCuts.h:58
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
const Cut kIsMuon([](const caf::SRProxy *sr){return(abs(sr->mc.nu[0].beam.ptype)==13);})
Definition: TruthCuts.h:84
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
const Cut kIsNue([](const caf::SRProxy *sr){return(sr->mc.nnu==1 &&abs(sr->mc.nu[0].pdg)==12);})
Definition: TruthCuts.h:9
const Cut kIsNueFromPion([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && (abs(sr->mc.nu[0].beam.ptype)==211||sr->mc.nu[0].beam.ptype==111)&& abs(sr->mc.nu[0].pdg)==12);})
Definition: TruthCuts.h:87
caf::StandardRecord * sr
const NuTruthCut kIsQE_NT([](const caf::SRNeutrinoProxy *truth){return(truth->mode==caf::kQE);})
Select truly quasielastic events.
Definition: TruthCuts.h:64
const NuTruthCut kIsVtxCont_NT([](const caf::SRNeutrinoProxy *truth){return(truth->isvtxcont);})
Definition: TruthCuts.h:94
const NuTruthCut kIsBeamNue_NT([](const caf::SRNeutrinoProxy *truth){return( truth->iscc && abs(truth->pdg)==12 && abs(truth->pdgorig)==12 );})
Definition: TruthCuts.h:49
const NuTruthCut kIsNumuCC_NT([](const caf::SRNeutrinoProxy *truth){return( truth->iscc && abs(truth->pdg)==14 && abs(truth->pdgorig)==14 );})
Definition: TruthCuts.h:48
const Cut kHasNeutrino([](const caf::SRProxy *sr){return(sr->mc.nnu!=0);})
Check if MC slice has neutrino information (useful for in-and-out tests)
Definition: TruthCuts.h:61
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2120
const NuTruthCut kIsNC_NT([](const caf::SRNeutrinoProxy *truth){return!truth->iscc;})
Definition: TruthCuts.h:15
const NuTruthCut kIsDytmanMEC_NT([](const caf::SRNeutrinoProxy *truth){return(truth->mode==caf::kMEC);})
Definition: TruthCuts.h:90
const Cut kIsNueFromMuon([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && abs(sr->mc.nu[0].beam.ptype)==13 && abs(sr->mc.nu[0].pdg)==12);})
Definition: TruthCuts.h:88
const Cut kHasNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return true;})
Definition: TruthCuts.h:56
const Cut kIsPion([](const caf::SRProxy *sr){return(abs(sr->mc.nu[0].beam.ptype)==211||sr->mc.nu[0].beam.ptype==111);})
Definition: TruthCuts.h:80
const Cut kIsNumuFromMuon([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && abs(sr->mc.nu[0].beam.ptype)==13 && abs(sr->mc.nu[0].pdg)==14);})
Definition: TruthCuts.h:81
const Cut kIsNueFromKaon([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && (abs(sr->mc.nu[0].beam.ptype)==321||sr->mc.nu[0].beam.ptype==310||sr->mc.nu[0].beam.ptype==311||sr->mc.nu[0].beam.ptype==130)&& abs(sr->mc.nu[0].pdg)==12);})
Definition: TruthCuts.h:86
assert(nhit_max >=nhit_nbins)
const NuTruthCut kIsSig_NT([](const caf::SRNeutrinoProxy *truth){return( truth->iscc && abs(truth->pdg)==12 && abs(truth->pdgorig)==14 );})
Definition: TruthCuts.h:50
const Cut kIsNumuFromPion([](const caf::SRProxy *sr){return(sr->mc.nnu==1 && sr->mc.nu[0].iscc==1 && (abs(sr->mc.nu[0].beam.ptype)==211||sr->mc.nu[0].beam.ptype==111)&& abs(sr->mc.nu[0].pdg)==14);})
Definition: TruthCuts.h:78
const Cut kIsCoh
Definition: TruthCuts.cxx:133
Cut CutFromNuTruthCut(const NuTruthCut &stc)
Definition: Cut.cxx:7