All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NumuVars.cxx
Go to the documentation of this file.
3 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
4 #include <cassert>
5 
6 namespace ana
7 {
8 
9 
10  const Var kPrimMuonIdx([](const caf::SRSliceProxy *slc) -> double
11  { //Find the most muon-like track
12  if( (int)slc->reco.ntrk == 0 ) return -5.0;
13 
14  double best_idx = 0;
15  //double best_score = -5.0;
16  double best_len = -5.0;
17  for( unsigned int trkIdx = 0; trkIdx < slc->reco.ntrk; trkIdx++ ){
18  auto &trk = slc->reco.trk[trkIdx];
19  if(trk.chi2pid[2].pid_ndof < 0 ) return -5.0;
20 
21  //Find longest trk w/Chi2 for muon < Chi2 for pion
22  bool isMuonLike = trk.chi2pid[2].chi2_pion > trk.chi2pid[2].chi2_muon;
23  if( isMuonLike && trk.len > best_len ){ //Chi2 muon < Chi2 pion
24  // best_score = score;
25  best_len = trk.len;
26  best_idx = trkIdx;
27  }
28  } // end loop over trks
29 
30  return best_idx;
31  });
32 
33 
34  const Var kPrimTrkLen(
35  [](const caf::SRSliceProxy *slc) -> double
36  {
37  double len = -5.0;
38  if ( slc->reco.ntrk > 0 ){
39  int muIdx = (int)kPrimMuonIdx(slc);
40  if (muIdx >= 0) {
41  len = slc->reco.trk[muIdx].len;
42  }
43  }
44  return len;
45  });
46 
47 }
const Var kPrimMuonIdx([](const caf::SRSliceProxy *slc) -> double{if((int) slc->reco.ntrk==0) return-5.0;double best_idx=0;double best_len=-5.0;for(unsigned int trkIdx=0;trkIdx< slc->reco.ntrk;trkIdx++){auto &trk=slc->reco.trk[trkIdx];if(trk.chi2pid[2].pid_ndof< 0) return-5.0;bool isMuonLike=trk.chi2pid[2].chi2_pion > trk.chi2pid[2].chi2_muon;if(isMuonLike &&trk.len > best_len){best_len=trk.len;best_idx=trkIdx;}}return best_idx;})
Definition: NumuVars.h:11
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
process_name standard_reco_uboone reco
const Var kPrimTrkLen([](const caf::SRSliceProxy *slc) -> double{double len=-5.0;if(slc->reco.ntrk > 0){int muIdx=(int) kPrimMuonIdx(slc);if(muIdx >=0){len=slc->reco.trk[muIdx].len;}}return len;})
Definition: NumuVars.h:9