All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NumuCutsSBND202106.cxx
Go to the documentation of this file.
1 #include <cmath>
2 #include <iostream>
5 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
6 #include <cassert>
7 
8 namespace ana{
9 
10  const Cut kInFV([](const caf::SRSliceProxy* slc)
11  {
12  return ( slc->vertex.x > (-199.15 + 10) && slc->vertex.x < (199.15 - 10) && slc->vertex.y > (-200. + 10) && slc->vertex.y < (200. - 10) && slc->vertex.z > (0.0 + 10) && slc->vertex.z < (500. - 50));
13  });
14 
15  const Cut kSlcFlashMatchTimeCut([](const caf::SRSliceProxy* slc)
16  {
17  if(std::isnan(slc->fmatch.time)) return false;
18 
19  bool InBeam = (slc->fmatch.time > 0. && slc->fmatch.time < 1.800);
20  return ( InBeam );
21  });
22 
23  const Cut kSlcFlashMatchScoreCut([](const caf::SRSliceProxy* slc)
24  {
25  return ( slc->fmatch.score < 7 );
26  });
27 
28  //const Cut kHasPrimaryMuonTrk = kPrimaryMuonTrkIdx != -1;
29  const Cut kHasPrimaryMuonTrk([](const caf::SRSliceProxy* slc)
30  {
31  int ptrkid = kPrimaryMuonTrkIdx(slc);
32  double ptrkrecop = kPrimaryMuonTrkP(slc);
33  //return ( kPrimaryMuonTrkIdx != -1 && !isnan(kPrimaryMuonTrkP) && kPrimaryMuonTrkP > 0. && kPrimaryMuonTrkP < 7.5);
34  return ( ptrkid != -1 && !isnan(ptrkrecop) && ptrkrecop > 0. && ptrkrecop < 7.5);
35  });
36 
37 
38  //CRT Matching
39  const Cut kCRTTrackAngleCut([](const caf::SRSliceProxy* slc)
40  {
41  int ptrkid = kPrimaryMuonTrkIdx(slc);
42  const caf::SRTrackProxy& ptrk = slc->reco.trk[ptrkid];
43  return ( isnan(ptrk.crttrack.angle) || ptrk.crttrack.angle > 0.05);
44  });
45 
46  const Cut kCRTHitDistanceCut([](const caf::SRSliceProxy* slc)
47  {
48  int ptrkid = kPrimaryMuonTrkIdx(slc);
49  const caf::SRCRTHitMatchProxy& crthit = slc->reco.trk[ptrkid].crthit;
50 
51  // No candidate CRT hit matches
52  if(std::isnan(crthit.hit.time) || std::isnan(crthit.distance)) return true;
53 
54  //Beam time window used in SBNSoftware/sbncode/blob/develop/sbncode/NuMuSelection/jupyter-ana/selection.py
55  return crthit.distance > 5 || (crthit.hit.time > 0. && crthit.hit.time < 1.800);
56  });
57 
58 }
def ptrk
Definition: selection.py:74
const Cut kSlcFlashMatchTimeCut([](const caf::SRSliceProxy *slc){if(std::isnan(slc->fmatch.time)) return false;bool InBeam=(slc->fmatch.time > 0.&&slc->fmatch.time< 1.800);return(InBeam);})
const Cut kHasPrimaryMuonTrk([](const caf::SRSliceProxy *slc){int ptrkid=kPrimaryMuonTrkIdx(slc);double ptrkrecop=kPrimaryMuonTrkP(slc);return(ptrkid!=-1 &&!isnan(ptrkrecop)&&ptrkrecop > 0.&&ptrkrecop< 7.5);})
process_name opflashCryoW ana
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
const Cut kCRTTrackAngleCut([](const caf::SRSliceProxy *slc){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRTrackProxy &ptrk=slc->reco.trk[ptrkid];return(isnan(ptrk.crttrack.angle)||ptrk.crttrack.angle > 0.05);})
const Var kPrimaryMuonTrkIdx([](const caf::SRSliceProxy *slc){double longest=-1;int best_idx=-1;double dist=-1;bool atslc, contained, maybe_muon_exiting, maybe_muon_contained;float chi2_proton, chi2_muon;for(unsigned int trkidx=0;trkidx< slc->reco.trk.size();++trkidx){const caf::SRTrackProxy &trk=slc->reco.trk[trkidx];if(trk.bestplane==-1) continue;dist=sqrt((pow(trk.start.x-slc->vertex.x, 2))+(pow(trk.start.y-slc->vertex.y, 2))+(pow(trk.start.z-slc->vertex.z, 2)));atslc=dist< 10;if(!atslc||!trk.pfp.parent_is_primary) continue;contained=((-199.15+10)< trk.end.x &&trk.end.x< (199.15-10)&&(-200.+10)< trk.end.y &&trk.end.y< (200.-10)&&(0.0+10)< trk.end.z &&trk.end.z< (500.-50));chi2_proton=trk.chi2pid[trk.bestplane].chi2_proton;chi2_muon=trk.chi2pid[trk.bestplane].chi2_muon;maybe_muon_exiting=!contained &&trk.len > 100;maybe_muon_contained=contained &&chi2_proton > 60 &&chi2_muon< 30 &&trk.len > 50;if(!maybe_muon_contained &&!maybe_muon_exiting) continue;if(trk.len > longest){longest=trk.len;best_idx=trkidx;}}return best_idx;})
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
BEGIN_PROLOG opflashTPC3 mcopflashTPC3 sequence::icarus_reco_flash sequence::icarus_mc_reco_opt gaushitsel gaushitTPC0 gaushitTPC1 gaushitTPC2 gaushitTPC3 icarushit icarushit icarusHitTPC0 icarusHitTPC1 icarusHitTPC2 icarusHitTPC3 sequence::icarus_reco_signalprocessingraw pmAlgKalmanTrackGaus pmAlgKalmanTrackICARUS pandoraKalmanTrackGaus pandoraKalmanTrackGausCryo0 pandoraKalmanTrackGausCryo1 pandoraKalmanTrackICARUS pandoraTrackICARUSCryo0 pandoraTrackICARUSCryo1 pandoraGausSCEPidCryo0 pandoraGausSCEPidCryo1 pandoraGausCaloCryo1 pandoraGausSCECaloCryo1 SBNShowerTestGausCryo0 SBNShowerTestGausCryo1 sequence::icarus_reco_pandoraICARUSCryo0 sequence::icarus_reco_pandoraICARUSCryo1 sequence::icarus_reco_SigProcTPC1Mixed sequence::icarus_reco_SigProcTPC3Mixed mcassociationsGausCryo1 mcassociationsICARUSCryo1 crthit
const Var kPrimaryMuonTrkP([](const caf::SRSliceProxy *slc){float recop(-5.f);bool contained(false);if(kPrimaryMuonTrkIdx(slc) >=0){auto const &ptrk=slc->reco.trk.at(kPrimaryMuonTrkIdx(slc));contained=((-199.15+10)< ptrk.end.x &&ptrk.end.x< (199.15-10)&&(-200.+10)< ptrk.end.y &&ptrk.end.y< (200.-10)&&(0.0+10)< ptrk.end.z &&ptrk.end.z< (500.-50));if(contained) recop=ptrk.rangeP.p_muon;else recop=ptrk.mcsP.fwdP_muon;}return recop;})
const Cut kCRTHitDistanceCut([](const caf::SRSliceProxy *slc){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRCRTHitMatchProxy &crthit=slc->reco.trk[ptrkid].crthit;if(std::isnan(crthit.hit.time)||std::isnan(crthit.distance)) return true;return crthit.distance > 5||(crthit.hit.time > 0.&&crthit.hit.time< 1.800);})
const Cut kSlcFlashMatchScoreCut([](const caf::SRSliceProxy *slc){return(slc->fmatch.score< 7);})
def InBeam
Definition: selection.py:4
const Cut kInFV([](const caf::SRSliceProxy *slc){return(slc->vertex.x >(-199.15+10)&&slc->vertex.x< (199.15-10)&&slc->vertex.y >(-200.+10)&&slc->vertex.y< (200.-10)&&slc->vertex.z >(0.0+10)&&slc->vertex.z< (500.-50));})