All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NumuVarsIcarus202208.cxx
Go to the documentation of this file.
3 
4 #include "sbnanaobj/StandardRecord/Proxy/FwdDeclare.h"
5 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
6 
7 namespace ana {
8 
9 // More general vars, i.e., not just numu vars.
10 // Probably should be moved to another file at some point.
11 const Var kCRLongestTrackDirY = SIMPLEVAR(nuid.crlongtrkdiry);
14 
15 // Mostly just copied from NumuVarsIcarus202106.cxx
16 const Var kIcarus202208MuonIdx([](const caf::SRSliceProxy* slc) -> int {
17  // The (dis)qualification of a slice is based upon the track level information.
18  float Longest(0);
19  int PTrackInd(-1);
20  for (std::size_t i(0); i < slc->reco.trk.size(); ++i) {
21  auto const& trk = slc->reco.trk.at(i);
22  if(trk.bestplane == -1) continue;
23  const float Atslc = std::hypot(slc->vertex.x - trk.start.x,
24  slc->vertex.y - trk.start.y,
25  slc->vertex.z - trk.start.z);
26  const bool AtSlice = ( Atslc < 10.0 && trk.pfp.parent_is_primary);
27 
28  const float Chi2Proton = trk.chi2pid[trk.bestplane].chi2_proton;
29  const float Chi2Muon = trk.chi2pid[trk.bestplane].chi2_muon;
30 
31  const bool Contained = ( !isnan(trk.end.x) &&
32  (( trk.end.x < -71.1 - 5 && trk.end.x > -369.33 + 5 ) ||
33  ( trk.end.x < 71.1 + 5 && trk.end.x > +369.33 - 5 )) &&
34  !isnan(trk.end.y) &&
35  ( trk.end.y > -181.7 + 5 && trk.end.y < 134.8 - 5 ) &&
36  !isnan(trk.end.z) &&
37  ( trk.end.z > -895.95 + 5 && trk.end.z < 895.95 - 5 ) );
38  const bool MaybeMuonExiting = ( !Contained && trk.len > 100);
39  const bool MaybeMuonContained = ( Contained && Chi2Proton > 60 && Chi2Muon < 30 && trk.len > 50 );
40  if ( AtSlice && ( MaybeMuonExiting || MaybeMuonContained ) && trk.len > Longest ) {
41  Longest = trk.len;
42  PTrackInd = i;
43  }
44  }
45  return PTrackInd;
46 });
47 
48 static bool Icarus202208_proton_cut(const caf::SRTrackProxy& trk)
49 {
50  return trk.chi2pid[trk.bestplane].chi2_proton < 100;
51 }
52 
53 const Var kIcarus202208NumPions([](const caf::SRSliceProxy* slc)
54 {
55  int count = 0;
56  auto idx = kIcarus202208MuonIdx(slc);
57  int muID = -1;
58  if (idx >= 0) muID = slc->reco.trk.at(idx).pfp.id;
59  for(auto& trk: slc->reco.trk) {
60  if(trk.pfp.id != muID && !Icarus202208_proton_cut(trk) && trk.pfp.parent_is_primary)
61  ++count;
62  }
63  return count;
64 });
65 }
const Var kFMTimeVar
const Var kIcarus202208NumPions([](const caf::SRSliceProxy *slc){int count=0;auto idx=kIcarus202208MuonIdx(slc);int muID=-1;if(idx >=0) muID=slc->reco.trk.at(idx).pfp.id;for(auto &trk:slc->reco.trk){++count;}return count;})
process_name opflashCryoW ana
caf::Proxy< caf::SRSlice > SRSliceProxy
Definition: EpilogFwd.h:2
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:73
static bool Icarus202208_proton_cut(const caf::SRTrackProxy &trk)
const Var kCRLongestTrackDirY
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch fmatch
Definition: reco_sbnd.fcl:182
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
Definition: Var.h:82
const Var kFMScoreVar
std::size_t count(Cont const &cont)
const Var kIcarus202208MuonIdx([](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-5 &&trk.end.x >-369.33+5)||(trk.end.x< 71.1+5 &&trk.end.x >+369.33-5))&&!isnan(trk.end.y)&&(trk.end.y >-181.7+5 &&trk.end.y< 134.8-5)&&!isnan(trk.end.z)&&(trk.end.z >-895.95+5 &&trk.end.z< 895.95-5));const bool MaybeMuonExiting=(!Contained &&trk.len > 100);const bool MaybeMuonContained=(Contained &&Chi2Proton > 60 &&Chi2Muon< 30 &&trk.len > 50);if(AtSlice &&(MaybeMuonExiting||MaybeMuonContained)&&trk.len > Longest){Longest=trk.len;PTrackInd=i;}}return PTrackInd;})