All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NumuCutsIcarus202106.cxx
Go to the documentation of this file.
1 #include <cmath>
4 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
5 
6 namespace ana
7 {
8  const Cut kIsNuSlice = ( kTruthIndex >= 0.f );
9 
10  const Cut kIsCosmic = ( !kIsNuSlice );
11 
12  const Cut kIsNuMuCC([](const caf::SRSliceProxy* slc) {
13  return ( kIsNuSlice(slc) && slc->truth.iscc && ( slc->truth.pdg == 14 || slc->truth.pdg == -14 ) );
14  });
15 
17 
18  const Cut kCryo0([](const caf::SRSliceProxy* slc) {
19  return ( !isnan(slc->vertex.x) && slc->vertex.x < 0 );
20  });
21 
22  const Cut kTFiducial([](const caf::SRSliceProxy* slc) {
23  return ( !isnan(slc->truth.position.x) &&
24  ( ( slc->truth.position.x < -71.1 - 25 && slc->truth.position.x > -369.33 + 25 ) ||
25  ( slc->truth.position.x > 71.1 + 25 && slc->truth.position.x < 369.33 - 25 ) ) &&
26  !isnan(slc->truth.position.y) &&
27  ( slc->truth.position.y > -181.7 + 25 && slc->truth.position.y < 134.8 - 25 ) &&
28  !isnan(slc->truth.position.z) &&
29  ( slc->truth.position.z > -895.95 + 30 && slc->truth.position.z < 895.95 - 50 ) );
30  });
31 
32  const Cut kRFiducial([](const caf::SRSliceProxy* slc) {
33  return ( !isnan(slc->vertex.x) &&
34  ( ( slc->vertex.x < -71.1 - 25 && slc->vertex.x > -369.33 + 25 ) ||
35  ( slc->vertex.x > 71.1 + 25 && slc->vertex.x < 369.33 - 25 ) ) &&
36  !isnan(slc->vertex.y) &&
37  ( slc->vertex.y > -181.7 + 25 && slc->vertex.y < 134.8 - 25 ) &&
38  !isnan(slc->vertex.z) &&
39  ( slc->vertex.z > -895.95 + 30 && slc->vertex.z < 895.95 - 50 ) );
40  });
41 
42  const Cut kNotClearCosmic([](const caf::SRSliceProxy* slc) {
43  return !slc->is_clear_cosmic;
44  });
45 
46  const Cut kNuScore([](const caf::SRSliceProxy* slc) {
47  return ( !isnan(slc->nu_score) && slc->nu_score > 0.4 );
48  });
49 
50  const Cut kFMScore([](const caf::SRSliceProxy* slc) {
51  return ( !isnan(slc->fmatch.score) && slc->fmatch.score < 7.0 );
52  });
53 
54  const Cut kPTrack([](const caf::SRSliceProxy* slc) {
55  return ( kPTrackInd(slc) >= 0 );
56  });
57 
58  const Cut kPTrackContained([](const caf::SRSliceProxy* slc) {
59  int Ind = kPTrackInd(slc);
60  bool Contained(false);
61  if ( Ind >= 0 )
62  {
63  auto const& trk = slc->reco.trk.at(Ind);
64  Contained = ( !isnan(trk.end.x) &&
65  ( trk.end.x < -71.1 - 25 && trk.end.x > -369.33 + 25 ) &&
66  !isnan(trk.end.y) &&
67  ( trk.end.y > -181.7 + 25 && trk.end.y < 134.8 - 25 ) &&
68  !isnan(trk.end.z) &&
69  ( trk.end.z > -895.95 + 30 && trk.end.z < 895.95 - 50 ) );
70  }
71  return Contained;
72  });
73 
74  const Cut kPTrackExiting([](const caf::SRSliceProxy* slc) {
75  int Ind = kPTrackInd(slc);
76  bool Exiting(false);
77  if ( Ind >= 0 )
78  {
79  auto const& trk = slc->reco.trk.at(Ind);
80  Exiting = !( !isnan(trk.end.x) &&
81  ( trk.end.x < -71.1 - 25 && trk.end.x > -369.33 + 25 ) &&
82  !isnan(trk.end.y) &&
83  ( trk.end.y > -181.7 + 25 && trk.end.y < 134.8 - 25 ) &&
84  !isnan(trk.end.z) &&
85  ( trk.end.z > -895.95 + 30 && trk.end.z < 895.95 - 50 ) );
86  }
87  return Exiting;
88  });
89 
90  // "Successive" cuts for the selection. These are meant to successively build upon
91  // each other, which fits the flow of the selection.
93 
95 
97 
99 
101 
103 
105 
107 
109 
111 
113 
115 
117 
119 
121 
123 
125 
127 
129 
131 
133 
134  // The full selection cut using only reco information.
136 
137  const SpillCut kLongTrack([](const caf::SRSpillProxy* sr){
138  bool ProgCut = false;
139  bool NuIsNuMuCC, IsMuon, Contained;
140  for (auto const& nu: sr->mc.nu)
141  {
142  NuIsNuMuCC = nu.iscc && ( nu.pdg == 14 || nu.pdg == -14 );
143  for (auto const& prim: nu.prim)
144  {
145  IsMuon = ( prim.pdg == 13 || prim.pdg == -13 );
146  Contained = ( prim.contained == 1 );
147  ProgCut = ProgCut || ( NuIsNuMuCC && IsMuon && ( (Contained && prim.length > 50.0) || (!Contained && prim.length > 100.0) ) );
148  }
149  }
150  return ProgCut;
151  });
152 }
const Cut kFMScore([](const caf::SRSliceProxy *slc){return(!isnan(slc->fmatch.score)&&slc->fmatch.score< 7.0);})
const Cut kIsNuMuCC([](const caf::SRSliceProxy *slc){return(kIsNuSlice(slc)&&slc->truth.iscc &&(slc->truth.pdg==14||slc->truth.pdg==-14));})
const Cut kNuOther_RFiducial
const Cut kIsNuSlice
const Cut kNuMuCC_FMScore
const Cut kPTrackContained([](const caf::SRSliceProxy *slc){int Ind=kPTrackInd(slc);bool Contained(false);if(Ind >=0){auto const &trk=slc->reco.trk.at(Ind);Contained=(!isnan(trk.end.x)&&(trk.end.x< -71.1-25 &&trk.end.x >-369.33+25)&&!isnan(trk.end.y)&&(trk.end.y >-181.7+25 &&trk.end.y< 134.8-25)&&!isnan(trk.end.z)&&(trk.end.z >-895.95+30 &&trk.end.z< 895.95-50));}return Contained;})
const Cut kCosmic_PTrack
const Cut kNuOther_Cryo0
const Cut kNuOther_ClearCos
const Cut kNuMuCC_FullSelection
const Cut kNuScore([](const caf::SRSliceProxy *slc){return(!isnan(slc->nu_score)&&slc->nu_score > 0.4);})
process_name opflashCryoW ana
const Cut kIsNuOther
const Cut kCosmic_FMScore
const Cut kTFiducial([](const caf::SRSliceProxy *slc){return(!isnan(slc->truth.position.x)&&((slc->truth.position.x< -71.1-25 &&slc->truth.position.x >-369.33+25)||(slc->truth.position.x > 71.1+25 &&slc->truth.position.x< 369.33-25))&&!isnan(slc->truth.position.y)&&(slc->truth.position.y >-181.7+25 &&slc->truth.position.y< 134.8-25)&&!isnan(slc->truth.position.z)&&(slc->truth.position.z >-895.95+30 &&slc->truth.position.z< 895.95-50));})
const Cut kCosmic_RFiducial
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
const Cut kNuMuCC_PTrack
const Var kTruthIndex
const SpillCut kLongTrack([](const caf::SRSpillProxy *sr){bool ProgCut=false;bool NuIsNuMuCC, IsMuon, Contained;for(auto const &nu:sr->mc.nu){NuIsNuMuCC=nu.iscc &&(nu.pdg==14||nu.pdg==-14);for(auto const &prim:nu.prim){IsMuon=(prim.pdg==13||prim.pdg==-13);Contained=(prim.contained==1);ProgCut=ProgCut||(NuIsNuMuCC &&IsMuon &&((Contained &&prim.length > 50.0)||(!Contained &&prim.length > 100.0)));}}return ProgCut;})
_Cut< caf::SRSliceProxy > Cut
Definition: Cut.h:95
const Cut kNuOther_PTrack
for($it=0;$it< $RaceTrack_number;$it++)
const Cut kIsCosmic
caf::Proxy< caf::StandardRecord > SRSpillProxy
Definition: EpilogFwd.h:3
const Cut kNuOther_NuScore
const Cut kCosmic_NuScore
const Cut kNuOther_TFiducial
const Cut kCosmic_TFiducial
const Cut kCryo0([](const caf::SRSliceProxy *slc){return(!isnan(slc->vertex.x)&&slc->vertex.x< 0);})
const Cut kNotClearCosmic([](const caf::SRSliceProxy *slc){return!slc->is_clear_cosmic;})
const Cut kNuMuCC_RFiducial
const Cut kCosmic_Cryo0
const Cut kNuMuCC_Cryo0
const Cut kNuMuCC_ClearCos
const Cut kRFiducial([](const caf::SRSliceProxy *slc){return(!isnan(slc->vertex.x)&&((slc->vertex.x< -71.1-25 &&slc->vertex.x >-369.33+25)||(slc->vertex.x > 71.1+25 &&slc->vertex.x< 369.33-25))&&!isnan(slc->vertex.y)&&(slc->vertex.y >-181.7+25 &&slc->vertex.y< 134.8-25)&&!isnan(slc->vertex.z)&&(slc->vertex.z >-895.95+30 &&slc->vertex.z< 895.95-50));})
Template for Cut and SpillCut.
Definition: Cut.h:16
const Cut kPTrack([](const caf::SRSliceProxy *slc){return(kPTrackInd(slc) >=0);})
const Cut kPTrackExiting([](const caf::SRSliceProxy *slc){int Ind=kPTrackInd(slc);bool Exiting(false);if(Ind >=0){auto const &trk=slc->reco.trk.at(Ind);Exiting=!(!isnan(trk.end.x)&&(trk.end.x< -71.1-25 &&trk.end.x >-369.33+25)&&!isnan(trk.end.y)&&(trk.end.y >-181.7+25 &&trk.end.y< 134.8-25)&&!isnan(trk.end.z)&&(trk.end.z >-895.95+30 &&trk.end.z< 895.95-50));}return Exiting;})
const Cut kCosmic_ClearCos
BEGIN_PROLOG SN nu
const Cut kNuMuCC_NuScore
const Cut kNuOther_FMScore
const Cut kNuMuCC_TFiducial
const Var kPTrackInd([](const caf::SRSliceProxy *slc) -> int{float Longest(0);int PTrackInd(-1);for(std::size_t i(0);i< slc->reco.trk.size();++i){auto const &trk=slc->reco.trk.at(i);if(trk.bestplane==-1) continue;const float Atslc=std::hypot(slc->vertex.x-trk.start.x, slc->vertex.y-trk.start.y, slc->vertex.z-trk.start.z);const bool AtSlice=(Atslc< 10.0 &&trk.pfp.parent_is_primary);const float Chi2Proton=trk.chi2pid[trk.bestplane].chi2_proton;const float Chi2Muon=trk.chi2pid[trk.bestplane].chi2_muon;const bool Contained=(!isnan(trk.end.x)&&(trk.end.x< -71.1-25 &&trk.end.x >-369.33+25)&&!isnan(trk.end.y)&&(trk.end.y >-181.7+25 &&trk.end.y< 134.8-25)&&!isnan(trk.end.z)&&(trk.end.z >-895.95+30 &&trk.end.z< 895.95-50));const bool MaybeMuonExiting=(!Contained &&trk.len > 100);const bool MaybeMuonContained=(Contained &&Chi2Proton > 60 &&Chi2Muon< 30 &&trk.len > 50);{Longest=trk.len;PTrackInd=i;}}return PTrackInd;})