All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PrimaryTrack.cc
Go to the documentation of this file.
1 #include "PrimaryTrack.h"
2 
3 int numu::SelectLongestTrack(const std::map<size_t, numu::RecoTrack> &tracks, const numu::RecoSlice &slice) {
4  if (slice.primary_index < 0) return -1;
5 
6  const numu::RecoParticle &neutrino = slice.particles.at(slice.primary_index);
7  double max_len = -1.;
8  int ret = -1;
9  for (size_t pfp_index: neutrino.daughters) {
10  const numu::RecoParticle &daughter = slice.particles.at(pfp_index);
11  if (tracks.count(daughter.ID)) {
12  if (ret < 0 || tracks.at(daughter.ID).length > max_len) {
13  max_len = tracks.at(daughter.ID).length;
14  ret = daughter.ID;
15  }
16  }
17  }
18 
19  return ret;
20 }
21 
22 int numu::SelectLongestIDdMuon(const std::map<size_t, numu::RecoTrack> &tracks, const numu::RecoSlice &slice) {
23  if (slice.primary_index < 0) return -1;
24 
25  const numu::RecoParticle &neutrino = slice.particles.at(slice.primary_index);
26  double max_len = -1.;
27  int ret = -1;
28  for (size_t pfp_index: neutrino.daughters) {
29  const numu::RecoParticle &daughter = slice.particles.at(pfp_index);
30  if (tracks.count(daughter.ID)) {
31  const numu::RecoTrack &track = tracks.at(daughter.ID);
32  // muon ID: exiting or chi2 hypothesis smaller than proton
33  if (!track.is_contained || track.chi2_muon < track.chi2_proton) {
34  if (ret < 0 || track.length > max_len) {
35  max_len = track.length;
36  ret = daughter.ID;
37  }
38  }
39  }
40  }
41 
42  return ret;
43 }
44 
bool is_contained
is it contained in the &quot;containment volume&quot;?
Definition: RecoTrack.h:52
float chi2_muon
Chi2 of dE/dx to muon hypotheis. Combined agaisnt all planes.
Definition: RecoTrack.h:43
ClusterModuleLabel join with tracks
process_name use argoneut_mc_hitfinder track
size_t ID
ID of particle.
Definition: RecoParticle.h:18
std::vector< size_t > daughters
Daughters of the particle in the &quot;particle flow&quot;. Value represents index into pandora information...
Definition: RecoParticle.h:17
float length
Length of track.
Definition: RecoTrack.h:48
int SelectLongestIDdMuon(const std::map< size_t, RecoTrack > &tracks, const RecoSlice &slice)
Definition: PrimaryTrack.cc:22
int SelectLongestTrack(const std::map< size_t, RecoTrack > &tracks, const RecoSlice &slice)
Definition: PrimaryTrack.cc:3
std::map< size_t, RecoParticle > particles
Map of particle index to particle information.
Definition: RecoEvent.h:28
int primary_index
Index of the primary particle of this slice.
Definition: RecoEvent.h:25
float chi2_proton
Chi2 of dE/dx to proton hypothesis. Combined against all planes.
Definition: RecoTrack.h:40