ParametersNue.cxx
Go to the documentation of this file.
1 //
2 // ParametersNue.cpp
3 // nova-mrb
4 //
5 // Created by Brian Rebel on 10/29/15.
6 // Copyright © 2015 Brian Rebel. All rights reserved.
7 //
9 
11 
13 
14 //------------------------------------------------------------------------------
16 {
17 
18 }
19 
20 
21 //---------------------------------------- Good for SA --------------------------------------
23  rb::Vertex const& vertex,
25  std::vector<rb::Shower const*> & showers,
26  std::vector<rb::Prong const*> & prongs,
27  std::vector<slid::ShowerLID const*> & slids,
28  slid::EventLID const& elid,
29  lem::PIDDetails const& lem,
30  cvn::Result const& cvn,
31  presel::Veto const& nueveto)
32 {
33  // if we are here, then there is at least 1 shower in the vector
34  // the leading shower has the most energy and has been sorted to be the
35  // first in the vector
36 
37  float diff = std::abs(1.*showers[0]->NXCell() - 1.*showers[0]->NYCell());
38  int shwHits = showers[0]->NXCell() + showers[0]->NYCell();
39  float sum = 1.*std::max(1, shwHits);
40 
41  // now check the run history and the diblocks in this run
42  // the lines below are copied from CAFMaker_module.cc
43  unsigned int dibmask = (fRunHistory->GoodDiBlockMask()&fRunHistory->GetConfiguration());
44  unsigned int dibfirst = 0;
45  if (dibmask) {
46  int iD;
47  iD = 0; while (!((dibmask>>iD)&1)) ++iD; dibfirst = iD+1;
48  }
49  unsigned int firstDBPlane = (dibfirst) ? (dibfirst - 1) * 64 : 0;
50 
51  // Fill the values
54  fParameters.fNueEnergy = SANueRecoE(showers[0]->TotalGeV(), slice.TotalGeV()-showers[0]->TotalGeV());
55  fParameters.fLIDVal = elid.Value();
56  fParameters.fLEMVal = lem.Value();
57  fParameters.fCVNVal = cvn.fOutput[4]+cvn.fOutput[5]+cvn.fOutput[6]+cvn.fOutput[7];
61  fParameters.fNumXCell = 1.*slice.NXCell();
62  fParameters.fNumYCell = 1.*slice.NYCell();
65  fVertex = vertex.GetXYZ();
70  std::abs(fVertex.Y()));
71  fParameters.fNumShowers = 1.*showers.size();
73  fParameters.fShowerCalE = showers[0]->CalorimetricEnergy();
74  fParameters.fShowerTotalE = showers[0]->TotalGeV();
75  fShowerDir = showers[0]->Dir();
79  fShowerVertex = showers[0]->Start();
83  fShowerEnd = showers[0]->Stop();
87 
88  fParameters.fShowerNumXCell = showers[0]->NXCell();
89  fParameters.fShowerNumYCell = showers[0]->NYCell();
90  fParameters.fShowerVtxDist = slids[0]->Gap();
93  cosrej.StopDistToWest());
95  cosrej.StopDistToEast());
97  cosrej.StopDistToBottom());
99  cosrej.StopDistToTop());
101  cosrej.StopDistToFront());
103  cosrej.StopDistToBack());
105  cosrej.StopMinDistToTop());
107  cosrej.StopMinDistToBottom());
109  cosrej.StopMinDistToWest());
111  cosrej.StopMinDistToEast());
113  cosrej.StopMinDistToFront());
115  cosrej.StopMinDistToBack());
127  fParameters.fVetoKeepNue = nueveto.Keep();
128 
129  fParameters.fCosShowers = 2.; // default value will pass any cuts
130 
131  fParameters.fNumShowersLID = 1.*slids.size();
132 
133  float nShowerHit = 0.;
134  if(showers.size() > 1)
135  fParameters.fCosShowers = ((fShowerDir * showers[1]->Dir())/
136  (fShowerDir.Mag() * showers[1]->Dir().Mag()));
137 
138  // The ProngLength cut applies for the longest prong, so find that in
139  // the following loop
140 
141  for(auto prg : prongs){
142  if(prg->TotalLength() > fParameters.fProngLength)
143  fParameters.fProngLength = prg->TotalLength();
144  }
145 
146  for(auto shw : showers){
147  nShowerHit += 1.*shw->NCell();
148  auto vtx = shw->Start();
149  auto end = shw->Stop();
150  auto maxX = std::max(vtx.X(), end.X());
151  auto maxY = std::max(vtx.Y(), end.Y());
152  auto minX = std::min(vtx.X(), end.X());
153  auto minY = std::min(vtx.Y(), end.Y());
154  if(fParameters.fShowerMinX > minX ) fParameters.fShowerMinX = minX;
156  if(fParameters.fShowerMaxX < maxX ) fParameters.fShowerMaxX = maxX;
158  if(fParameters.fShowerMinVtxZ > vtx.Z()) fParameters.fShowerMinVtxZ = vtx.Z();
160  if(fParameters.fShowerMaxVtxZ < vtx.Z()) fParameters.fShowerMaxVtxZ = vtx.Z();
162  }
163 
165 
166  return;
167 }
168 
169 //------------------------------- Good for Analysis 2017 and 2018 ------------------------------------------
171  rb::Vertex const& vertex,
172  cosrej::NueCosRej const& cosrej,
173  std::vector<rb::Shower const*> & showers,
174  std::vector<rb::Prong const*> & prongs,
175  std::vector<slid::ShowerLID const*> & slids,
176  std::map<std::string, float> closestsliceinfo,
177  slid::EventLID const& elid,
178  cvn::Result const& cvn,
179  presel::Veto const& nueveto)
180 {
181  // if we are here, then there is at least 1 shower in the vector
182  // the leading shower has the most energy and has been sorted to be the
183  // first in the vector
184 
185  float diff = std::abs(1.*showers[0]->NXCell() - 1.*showers[0]->NYCell());
186  int shwHits = showers[0]->NXCell() + showers[0]->NYCell();
187  float sum = 1.*std::max(1, shwHits);
188 
189  // now check the run history and the diblocks in this run
190  // the lines below are copied from CAFMaker_module.cc
191  unsigned int dibmask = (fRunHistory->GoodDiBlockMask()&fRunHistory->GetConfiguration());
192  unsigned int dibfirst = 0;
193  if (dibmask) {
194  int iD;
195  iD = 0; while (!((dibmask>>iD)&1)) ++iD; dibfirst = iD+1;
196  }
197  unsigned int firstDBPlane = (dibfirst) ? (dibfirst - 1) * 64 : 0;
198 
199  // Fill the values
202  fParameters.fNueEnergy = SANueRecoE(showers[0]->TotalGeV(), slice.TotalGeV()-showers[0]->TotalGeV()); // Energy function to be updated!
203  fParameters.fLIDVal = elid.Value();
204  // fParameters.fLEMVal = lem.Value();
205  fParameters.fLEMVal = std::numeric_limits<double>::min(); // No LEM for analysis 2017 - fill with dummy value;
209  fParameters.fNumXCell = 1.*slice.NXCell();
210  fParameters.fNumYCell = 1.*slice.NYCell();
213  fVertex = vertex.GetXYZ();
218  std::abs(fVertex.Y()));
219  fParameters.fNumShowers = 1.*showers.size();
221  fParameters.fShowerCalE = showers[0]->CalorimetricEnergy();
222  fParameters.fShowerTotalE = showers[0]->TotalGeV();
223  fShowerDir = showers[0]->Dir();
227  fShowerVertex = showers[0]->Start();
231  fShowerEnd = showers[0]->Stop();
235 
236  fParameters.fShowerNumXCell = showers[0]->NXCell();
237  fParameters.fShowerNumYCell = showers[0]->NYCell();
238  fParameters.fShowerVtxDist = slids[0]->Gap();
241  cosrej.StopDistToWest());
243  cosrej.StopDistToEast());
245  cosrej.StopDistToBottom());
247  cosrej.StopDistToTop());
249  cosrej.StopDistToFront());
251  cosrej.StopDistToBack());
253  cosrej.StopMinDistToTop());
255  cosrej.StopMinDistToBottom());
257  cosrej.StopMinDistToWest());
259  cosrej.StopMinDistToEast());
261  cosrej.StopMinDistToFront());
263  cosrej.StopMinDistToBack());
266 
268 
278  fParameters.fVetoKeepNue = nueveto.Keep();
279 
280  fParameters.fCosShowers = 2.; // default value will pass any cuts
281 
282  fParameters.fNumShowersLID = 1.*slids.size();
283 
284  //////////////////////// CVN ///////////////////////////
285  // Differnet versions have different number of outputs
286  //
287  // Explanation for Production4 is in :
288  // https://cdcvs.fnal.gov/redmine/projects/nova_reconstruction/wiki/Prod4_tag
289 
290  // check Output Vector Size
291  int cvnOutputSize = cvn.fOutput.size();
292 
293  if( cvnOutputSize == 16 ) { /// 2017 and before
294 
295  // CVN Value formula from CAFMaker: FillPIDs.cxx -->
296  fParameters.fCVNVal = cvn.fOutput[4]+cvn.fOutput[5]+cvn.fOutput[6]+cvn.fOutput[7];
297 
298  } else if( cvnOutputSize == 392 ) { /// 2018 ...
299  // See StandardRecord/CVNLabels.h for constants
300 
301  float nueid = 0;
302 
303  //std::vector<float>::const_iterator maxIt = std::max_element(cvn.fOutput.cbegin(), cvn.fOutput.cend());
304 
305  for(int idx = 0; idx < caf::kNumCVNFinalStates; ++idx){
307  const double prob = cvn.fOutput[idx];
308  if(state.nuPdg == 12) nueid += prob;
309  }
310 
311  nueid += cvn.fOutput[caf::kCVN_nE_Other];
312 
314  }
315 
316  /////////////////////////////////////////////////////
317 
318  /// Closest Slice
319  fParameters.fClosestSliceTime = closestsliceinfo["Time"];
320  fParameters.fClosestSliceDistFromTop = closestsliceinfo["DistFromTop"];
321  fParameters.fClosestSliceMinDist = closestsliceinfo["MinDist"];
322 
323  float nShowerHit = 0.;
324  if(showers.size() > 1)
325  fParameters.fCosShowers = ((fShowerDir * showers[1]->Dir())/
326  (fShowerDir.Mag() * showers[1]->Dir().Mag()));
327 
328  // The ProngLength cut applies for the longest prong, so find that in
329  // the following loop
330 
331  for(auto prg : prongs){
332  if(prg->TotalLength() > fParameters.fProngLength)
333  fParameters.fProngLength = prg->TotalLength();
334  }
335 
336  for(auto shw : showers){
337  nShowerHit += 1.*shw->NCell();
338  auto vtx = shw->Start();
339  auto end = shw->Stop();
340  auto maxX = std::max(vtx.X(), end.X());
341  auto maxY = std::max(vtx.Y(), end.Y());
342  auto minX = std::min(vtx.X(), end.X());
343  auto minY = std::min(vtx.Y(), end.Y());
344  if(fParameters.fShowerMinX > minX ) fParameters.fShowerMinX = minX;
346  if(fParameters.fShowerMaxX < maxX ) fParameters.fShowerMaxX = maxX;
348  if(fParameters.fShowerMinVtxZ > vtx.Z()) fParameters.fShowerMinVtxZ = vtx.Z();
350  if(fParameters.fShowerMaxVtxZ < vtx.Z()) fParameters.fShowerMaxVtxZ = vtx.Z();
352  }
353 
355 
356  return;
357 }
358 
359 ////------------------------------------------------------------------------------
360 //skim::ParametersNue::ParametersNue(caf::StandardRecord const& sr)
361 //{
362 //
363 // float srTotShwHits = 0.;
364 // double srTotShwMaxX = 0.;
365 // double srTotShwMaxY = 0.;
366 //// for(size_t i = 0; i < sr.shw.nshwlid; ++i){
367 //// srTotShwHits += sr.shw.shwlid[i].nhit;
368 //// srTotShwMaxX = std::max(std::max(sr.shw.shwlid[i].start.X(),
369 //// sr.shw.shwlid[i].stop.X()),
370 //// srTotShwMaxX);
371 //// srTotShwMaxY = std::max(std::max(sr.shw.shwlid[i].start.Y(),
372 //// sr.shw.shwlid[i].stop.Y()),
373 //// srTotShwMaxY);
374 //// }
375 //
376 // fParameters.fNumPlane = -999.;
377 // fParameters.fPlanesToFront = sr.sel.contain.nplanestofront;
378 // fParameters.fCellsPerPlane = sr.sel.nuecosrej.hitsperplane;
379 // //fParameters.fNumXCell = sr.shw.shwlid[0].nhitx;
380 // //fParameters.fNumYCell = sr.shw.shwlid[0].nhity;
381 // //fParameters.fSliceHits = sr.slc.nhit;
382 // //fParameters.fHitAsymmetry = 1.*std::abs(sr.shw.shwlid[0].nhitx - sr.shw.shwlid[0].nhity)/(1.*sr.shw.shwlid[0].nhitx + 1.*sr.shw.shwlid[0].nhity);
383 // //fParameters.fNumShowers = sr.shw.nshwlid;
384 // //fParameters.fShowerNumXCell = sr.shw.shwlid[0].nhitx;
385 // //fParameters.fShowerNumYCell = sr.shw.shwlid[0].nhity;
386 // //fParameters.fCosShowers = (sr.shw.shwlid[0].dir).Dot(sr.shw.shwlid[1].dir);
387 // //fParameters.fShowerCalE = sr.shw.shwlid[0].calE;
388 // //fParameters.fShowerDirX = sr.shw.shwlid[0].dir.X();
389 // //fParameters.fShowerDirY = sr.shw.shwlid[0].dir.Y();
390 // //fParameters.fShowerDirZ = sr.shw.shwlid[0].dir.Z();
391 // //fParameters.fProngLength = sr.vtx.elastic[0].png3d[0].len;
392 // fParameters.fFracShowerHits = srTotShwHits/(1.*sr.slc.nhit);
393 // //fParameters.fShowerVertexX = sr.shw.shwlid[0].start.X();
394 // //fParameters.fShowerVertexY = sr.shw.shwlid[0].start.Y();
395 // //fParameters.fShowerVertexZ = sr.shw.shwlid[0].start.Z();
396 // //fParameters.fShowerEndX = sr.shw.shwlid[0].stop.X();
397 // //fParameters.fShowerEndY = sr.shw.shwlid[0].stop.Y();
398 // //fParameters.fShowerEndZ = sr.shw.shwlid[0].stop.Z();
399 // fParameters.fShowerMaxX = srTotShwMaxX;
400 // fParameters.fShowerMaxY = srTotShwMaxY;
401 // fParameters.fShowerMinVtxZ = -999.;
402 // fParameters.fShowerMinEndZ = -999.;
403 // fParameters.fShowerMaxVtxZ = -999.;
404 // fParameters.fShowerMaxEndZ = -999.;
405 // //fParameters.fShowerVtxDist = sr.shw.shwlid[0].gap;
406 // fParameters.fShowerPt = sr.sel.nuecosrej.partptp;
407 // fParameters.fVertexX = sr.vtx.elastic[0].vtx.X();
408 // fParameters.fVertexY = sr.vtx.elastic[0].vtx.Y();
409 // fParameters.fVertexZ = sr.vtx.elastic[0].vtx.Z();
410 // fParameters.fVertexMaxW = -999.;
411 // fParameters.fCalorimetricE = sr.slc.calE;
412 // fParameters.fNueEnergy = SANueRecoE(sr.energy.nue.rawgevshw, sr.energy.nue.rawgevhad);
413 // fParameters.fMinWestDist = std::min(sr.sel.nuecosrej.startwest,sr.sel.nuecosrej.stopwest);
414 // fParameters.fMinEastDist = std::min(sr.sel.nuecosrej.starteast,sr.sel.nuecosrej.stopeast);
415 // fParameters.fMinBotDist = std::min(sr.sel.nuecosrej.startbottom,sr.sel.nuecosrej.stopbottom);
416 // fParameters.fMinTopDist = std::min(sr.sel.nuecosrej.starttop,sr.sel.nuecosrej.stoptop);
417 // fParameters.fMinFrontDist = std::min(sr.sel.nuecosrej.startfront, sr.sel.nuecosrej.stopfront);
418 // fParameters.fMinBackDist = std::min(sr.sel.nuecosrej.startback, sr.sel.nuecosrej.stopback);
419 // fParameters.fDistAllTop = sr.sel.nuecosrej.distallpngtop;
420 // fParameters.fDistAllBottom = sr.sel.nuecosrej.distallpngbottom;
421 // fParameters.fDistAllWest = sr.sel.nuecosrej.distallpngwest;
422 // fParameters.fDistAllEast = sr.sel.nuecosrej.distallpngeast;
423 // fParameters.fDistAllFront = sr.sel.nuecosrej.distallpngfront;
424 // fParameters.fDistAllBack = sr.sel.nuecosrej.distallpngback;
425 // fParameters.fVetoKeepNue = sr.sel.veto.keep;
426 // fParameters.fSparsenessAsymm = sr.sel.nuecosrej.sparsenessasymm;
427 // fParameters.fSparsenessAsymm = sr.sel.nuecosrej.sparsenessasymmslice;
428 // //fParameters.fLIDVal = sr.sel.elecid.ann;
429 // fParameters.fLEMVal = sr.sel.lem.pid;
430 // fParameters.fCVNVal = sr.sel.cvn.nueid;
431 //
432 // return;
433 //}
434 
435 //------------------------------------------------------------------------------
437 {
438 
439 }
440 
441 //------------------------------------------------------------------------------
442 float skim::ParametersNue::SANueRecoE(float rawEM, float rawHA)
443 {
444  // Values from the fit in docdb 15174
445  float p0 = 0.687;
446  float p1 = 0.702;
447  float p2 = 1.211;
448  float p3 = 0.543;
449  float p4 = 0.248;
450  float p5 = -0.140;
451  float recoEn = rawHA*rawHA*p5 + rawEM*rawEM*p4 + rawEM*rawHA*p3 + rawHA*p2 + rawEM*p1 + p0;
452  return recoEn;
453  }
454 
455 
456 //------------------------------------------------------------------------------
458 {
459 
460  std::map<std::string, std::pair<double, double> > comps;
461 
462  comps["fNumPlane"] = std::make_pair(fParameters.fNumPlane, compCuts.fNumPlane);
463  comps["fPlanesToFront"] = std::make_pair(fParameters.fPlanesToFront, compCuts.fPlanesToFront);
464  comps["fCellsPerPlane"] = std::make_pair(fParameters.fCellsPerPlane, compCuts.fCellsPerPlane);
465  comps["fNumXCell"] = std::make_pair(fParameters.fNumXCell, compCuts.fNumXCell);
466  comps["fNumYCell"] = std::make_pair(fParameters.fNumYCell, compCuts.fNumYCell);
467  comps["fSliceHits"] = std::make_pair(fParameters.fSliceHits, compCuts.fSliceHits);
468  comps["fHitAsymmetry"] = std::make_pair(fParameters.fHitAsymmetry, compCuts.fHitAsymmetry);
469  comps["fNumShowers"] = std::make_pair(fParameters.fNumShowers, compCuts.fNumShowers);
470  comps["fShowerNumXCell"] = std::make_pair(fParameters.fShowerNumXCell, compCuts.fShowerNumXCell);
471  comps["fShowerNumYCell"] = std::make_pair(fParameters.fShowerNumYCell, compCuts.fShowerNumYCell);
472  comps["fCosShowers"] = std::make_pair(fParameters.fCosShowers, compCuts.fCosShowers);
473  comps["fShowerDirX"] = std::make_pair(fParameters.fShowerDirX, compCuts.fShowerDirX);
474  comps["fShowerDirY"] = std::make_pair(fParameters.fShowerDirY, compCuts.fShowerDirY);
475  comps["fShowerDirZ"] = std::make_pair(fParameters.fShowerDirZ, compCuts.fShowerDirZ);
476  comps["fShowerLength"] = std::make_pair(fParameters.fProngLength, compCuts.fProngLength);
477  comps["fShowerCalE"] = std::make_pair(fParameters.fShowerCalE, compCuts.fShowerCalE);
478  comps["fFracShowerHits"] = std::make_pair(fParameters.fFracShowerHits, compCuts.fFracShowerHits);
479  comps["fShowerVertexX"] = std::make_pair(fParameters.fShowerVertexX, compCuts.fShowerVertexX);
480  comps["fShowerVertexY"] = std::make_pair(fParameters.fShowerVertexY, compCuts.fShowerVertexY);
481  comps["fShowerVertexZ"] = std::make_pair(fParameters.fShowerVertexZ, compCuts.fShowerVertexZ);
482  comps["fShowerEndX"] = std::make_pair(fParameters.fShowerEndX, compCuts.fShowerEndX);
483  comps["fShowerEndY"] = std::make_pair(fParameters.fShowerEndY, compCuts.fShowerEndY);
484  comps["fShowerEndZ"] = std::make_pair(fParameters.fShowerEndZ, compCuts.fShowerEndZ);
485  comps["fShowerMinX"] = std::make_pair(fParameters.fShowerMinX, compCuts.fShowerMinX);
486  comps["fShowerMinY"] = std::make_pair(fParameters.fShowerMinY, compCuts.fShowerMinY);
487  comps["fShowerMaxX"] = std::make_pair(fParameters.fShowerMaxX, compCuts.fShowerMaxX);
488  comps["fShowerMaxY"] = std::make_pair(fParameters.fShowerMaxY, compCuts.fShowerMaxY);
489  comps["fShowerMinVtxZ"] = std::make_pair(fParameters.fShowerMinVtxZ, compCuts.fShowerMinVtxZ);
490  comps["fShowerMinEndZ"] = std::make_pair(fParameters.fShowerMinEndZ, compCuts.fShowerMinEndZ);
491  comps["fShowerMaxVtxZ"] = std::make_pair(fParameters.fShowerMaxVtxZ, compCuts.fShowerMaxVtxZ);
492  comps["fShowerMaxEndZ"] = std::make_pair(fParameters.fShowerMaxEndZ, compCuts.fShowerMaxEndZ);
493  comps["fShowerVtxDist"] = std::make_pair(fParameters.fShowerVtxDist, compCuts.fShowerVtxDist);
494  comps["fShowerPt"] = std::make_pair(fParameters.fShowerPt, compCuts.fShowerPt);
495  comps["fVertexX"] = std::make_pair(fParameters.fVertexX, compCuts.fVertexX);
496  comps["fVertexY"] = std::make_pair(fParameters.fVertexY, compCuts.fVertexY);
497  comps["fVertexZ"] = std::make_pair(fParameters.fVertexZ, compCuts.fVertexZ);
498  comps["fVertexMaxW"] = std::make_pair(fParameters.fVertexMaxW, compCuts.fVertexMaxW);
499  comps["fCalorimetricE"] = std::make_pair(fParameters.fCalorimetricE, compCuts.fCalorimetricE);
500  comps["fNueEnergy"] = std::make_pair(fParameters.fNueEnergy, compCuts.fNueEnergy);
501  comps["fMinWestDist"] = std::make_pair(fParameters.fMinWestDist, compCuts.fMinWestDist);
502  comps["fMinEastDist"] = std::make_pair(fParameters.fMinEastDist, compCuts.fMinEastDist);
503  comps["fMinBotDist"] = std::make_pair(fParameters.fMinBotDist, compCuts.fMinBotDist);
504  comps["fMinTopDist"] = std::make_pair(fParameters.fMinTopDist, compCuts.fMinTopDist);
505  comps["fMinFrontDist"] = std::make_pair(fParameters.fMinFrontDist, compCuts.fMinFrontDist);
506  comps["fMinBackDist"] = std::make_pair(fParameters.fMinBackDist, compCuts.fMinBackDist);
507  comps["fDistAllTop"] = std::make_pair(fParameters.fDistAllTop, compCuts.fDistAllTop);
508  comps["fDistAllBottom"] = std::make_pair(fParameters.fDistAllBottom, compCuts.fDistAllBottom);
509  comps["fDistAllWest"] = std::make_pair(fParameters.fDistAllWest, compCuts.fDistAllWest);
510  comps["fDistAllEast"] = std::make_pair(fParameters.fDistAllEast, compCuts.fDistAllEast);
511  comps["fDistAllFront"] = std::make_pair(fParameters.fDistAllFront, compCuts.fDistAllFront);
512  comps["fDistAllBack"] = std::make_pair(fParameters.fDistAllBack, compCuts.fDistAllBack);
513  comps["fVetoKeepNue"] = std::make_pair(fParameters.fVetoKeepNue, compCuts.fVetoKeepNue);
514  comps["fSparsenessAsymm"] = std::make_pair(fParameters.fSparsenessAsymm, compCuts.fSparsenessAsymm);
515  comps["fSparsenessAsymmSlice"] = std::make_pair(fParameters.fSparsenessAsymmSlice, compCuts.fSparsenessAsymmSlice);
516  comps["fLIDVal"] = std::make_pair(fParameters.fLIDVal, compCuts.fLIDVal);
517  comps["fLEMVal"] = std::make_pair(fParameters.fLEMVal, compCuts.fLEMVal);
518  comps["fCVNVal"] = std::make_pair(fParameters.fCVNVal, compCuts.fCVNVal);
519 
520  comps["fCVNValCosPID"] = std::make_pair(fParameters.fCVNValCosPID, compCuts.fCVNValCosPID);
521  comps["fCosPIDContain"] = std::make_pair(fParameters.fCosPIDContain, compCuts.fCosPIDContain);
522 
523  comps["fClosestSliceTime"] = std::make_pair(fParameters.fClosestSliceTime, compCuts.fClosestSliceTime );
524  comps["fClosestSliceDistFromTop"] = std::make_pair(fParameters.fClosestSliceDistFromTop, compCuts.fClosestSliceDistFromTop );
525  comps["fClosestSliceMinDist"] = std::make_pair(fParameters.fClosestSliceMinDist, compCuts.fClosestSliceMinDist );
526 
527  double fracDiff = 0.;
528 
529  for(auto itr : comps){
530 
531  auto skimSR = itr.second;
532 
533  fracDiff = std::abs((skimSR.first - skimSR.second)/skimSR.first);
534  if( fracDiff > 1.e-3)
535  LOG_VERBATIM("ParametersNue")
536  << itr.first << ": " << skimSR.first << " " << skimSR.second << " " << fracDiff;
537  }
538 
539  return;
540 }
541 
542 namespace skim{
543  //------------------------------------------------------------------------------
544  std::ostream& operator<< (std::ostream& o, skim::ParametersNue const& p)
545  {
546  o << "\nfNumPlane " << p.ParametersStruct().fNumPlane
547  << "\nfPlanesToFront " << p.ParametersStruct().fPlanesToFront
548  << "\nfCellsPerPlane " << p.ParametersStruct().fCellsPerPlane
549  << "\nfNumXCell " << p.ParametersStruct().fNumXCell
550  << "\nfNumYCell " << p.ParametersStruct().fNumYCell
551  << "\nfSliceHits " << p.ParametersStruct().fSliceHits
552  << "\nfHitAsymmetry " << p.ParametersStruct().fHitAsymmetry
553  << "\nfNumShowers " << p.ParametersStruct().fNumShowers
554  << "\nfShowerNumXCell " << p.ParametersStruct().fShowerNumXCell
555  << "\nfShowerNumYCell " << p.ParametersStruct().fShowerNumYCell
556  << "\nfCosShowers " << p.ParametersStruct().fCosShowers
557  << "\nfShowerDirX " << p.ParametersStruct().fShowerDirX
558  << "\nfShowerDirY " << p.ParametersStruct().fShowerDirY
559  << "\nfShowerDirZ " << p.ParametersStruct().fShowerDirZ
560  << "\nfProngLength " << p.ParametersStruct().fProngLength
561  << "\nfShowerCalE " << p.ParametersStruct().fShowerCalE
562  << "\nfFracShowerHits " << p.ParametersStruct().fFracShowerHits
563  << "\nfShowerVertexX " << p.ParametersStruct().fShowerVertexX
564  << "\nfShowerVertexY " << p.ParametersStruct().fShowerVertexY
565  << "\nfShowerVertexZ " << p.ParametersStruct().fShowerVertexZ
566  << "\nfShowerEndX " << p.ParametersStruct().fShowerEndX
567  << "\nfShowerEndY " << p.ParametersStruct().fShowerEndY
568  << "\nfShowerEndZ " << p.ParametersStruct().fShowerEndZ
569  << "\nfShowerMinX " << p.ParametersStruct().fShowerMinX
570  << "\nfShowerMinY " << p.ParametersStruct().fShowerMinY
571  << "\nfShowerMaxX " << p.ParametersStruct().fShowerMaxX
572  << "\nfShowerMaxY " << p.ParametersStruct().fShowerMaxY
573  << "\nfShowerMinVtxZ " << p.ParametersStruct().fShowerMinVtxZ
574  << "\nfShowerMinEndZ " << p.ParametersStruct().fShowerMinEndZ
575  << "\nfShowerMaxVtxZ " << p.ParametersStruct().fShowerMaxVtxZ
576  << "\nfShowerMaxEndZ " << p.ParametersStruct().fShowerMaxEndZ
577  << "\nfShowerVtxDist " << p.ParametersStruct().fShowerVtxDist
578  << "\nfShowerPt " << p.ParametersStruct().fShowerPt
579  << "\nfVertexX " << p.ParametersStruct().fVertexX
580  << "\nfVertexY " << p.ParametersStruct().fVertexY
581  << "\nfVertexZ " << p.ParametersStruct().fVertexZ
582  << "\nfVertexMaxW " << p.ParametersStruct().fVertexMaxW
583  << "\nfCalorimetricE " << p.ParametersStruct().fCalorimetricE
584  << "\nfNueEnergy " << p.ParametersStruct().fNueEnergy
585  << "\nfMinWestDist " << p.ParametersStruct().fMinWestDist
586  << "\nfMinEastDist " << p.ParametersStruct().fMinEastDist
587  << "\nfMinBotDist " << p.ParametersStruct().fMinBotDist
588  << "\nfMinTopDist " << p.ParametersStruct().fMinTopDist
589  << "\nfMinFrontDist " << p.ParametersStruct().fMinFrontDist
590  << "\nfMinBackDist " << p.ParametersStruct().fMinBackDist
591  << "\nfDistAllTop " << p.ParametersStruct().fDistAllTop
592  << "\nfDistAllBottom " << p.ParametersStruct().fDistAllBottom
593  << "\nfDistAllWest " << p.ParametersStruct().fDistAllWest
594  << "\nfDistAllEast " << p.ParametersStruct().fDistAllEast
595  << "\nfDistAllFront " << p.ParametersStruct().fDistAllFront
596  << "\nfDistAllBack " << p.ParametersStruct().fDistAllBack
597  << "\nfVetoKeepNue " << p.ParametersStruct().fVetoKeepNue
598  << "\nfSparsenessAsymm " << p.ParametersStruct().fSparsenessAsymm
599  << "\nfSparsenessAsymmSlice " << p.ParametersStruct().fSparsenessAsymmSlice
600  << "\nfLIDVal " << p.ParametersStruct().fLIDVal
601  << "\nfLEMVal " << p.ParametersStruct().fLEMVal
602  << "\nfCVNVal " << p.ParametersStruct().fCVNVal;
603 
604  return o;
605  }
606 }
607 
float fShowerMaxY
max y for all shower end points
T max(const caf::Proxy< T > &a, T b)
float fClosestSliceDistFromTop
float fMinBotDist
minimum distance to the bottom edge
float fNumPlane
number of planes in slice
A 3D position and time representing an interaction vertex.
Definition: Vertex.h:15
float fMinFrontDist
minimum distance to the front edge
float fSparsenessAsymmSlice
assymmetry in the zero-hit planes at the start and end of the slice. Used for rejection of backward c...
float fCosShowers
cosine of angle between showers in slice
Definition: event.h:34
double minY
Definition: plot_hist.C:9
float SANueRecoE(float rawEM, float rawHA)
float fVertexX
vertex of the interaction
double StopMinDistToBottom() const
Minimum perpendicular distance of all prongs stop points to the bottom edge of the detector...
Definition: NueCosRej.h:124
float fDistAllTop
distance of all showers in slice from the top edge of detector
float fLIDVal
value of the LID PID
float fMinTopDist
minimum distance to the top edge
NueCutParameters fParameters
float fShowerMinY
min y for all shower end points
X or Y views.
Definition: PlaneGeo.h:30
float fVertexMaxW
maximum w value of the vertex
float fShowerEndY
end of the primary shower
double StopDistToTop() const
Perpendicular distance of stop point of the leading prong to the top edge of the detector.
Definition: NueCosRej.h:72
float fShowerDirX
direction of the primary shower in slice
float fHitAsymmetry
hit asymmetry between views in slice
friend std::ostream & operator<<(std::ostream &o, ParametersNue const &p)
const char * p
Definition: xmltok.h:285
double StopMinDistToWest() const
Minimum perpendicular distance of all prongs stop points to the west edge of the detector (west is po...
Definition: NueCosRej.h:136
double StartMinDistToTop() const
Minimum perpendicular distance of all prongs start points.
Definition: NueCosRej.h:96
float fShowerVtxDist
distance between the shower vertex and interaction vertex
A collection of associated CellHits.
Definition: Cluster.h:47
float fShowerCalE
calorimetric energy in primary shower in slice
float fShowerMinVtxZ
minimum Z position of all showers
double maxY
Definition: plot_hist.C:10
float fShowerMaxX
max x for all shower end points
double StopDistToWest() const
Perpendicular distance of stop point of the leading prong to the west edge of the detector (west is p...
Definition: NueCosRej.h:88
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
double StopDistToFront() const
Perpendicular distance of stop point of the leading prong to the front edge of the detector...
Definition: NueCosRej.h:80
bool Keep() const
Definition: Veto.cxx:125
float fShowerDirZ
direction of the primary shower in slice
Defines an enumeration for prong classification.
const int kCVN_nE_Other
Definition: CVNLabels.h:402
float fShowerNumXCell
number of x cells in slice
std::vector< float > fOutput
Vector of outputs from neural net.
Definition: Result.h:30
float abs(float number)
Definition: d0nt_math.hpp:39
Module to create a summary of total POT seen in a job.
Definition: Evaluator.h:27
double Value() const
Definition: PID.h:22
float fVertexZ
vertex of the interaction
float fPlanesToFront
number of planes to the front of detector
float fVertexY
vertex of the interaction
float fShowerVertexZ
vertex of the primary shower
PID
Definition: FillPIDs.h:14
A class detailing the cuts made on a particular slice.
Definition: Veto.h:12
double StopMinDistToTop() const
Minimum perpendicular distance of all prongs stop points to the top edge of the detector.
Definition: NueCosRej.h:120
float fMinBackDist
minimum distance to the back edge
float fMinEastDist
minimum distance to the east edge
float fDistAllFront
distance of all showers in slice from the front edge of detector
double StartMinDistToEast() const
Minimum perpendicular distance of all prongs start points to the east edge of the detector (east is n...
Definition: NueCosRej.h:116
double StopMinDistToEast() const
Minimum perpendicular distance of all prongs stop points to the east edge of the detector (east is ne...
Definition: NueCosRej.h:140
double CalorimetricEnergy(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple estimate of neutrino energy.
Definition: Cluster.cxx:439
double StartMinDistToBottom() const
Minimum perpendicular distance of all prongs start points to the bottom edge of the detector...
Definition: NueCosRej.h:100
float fFracShowerHits
fraction of slice hits in the primary shower
static Var nueid(const std::shared_ptr< CAFAnaModel > &model)
Definition: SliceLIDVar.h:83
double StartMinDistToBack() const
Minimum perpendicular distance of all prongs start points to the back edge of the detector...
Definition: NueCosRej.h:108
float fLEMVal
value of the LEM PID
float fMinWestDist
minimum distance to the west edge
float fNumShowers
number of showers in slice
TVector3 GetXYZ() const
Definition: Vertex.cxx:45
float fProngLength
length of largest prong in slice
double ParticleShowerTransMom() const
Transverse component of the event momentum. Particle masses in the momentum calculation are inferred ...
Definition: NueCosRej.h:32
float fShowerMaxEndZ
maximum Z position of all showers
float fDistAllEast
distance of all showers in slice from the east edge of detector
double CosPIDContain() const
A BDT trained based on simple containment variables Used in the peripheral sample of the 2017 analysi...
Definition: NueCosRej.h:145
NueCutParameters const & ParametersStruct() const
art::ServiceHandle< nova::dbi::RunHistoryService > fRunHistory
the RunHistory service
std::vector< std::string > comps
double StartMinDistToWest() const
Minimum perpendicular distance of all prongs start points to the west edge of the detector (west is p...
Definition: NueCosRej.h:112
double StartDistToBottom() const
Perpendicular distance of start point of the leading prong to the bottom edge of the detector...
Definition: NueCosRej.h:52
double StopMinDistToFront() const
Minimum perpendicular distance of all prongs stop points to the front edge of the detector...
Definition: NueCosRej.h:128
double StopDistToBack() const
Perpendicular distance of stop point of the leading prong to the back edge of the detector...
Definition: NueCosRej.h:84
float fDistAllBottom
distance of all showers in slice from the bottom edge of detector
float fSliceTotalE
TotalE of the slice.
double StartMinDistToFront() const
Minimum perpendicular distance of all prongs start points to the front edge of the detector...
Definition: NueCosRej.h:104
float fNueEnergy
reconstructed nue energy
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
unsigned int NYCell() const
Number of cells in the y-view.
Definition: Cluster.h:108
unsigned int MinPlane(geo::View_t view=geo::kXorY) const
Definition: Cluster.cxx:462
float fSparsenessAsymm
assymmetry in the zero-hit planes at the start and end of the shower. Used for rejection of backward ...
int NMissingPlanes(geo::View_t view) const
Total number of missing planes in cluster.
Definition: Cluster.cxx:693
double StartDistToTop() const
Perpendicular distance of start point of the leading prong to the top edge of the detector...
Definition: NueCosRej.h:48
float fShowerDirY
direction of the primary shower in slice
Cosmic Rejection PIDs for Numu analysis.
Definition: FillParentInfo.h:9
float fShowerTotalE
TotalE energy in primary shower in slice.
void Compare(NueCutParameters const &compCuts)
Result, basic output of CVN neural net.
Definition: Result.h:15
const int kNumCVNFinalStates
Definition: CVNLabels.h:11
float fShowerEndX
end of the primary shower
float fShowerMaxVtxZ
maximum Z position of all showers
double SparsenessAsymm() const
Asymmetry in the zero-hit planes at the start and end of the leading shower.
Definition: NueCosRej.h:195
float fSliceMinPlane
minimum plane of the slice
unsigned int NXCell() const
Number of cells in the x-view.
Definition: Cluster.h:106
double StartDistToEast() const
Perpendicular distance of start point of the leading prong to the east edge of the detector (east is ...
Definition: NueCosRej.h:68
float fSliceHits
total number of hits in slice
float fDistAllWest
distance of all showers in slice from the west edge of detector
unsigned int ExtentPlane(geo::View_t view=geo::kXorY) const
Definition: Cluster.h:250
float fNumShowersLID
size of showerLIDs in a slice
float fShowerVertexY
vertex of the primary shower
double StopDistToBottom() const
Perpendicular distance of stop point of the leading prong to the bottom edge of the detector...
Definition: NueCosRej.h:76
float fShowerEndZ
end of the primary shower
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
Definition: Cluster.cxx:378
float fShowerMinX
min x for all shower end points
float fNumYCell
number of y cells in slice
Attach LEM-specific info to the base PID object.
Definition: PIDDetails.h:20
double HitsPerPlane() const
Number of hits in slice per number of planes in leading prong. This is a handle on rejecting FEB flas...
Definition: NueCosRej.h:22
float fCellsPerPlane
number of cells per plane in slice
const CVNFinalState cvnStates[kNumCVNFinalStates]
Definition: CVNLabels.h:12
double StartDistToBack() const
Perpendicular distance of start point of the leading prong to the back edge of the detector...
Definition: NueCosRej.h:60
float fCVNValCosPID
value of the CVN PID for peripheral sample (&&CosPIDContain)
bool fVetoKeepNue
cosmic rejection boolean
float fShowerPt
shower transverse momentum
float fCalorimetricE
calorimetric energy of the slice
#define LOG_VERBATIM(category)
double StartDistToFront() const
Perpendicular distance of start point of the leading prong to the front edge of the detector...
Definition: NueCosRej.h:56
double StopMinDistToBack() const
Minimum perpendicular distance of all prongs stop points to the back edge of the detector.
Definition: NueCosRej.h:132
T min(const caf::Proxy< T > &a, T b)
float fCosPIDContain
CosPIDContain used for peripheral sample.
int GoodDiBlockMask(int subrun=-1, bool reload=false)
Double_t sum
Definition: plot.C:31
Float_t e
Definition: plot.C:35
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
double StopDistToEast() const
Perpendicular distance of stop point of the leading prong to the east edge of the detector (east is n...
Definition: NueCosRej.h:92
float fShowerMinEndZ
minimum Z position of all showers
float fShowerNumYCell
number of y cells in slice
float fNumXCell
number of x cells in slice
float fDistAllBack
distance of all showers in slice from the back edge of detector
double SparsenessAsymmSlice() const
Asymmetry in the zero-hit planes at the start and end of the slice.
Definition: NueCosRej.h:203
float fShowerVertexX
vertex of the primary shower
float fCVNVal
value of the CVN PI
double StartDistToWest() const
Perpendicular distance of start point of the leading prong to the west edge of the detector (west is ...
Definition: NueCosRej.h:64