NumubarCCpi0_Cuts.cxx
Go to the documentation of this file.
2 
3 namespace ana
4 {
5  namespace numubarccpi0
6  {
7  // Optimized fiducial for numuccinc analysis
8  const TVector3* vtxmin = new TVector3(-130, -130, 100);
9  const TVector3* vtxmax = new TVector3( 140, 140, 1000);
10 
11  //====================//
12  // Truth cuts //
13  //====================//
14  const NuTruthCut kTrueFiducial_NT([](const caf::SRNeutrinoProxy* truth)
15  {
16  return (truth->vtx.X() < vtxmax->X() &&
17  truth->vtx.X() > vtxmin->X() &&
18  truth->vtx.Y() > vtxmin->Y() &&
19  truth->vtx.Y() < vtxmax->Y() &&
20  truth->vtx.Z() > vtxmin->Z() &&
21  truth->vtx.Z() < vtxmax->Z() );
22  });
23 
24  const NuTruthCut kIsNumuCC_NT([](const caf::SRNeutrinoProxy* truth)
25  {
26  return (truth->iscc && abs(truth->pdg) == 14);
27  });
28  const NuTruthCut kIsNC_NT([](const caf::SRNeutrinoProxy* truth)
29  {
30  return (!truth->iscc);
31  });
32  const NuTruthCut kIsNu_NT([](const caf::SRNeutrinoProxy* truth)
33  {
34  return (truth->pdg > 0);
35  });
36  const NuTruthCut kIsAntiNu_NT([](const caf::SRNeutrinoProxy* truth)
37  {
38  return (truth->pdg < 0);
39  });
40 
41 
42  //======================//
43  // Preselection //
44  //======================//
45  const Cut kThreePngPlus([](const caf::SRProxy* sr)
46  {
47  if(!(sr->vtx.elastic.IsValid)) return false;
48  return sr->vtx.elastic.fuzzyk.npng >= 3;
49  });
50 
51  const Cut kNumuMyQuality([](const caf::SRProxy* sr)
52  {
53  return (sr->trk.kalman.ntracks > 0 &&
54  sr->slc.nhit > 20 &&
55  sr->slc.ncontplanes > 4);
56  });
57 
58  const Cut kIsFiducial([](const caf::SRProxy* sr)
59  {
60  int ibesttrk = kBestTrack(sr);
61  if( sr->trk.kalman.ntracks < 1 ) return false;
62  if(ibesttrk < 0 || ibesttrk >= int(sr->trk.kalman.ntracks))
63  return false;
64  bool isfid = (sr->trk.kalman.tracks[ibesttrk].start.X() < vtxmax->X() &&
65  sr->trk.kalman.tracks[ibesttrk].start.X() > vtxmin->X() &&
66  sr->trk.kalman.tracks[ibesttrk].start.Y() > vtxmin->Y() &&
67  sr->trk.kalman.tracks[ibesttrk].start.Y() < vtxmax->Y() &&
68  sr->trk.kalman.tracks[ibesttrk].start.Z() > vtxmin->Z() &&
69  sr->trk.kalman.tracks[ibesttrk].start.Z() < vtxmax->Z());
70  return isfid;
71  });
72 
73  const Cut kNumuTightContainND([](const caf::SRProxy* sr)
74  {
75  if(!(sr->vtx.elastic.IsValid)) return false;
76  int ibesttrk = kBestTrack(sr);
77  // reconstructed showers all contained
78  for( unsigned int i = 0; i < sr->vtx.elastic.fuzzyk.nshwlid; ++i ) {
79  TVector3 start = sr->vtx.elastic.fuzzyk.png[i].shwlid.start;
80  TVector3 stop = sr->vtx.elastic.fuzzyk.png[i].shwlid.stop;
81  if( std::min( start.X(), stop.X() ) < -180.0 ) return false;
82  if( std::max( start.X(), stop.X() ) > 180.0 ) return false;
83  if( std::min( start.Y(), stop.Y() ) < -180.0 ) return false;
84  if( std::max( start.Y(), stop.Y() ) > 180.0 ) return false;
85  if( std::min( start.Z(), stop.Z() ) < 20.0 ) return false;
86  if( std::max( start.Z(), stop.Z() ) > 1525.0 ) return false;
87  }
88  // only primary muon track present in muon catcher
89  if( sr->trk.kalman.ntracks < 1 ) return false;
90  for( int i = 0; i < int(sr->trk.kalman.ntracks); ++i ) {
91  if( i == ibesttrk ) continue;
92  else if( sr->trk.kalman.tracks[i].start.Z() > 1275 ||
93  sr->trk.kalman.tracks[i].stop.Z() > 1275 )
94  return false;
95  }
96  if(ibesttrk < 0 || ibesttrk >= int(sr->trk.kalman.ntracks))
97  return false;
98  return ((sr->trk.kalman.tracks[ibesttrk].stop.Z() < 1275
99  || sr->trk.kalman.tracks[ibesttrk].trkyposattrans < 55 ) // air gap
100  && sr->trk.kalman.tracks[ibesttrk].trkfwdcellnd > 5
101  && sr->trk.kalman.tracks[ibesttrk].trkbakcellnd > 10);
102  });
103 
104  //=========================//
105  // Prong Truth Tag //
106  //=========================//
107  const Cut kProng1TruthIsPhoton_emid([](const caf::SRProxy* sr)
108  {
109  int png1 = kProng1ID_emid(sr);
110  if (png1 < 0) return false;
111  return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) == 22;
112  });
113 
114  const Cut kProng1TruthIsElectron_emid([](const caf::SRProxy* sr)
115  {
116  int png1 = kProng1ID_emid(sr);
117  if (png1 < 0) return false;
118  return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) == 11;
119  });
120 
121  const Cut kProng1TruthIsMuon_emid([](const caf::SRProxy* sr)
122  {
123  int png1 = kProng1ID_emid(sr);
124  if (png1 < 0) return false;
125  return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) == 13;
126  });
127 
128  const Cut kProng1TruthIsProton_emid([](const caf::SRProxy* sr)
129  {
130  int png1 = kProng1ID_emid(sr);
131  if (png1 < 0) return false;
132  return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) == 2212;
133  });
134 
135  const Cut kProng1TruthIsPion_emid([](const caf::SRProxy* sr)
136  {
137  int png1 = kProng1ID_emid(sr);
138  if (png1 < 0) return false;
139  return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) == 211;
140  });
141 
142  const Cut kProng1TruthIsOther_emid([](const caf::SRProxy* sr)
143  {
144  int png1 = kProng1ID_emid(sr);
145  if (png1 < 0) return false;
146  return ( abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) != 22 &&
147  abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) != 11 &&
148  abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) != 13 &&
149  abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) != 2212 &&
150  abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg) != 211 );
151  });
152 
153 
154  const Cut kProng2TruthIsPhoton_emid([](const caf::SRProxy* sr)
155  {
156  int png2 = kProng2ID_emid(sr);
157  if (png2 < 0) return false;
158  return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) == 22;
159  });
160 
161  const Cut kProng2TruthIsElectron_emid([](const caf::SRProxy* sr)
162  {
163  int png2 = kProng2ID_emid(sr);
164  if (png2 < 0) return false;
165  return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) == 11;
166  });
167 
168  const Cut kProng2TruthIsMuon_emid([](const caf::SRProxy* sr)
169  {
170  int png2 = kProng2ID_emid(sr);
171  if (png2 < 0) return false;
172  return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) == 13;
173  });
174 
175  const Cut kProng2TruthIsProton_emid([](const caf::SRProxy* sr)
176  {
177  int png2 = kProng2ID_emid(sr);
178  if (png2 < 0) return false;
179  return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) == 2212;
180  });
181 
182  const Cut kProng2TruthIsPion_emid([](const caf::SRProxy* sr)
183  {
184  int png2 = kProng2ID_emid(sr);
185  if (png2 < 0) return false;
186  return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) == 211;
187  });
188 
189  const Cut kProng2TruthIsOther_emid([](const caf::SRProxy* sr)
190  {
191  int png2 = kProng2ID_emid(sr);
192  if (png2 < 0) return false;
193  return ( abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) != 22 &&
194  abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) != 11 &&
195  abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) != 13 &&
196  abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) != 2212 &&
197  abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg) != 211 );
198  });
199 
200 
201 
202  } // end of namespace numubarccpi0
203 } // end of namespace ana
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
const Cut kProng2TruthIsProton_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)==2212;})
T max(const caf::Proxy< T > &a, T b)
const Cut kProng1TruthIsPion_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)==211;})
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const TVector3 * vtxmax
const Cut kProng2TruthIsPhoton_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)==22;})
const Cut kThreePngPlus([](const caf::SRProxy *sr){if(!(sr->vtx.elastic.IsValid)) return false;return sr->vtx.elastic.fuzzyk.npng >=3;})
const Var kBestTrack([](const caf::SRProxy *sr){return(int) sr->trk.kalman.idxmuonid;})
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< unsigned int > ncontplanes
Definition: SRProxy.h:1314
const Cut kProng2TruthIsPion_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)==211;})
const Cut kProng1TruthIsProton_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)==2212;})
void abs(TH1 *hist)
const Var kProng1ID_emid([](const caf::SRProxy *sr){return Prong1ID_Generator(sr,"emid");})
_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 TVector3 * vtxmin
const NuTruthCut kTrueFiducial_NT([](const caf::SRNeutrinoProxy *truth){return(truth->vtx.X()< vtxmax->X()&& truth->vtx.X() > vtxmin->X()&& truth->vtx.Y() > vtxmin->Y()&& truth->vtx.Y()< vtxmax->Y()&& truth->vtx.Z() > vtxmin->Z()&& truth->vtx.Z()< vtxmax->Z());})
const Cut kProng1TruthIsElectron_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)==11;})
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:573
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Cut kNumuMyQuality([](const caf::SRProxy *sr){return(sr->trk.kalman.ntracks > 0 && sr->slc.nhit > 20 && sr->slc.ncontplanes > 4);})
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
const NuTruthCut kIsNC_NT([](const caf::SRNeutrinoProxy *truth){return(!truth->iscc);})
const Cut kNumuTightContainND([](const caf::SRProxy *sr){if(!(sr->vtx.elastic.IsValid)) return false;int ibesttrk=kBestTrack(sr);for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;++i){TVector3 start=sr->vtx.elastic.fuzzyk.png[i].shwlid.start;TVector3 stop=sr->vtx.elastic.fuzzyk.png[i].shwlid.stop;if(std::min(start.X(), stop.X())< -180.0) return false;if(std::max(start.X(), stop.X()) > 180.0) return false;if(std::min(start.Y(), stop.Y())< -180.0) return false;if(std::max(start.Y(), stop.Y()) > 180.0) return false;if(std::min(start.Z(), stop.Z())< 20.0) return false;if(std::max(start.Z(), stop.Z()) > 1525.0) return false;}if(sr->trk.kalman.ntracks< 1) return false;for(int i=0;i< int(sr->trk.kalman.ntracks);++i){if(i==ibesttrk) continue;else if(sr->trk.kalman.tracks[i].start.Z() > 1275|| sr->trk.kalman.tracks[i].stop.Z() > 1275) return false;}if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return false;return((sr->trk.kalman.tracks[ibesttrk].stop.Z()< 1275 ||sr->trk.kalman.tracks[ibesttrk].trkyposattrans< 55) &&sr->trk.kalman.tracks[ibesttrk].trkfwdcellnd > 5 &&sr->trk.kalman.tracks[ibesttrk].trkbakcellnd > 10);})
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
caf::Proxy< bool > iscc
Definition: SRProxy.h:538
const Cut kProng1TruthIsMuon_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)==13;})
const NuTruthCut kIsNumuCC_NT([](const caf::SRNeutrinoProxy *truth){return(truth->iscc &&abs(truth->pdg)==14);})
_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 Cut kProng1TruthIsPhoton_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)==22;})
const Cut kProng2TruthIsOther_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return(abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)!=22 && abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)!=11 && abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)!=13 && abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)!=2212 && abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)!=211);})
const NuTruthCut kIsAntiNu_NT([](const caf::SRNeutrinoProxy *truth){return(truth->pdg< 0);})
const Cut kProng2TruthIsMuon_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)==13;})
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
const Cut kIsFiducial([](const caf::SRProxy *sr){int ibesttrk=kBestTrack(sr);if(sr->trk.kalman.ntracks< 1) return false;if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return false;bool isfid=(sr->trk.kalman.tracks[ibesttrk].start.X()< vtxmax->X()&& sr->trk.kalman.tracks[ibesttrk].start.X() > vtxmin->X()&& sr->trk.kalman.tracks[ibesttrk].start.Y() > vtxmin->Y()&& sr->trk.kalman.tracks[ibesttrk].start.Y()< vtxmax->Y()&& sr->trk.kalman.tracks[ibesttrk].start.Z() > vtxmin->Z()&& sr->trk.kalman.tracks[ibesttrk].start.Z()< vtxmax->Z());return isfid;})
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
const Cut kProng2TruthIsElectron_emid([](const caf::SRProxy *sr){int png2=kProng2ID_emid(sr);if(png2< 0) return false;return abs(sr->vtx.elastic.fuzzyk.png[png2].truth.pdg)==11;})
caf::Proxy< short int > pdg
Definition: SRProxy.h:552
const Cut kProng1TruthIsOther_emid([](const caf::SRProxy *sr){int png1=kProng1ID_emid(sr);if(png1< 0) return false;return(abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)!=22 && abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)!=11 && abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)!=13 && abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)!=2212 && abs(sr->vtx.elastic.fuzzyk.png[png1].truth.pdg)!=211);})
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
T min(const caf::Proxy< T > &a, T b)
Template for Cut and SpillCut.
Definition: Cut.h:15
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const Var kProng2ID_emid([](const caf::SRProxy *sr){return Prong2ID_Generator(sr,"emid");})
const NuTruthCut kIsNu_NT([](const caf::SRNeutrinoProxy *truth){return(truth->pdg > 0);})