SelectionNumu2018.cxx
Go to the documentation of this file.
1 //
2 // SelectionNumu2018.cxx
3 //
4 // Created by Stefano Germani on 14/2/2018.
5 //
6 
8 
10 
11 //------------------------------------------------------------------------------
13 {
14 
15 }
16 
17 //------------------------------------------------------------------------------
19 {
20 
21  /********
22 
23 const Cut kNumuCutFD2017 =
24  kNumuQuality && kNumuContainFD2017 && kNumuPID2017 && kNumuCosmicRej2017;
25 
26 //Complete 2018 NuMu cuts
27  const Cut kNumuCutFD2018 =
28  kNumuQuality && kNumuContainFD2017 && kNumuPID2018 && kNumuCosmicRej2018;
29 
30  //==> kNumuCosmicRej2018
31  //Cosmic rejection cut for the 2018 analysis (to be tuned)
32  const Cut kNumuCosmicRej2018(
33  [](const caf::SRProxy* sr)
34  { return ( sr->sel.cosrej.anglekal > 0.5 && /// Same as 2017
35  sr->sel.cosrej.numucontpid > 0.53 && /// 0.5 for 2017 !!!!
36  sr->slc.nhit < 400 && /// Same as 2017
37  sr->sel.nuecosrej.pngptp < 0.9 /// Missing in 2017 !!!!
38  );
39  }
40  );
41 
42 
43  //==> kNumuPID2018 2018 uses sr->sel.cvnProd3Train.numuid instead of sr->sel.cvn.numuid
44  const Cut kNumuPID2018(
45  [](const caf::SRProxy* sr)
46  {
47  return (sr->sel.remid.pid > 0.7
48  && sr->sel.cvnProd3Train.numuid > 0.7
49  && sr->sel.cvn2017.numuid > 0.1);
50  }
51 
52  const Cut kNumuCutND2018 =
53  kNumuQuality && kNumuContainND2017 && kNumuPID2018;
54 
55  *****************/
56 
57  // values for the cuts
58  fMaxNumuE = p.get<float >("MaxNumuE", 100. ); // Not Used
59 
60  fMinReMId = p.get<float >("MinReMId", 0.7 ); // ok
61  fMinCVNmu = p.get<float >("MinCVNmu", 0.7 ); // ok <<======= 2018 uses sr->sel.cvnProd3Train.numuid !!!!!
62  // instead of (2017) sr->sel.cvn.numuid
63  fMinCVN2017mu = p.get<float >("MinCVN2017mu", 0.1 ); // ok <<======= 2018 uses sel.cvn2017.numuid > 0.1 !!!!!
64 
65  fMinSliceHits = p.get<float >("MinSliceHits", 21. ); //
66  fMinSliceContigPlanes = p.get<float >("MinSliceContigPlanes", 5. ); //
67 
68  // fMinCellsFromEdge = p.get<unsigned int>("MinCellsFromEdge", 2 ); // // No longer used in Analysi 2018
69  fMinQePID1Track = p.get<float >("MinQePID1Track", -1.e6 ); // default selection is 0.45
70  fMinQePID2Track = p.get<float >("MinQePID2Track", -1.e6 ); // default selection is 0.4
71 
72  //FD Specific Cuts
73  //kNumuProngsContainFD2017
74  fFDDistAllEast = p.get<float>("FDDistAllEast", 16. ); // ok
75  fFDDistAllWest = p.get<float>("FDDistAllWest", 12. ); // ok
76  fFDDistAllTop = p.get<float>("FDDistAllTop", 60. ); // ok
77  fFDDistAllBottom = p.get<float>("FDDistAllBottom", 12. ); // ok
78  fFDDistAllFront = p.get<float>("FDDistAllFront", 18. ); // ok
79  fFDDistAllBack = p.get<float>("FDDistAllBack", 18. ); // ok
80 
81  //kNumuOptimizedContainFD2017
82  fFDMinKalmanFwdCell = p.get<int >("FDMinKalmanFwdCell", 7 ); // ok
83  fFDMinKalmanBakCell = p.get<int >("FDMinKalmanBakCell", 7 ); // ok
84  fFDMinCosFwdCell = p.get<int >("FDMinCosFwdCell", 1 ); // ok
85  fFDMinCosBakCell = p.get<int >("FDMinCosBakCell", 8 ); // ok
86  fFDMinPlanesToFront = p.get<unsigned int>("FDMinPlanesToFront", 2 ); // ok
87  fFDMinPlanesToBack = p.get<unsigned int>("FDMinPlanesToBack", 2 ); // ok
88 
89  // kNumuCosmicRej2018
90  fFDMinKalmanAngle = p.get<float >("FDMinKalmanAngle", 0.5 ); // ok
91  fFDMinContPID = p.get<float >("FDMinContPID", 0.53 ); // ok
92  fFDMaxSliceHits = p.get<unsigned int>("FDMaxSliceHits", 399 ); // ok
93  fFDMaxPngPtp = p.get<float >("FDMaxPngPtp", 0.9 ); // ok
94 
95  // Near Detector Specific
96  fNDMinPlane = p.get<unsigned int>("NDMinPlane", 2 ); // ok
97  fNDMaxPlane = p.get<unsigned int>("NDMaxPlane", 211 ); // ok
98  fNDMaxTrackStartZPos = p.get<float >("NDMaxTrackStartZPos", 1100.); // ok
99  fNDMaxTrackStopZPos = p.get<float >("NDMaxTrackStopZPos", 1275.); // ok
100  fNDMaxKalmanYPosAtTrans = p.get<float >("NDMaxKalmanYPosAtTrans", 55 ); // ok
101  fNDMinKalmanFwdCell = p.get<int >("NDMinKalmanFwdCell", 6 ); // ok
102  fNDMinKalmanBakCell = p.get<int >("NDMinKalmanBakCell", 11 ); // ok
103 
104  // fNDMaxHadCalEnergySum = p.get<float >("NDMaxHadCalEnergySum", 0.03 ); //
105 
106  fNDMaxShowerW = p.get<float >("NDMaxShowerW", 180. ); // ok
107  fNDMinShowerZ = p.get<float >("NDMinShowerZ", 20. ); // ok
108  fNDMaxShowerZ = p.get<float >("NDMaxShowerZ", 1525.); // ok
109 
110  fNDMaxOtherTrackStartZPos = p.get<float >("NDMaxOtherTrackStartZPos", 1275.); // ok
111  fNDMaxOtherTrackStopZPos = p.get<float >("NDMaxOtherTrackStopZPos", 1275.); // ok
112 
113  return;
114 }
115 
116 //------------------------------------------------------------------------------
118  novadaq::cnv::DetId const &detId) {
119  LOG_DEBUG("SelectionNumu2018")
120  << "Inside SelectionNumu2018::PassesSelection";
121  skim::ParametersNumu *params = dynamic_cast<skim::ParametersNumu*>(pars);
122 
123  if(params->TrackCCE() < 1.e-5 ||
124  //params->NeutrinoE() > fMaxNumuE ||
125  float(params->ReMIdValue()) <= fMinReMId ||
126  //params->CVNValue() <= fMinCVNmu ||
127  params->CVN2017Value() <= fMinCVN2017mu ||
128  params->SliceHits() < fMinSliceHits ||
130  LOG_DEBUG("SelectionNumu2018")
131  << "failed general cuts"
132  << "\nTrackCCE " << params->TrackCCE() << " / 0"
133  << "\nNeutrinoE " << params->NeutrinoE() << " / " << fMaxNumuE
134  << "\nReMIdValue " << params->ReMIdValue() << " / " << fMinReMId
135  << "\nCVNValue " << params->CVNValue() << " / " << fMinCVNmu
136  << "\nCVN2017Value " << params->CVN2017Value() << " / " << fMinCVN2017mu
137  << "\nSliceHits " << params->SliceHits() << " / " << fMinSliceHits
138  << "\nSliceContigPlanes " << params->SliceContigPlanes() << " / " << fMinSliceContigPlanes;
139 
140  return false;
141  }
142 
143  // if the numu criteria are satified, keep the slice
144  if(detId == novadaq::cnv::kFARDET) return this->KeepNumuFarDetectorSlice (*params);
145  else if(detId == novadaq::cnv::kNEARDET) return this->KeepNumuNearDetectorSlice(*params);
146 
147  return false;
148 }
149 
150 //------------------------------------------------------------------------------
152 {
153 
154  if(params.SliceHits() > fFDMaxSliceHits ||
155  params.CosRejAngleKal() <= fFDMinKalmanAngle ||
156  params.CosRejConCosPID() <= fFDMinContPID ||
157  params.NueCosRejPngPtp() >= fFDMaxPngPtp ||
160  params.CosRejCosFwdCell() < fFDMinCosFwdCell ||
161  params.CosRejCosBakCell() < fFDMinCosBakCell ||
162  params.PlanesToFront() < fFDMinPlanesToFront ||
163  params.PlanesToBack() < fFDMinPlanesToBack){
164  LOG_DEBUG("SelectionNumu2018")
165  << "failed FD cuts"
166  << "\nSliceHits: " << params.SliceHits() << " < " << fFDMaxSliceHits
167  << "\nCosRejKalFwdCell: " << params.CosRejKalFwdCell() << " > " << fFDMinKalmanFwdCell
168  << "\nCosRejKalBakCell: " << params.CosRejKalBakCell() << " > " << fFDMinKalmanBakCell
169  << "\nCosRejCosFwdCell: " << params.CosRejCosFwdCell() << " > " << fFDMinCosFwdCell
170  << "\nCosRejCosBakCell: " << params.CosRejCosBakCell() << " > " << fFDMinCosBakCell
171  << "\nCosRejAngleKal: " << params.CosRejAngleKal() << " > " << fFDMinKalmanAngle
172  << "\nCosRejConCosPID: " << params.CosRejConCosPID() << " > " << fFDMinContPID
173  << "\nNueCosRejPngPtp: " << params.NueCosRejPngPtp() << " < " << fFDMaxPngPtp
174  << "\nPlanesToFront: " << params.PlanesToFront() << " > " << fFDMinPlanesToFront
175  << "\nPlanesToBack: " << params.PlanesToBack() << " > " << fFDMinPlanesToBack;
176 
177  return false;
178  }
179 
180  // check the containment
181  if(params.DistAllTop() <= fFDDistAllTop ||
182  params.DistAllBottom() <= fFDDistAllBottom ||
183  params.DistAllWest() <= fFDDistAllWest ||
184  params.DistAllEast() <= fFDDistAllEast ||
185  params.DistAllFront() <= fFDDistAllFront ||
186  params.DistAllBack() <= fFDDistAllBack ){
187  LOG_DEBUG("SelectionNumu2018")
188  << "failed containment"
189  << "\nDistAllTop: " << params.DistAllTop() << " " << fFDDistAllTop
190  << "\nDistAllBottom: " << params.DistAllBottom() << " " << fFDDistAllBottom
191  << "\nDistAllWest: " << params.DistAllWest() << " " << fFDDistAllWest
192  << "\nDistAllEast: " << params.DistAllEast() << " " << fFDDistAllEast
193  << "\nDistAllFront: " << params.DistAllFront() << " " << fFDDistAllFront
194  << "\nDistAllBack: " << params.DistAllBack() << " " << fFDDistAllBack;
195 
196  return false;
197  }
198 
199  //if containment values are at initialisation values the event must be rejected
200  if(params.DistAllTop() == 9999 &&
201  params.DistAllBottom() == 9999 &&
202  params.DistAllWest() == 9999 &&
203  params.DistAllEast() == 9999 &&
204  params.DistAllFront() == 9999 &&
205  params.DistAllBack() == 9999 ){
206  LOG_DEBUG("SelectionNumu2018")
207  << "containment values not properly defined"
208  << "\nDistAllTop: " << params.DistAllTop()
209  << "\nDistAllBottom: " << params.DistAllBottom()
210  << "\nDistAllWest: " << params.DistAllWest()
211  << "\nDistAllEast: " << params.DistAllEast()
212  << "\nDistAllFront: " << params.DistAllFront()
213  << "\nDistAllBack: " << params.DistAllBack();
214 
215  return false;
216  }
217 
218  return true;
219 }
220 
221 //------------------------------------------------------------------------------
223 {
224 
225  if(params.SliceMinPlane() < fNDMinPlane ||
226  params.SliceMaxPlane() > fNDMaxPlane ||
227  params.TrackStartZ() >= fNDMaxTrackStartZPos ||
228  (params.TrackStopZ() >= fNDMaxTrackStopZPos &&
232  ){
233  LOG_DEBUG("SelectionNumu2018")
234  << "failed ND cuts"
235  << "\nSliceMinPlane: " << params.SliceMinPlane() << " " << fNDMinPlane
236  << "\nSliceMaxPlane: " << params.SliceMaxPlane() << " " << fNDMaxPlane
237  << "\nTrackStartZ: " << params.TrackStartZ() << " " << fNDMaxTrackStartZPos
238  << "\nTrackStopZ: " << params.TrackStopZ() << " " << fNDMaxTrackStopZPos
239  << "\nCosRejKalYPosAtTrans: " << params.CosRejKalYPosAtTrans() << " " << fNDMaxKalmanYPosAtTrans
240  << "\nCosRejKalFwdCellND: " << params.CosRejKalFwdCellND() << " " << fNDMinKalmanFwdCell
241  << "\nCosRejKalBakCellND: " << params.CosRejKalBakCellND() << " " << fNDMinKalmanBakCell;
242  return false;
243  }
244 
245  float maxW = std::max(std::max(std::abs(params.ShowerMaxX()), std::abs(params.ShowerMinX())),
246  std::max(std::abs(params.ShowerMaxY()), std::abs(params.ShowerMinY())));
247 
248  // check Shower(s) containment
249  if(params.NumShowers() > 0 && (
250  maxW > fNDMaxShowerW ||
251  params.ShowerMinVtxZ() < fNDMinShowerZ ||
252  params.ShowerMinEndZ() < fNDMinShowerZ ||
253  params.ShowerMaxVtxZ() > fNDMaxShowerZ ||
254  params.ShowerMaxEndZ() > fNDMaxShowerZ )){
255  LOG_DEBUG("SelectionNumu2018")
256  << "failed shower(s) containment cuts"
257  << "\nShowerMaxX: " << params.ShowerMaxX() << " " << fNDMaxShowerW
258  << "\nShowerMaxY: " << params.ShowerMaxY() << " " << fNDMaxShowerW
259  << "\nmaxW: " << maxW << " " << fNDMaxShowerW
260  << "\nShowerMinVtxZ: " << params.ShowerMinVtxZ() << " " << fNDMinShowerZ
261  << "\nShowerMinEndZ: " << params.ShowerMinEndZ() << " " << fNDMinShowerZ
262  << "\nShowerMaxVtxZ: " << params.ShowerMaxVtxZ() << " " << fNDMaxShowerZ
263  << "\nShowerMaxEndZ: " << params.ShowerMaxEndZ() << " " << fNDMaxShowerZ;
264  return false;
265  }
266 
267  // Check Other Tracks containment
270  ){
271  LOG_DEBUG("SelectionNumu2018")
272  << "failed other tracks containment cuts"
273  << "\nMaxOtherTrackStartZ: " << params.MaxOtherTrackStartZ() << " " << fNDMaxOtherTrackStartZPos
274  << "\nMaxOtherTrackStopZ: " << params.MaxOtherTrackStopZ() << " " << fNDMaxOtherTrackStopZPos;
275  return false;
276  }
277 
278  return true;
279 }
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
float fMaxNumuE
maximum energy for neutrinos
float const & ShowerMinVtxZ() const
float const & NumShowers() const
float const & MaxOtherTrackStartZ() const
float const & SliceHits() const
float fFDDistAllBack
minimum distance to the back wall
float const & CosRejCosFwdCell() const
float const & PlanesToBack() const
float const & ShowerMaxVtxZ() const
float const & ShowerMinEndZ() const
const char * p
Definition: xmltok.h:285
int fFDMinCosBakCell
see CosRejObj.h
float const & ShowerMaxY() const
float fFDDistAllFront
minimum distance to the front wall
double fMinReMId
minimum ReMId PID value to keep a slice
float const & CVN2017Value() const
double const & ReMIdValue() const
float fMinSliceHits
minimum number of hits in a slice to keep it
float const & ShowerMinX() const
float fMinQePID2Track
minimum qepid value to accept a 2 track event, set to -1.e6 to keep everything
float const & CosRejCosBakCell() const
float const & SliceContigPlanes() const
float const & CosRejKalBakCellND() const
float abs(float number)
Definition: d0nt_math.hpp:39
double fMinCVN2017mu
minimum 2017 CVNmu PID value to keep a slice, used for 2018 analysis
float const & SliceMinPlane() const
float const & DistAllWest() const
float fFDDistAllEast
minimum distance to the east wall
float fFDDistAllTop
minimum distance to the top wall
float const & CosRejKalFwdCellND() const
Far Detector at Ash River, MN.
float const & CosRejKalFwdCell() const
float const & TrackCCE() const
float const & DistAllTop() const
float fFDDistAllWest
minimum distance to the west wall
T get(std::string const &key) const
Definition: ParameterSet.h:231
float const & CosRejAngleKal() const
float const & TrackStopZ() const
float const & CVNValue() const
Near Detector in the NuMI cavern.
float const & MaxOtherTrackStopZ() const
float fMinQePID1Track
minimum qepid value to accept a 1 track event, set to -1.e6 to keep everything
float fFDDistAllBottom
minimum distance to the bottom wall
int fFDMinCosFwdCell
see CosRejObj.h
float const & CosRejKalBakCell() const
int fFDMinKalmanFwdCell
see CosRejObj.h
float const & TrackStartZ() const
void reconfigure(fhicl::ParameterSet const &p)
float const & CosRejKalYPosAtTrans() const
float const & PlanesToFront() const
bool KeepNumuFarDetectorSlice(skim::ParametersNumu const &params)
std::string pars("Th23Dmsq32")
float const & DistAllBottom() const
float const & DistAllEast() const
float const & SliceMaxPlane() const
bool KeepNumuNearDetectorSlice(skim::ParametersNumu const &params)
unsigned int fFDMinPlanesToBack
see NumuCuts.h
double fMinCVNmu
minimum CVNmu PID value to keep a slice
bool PassesSelection(skim::Parameters *pars, novadaq::cnv::DetId const &detId)
float const & DistAllFront() const
int fFDMinKalmanBakCell
see CosRejObj.h
float fMinSliceContigPlanes
minimum number of contiguous hit planes in a slice
float const & CosRejConCosPID() const
float const & ShowerMaxX() const
unsigned int fFDMinPlanesToFront
see NumuCuts.h
float const & NueCosRejPngPtp() const
float const & NeutrinoE() const
float const & ShowerMinY() const
float const & ShowerMaxEndZ() const
float const & DistAllBack() const