LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PmaTrkCandidate.h
Go to the documentation of this file.
1 
12 #ifndef TrkCandidate_h
13 #define TrkCandidate_h
14 
16 
17 namespace pma
18 {
19  // these types to be replaced with use of feature proposed in redmine #12602
20  typedef std::map< unsigned int, std::vector< art::Ptr<recob::Hit> > > view_hitmap;
21  typedef std::map< unsigned int, view_hitmap > tpc_view_hitmap;
22  typedef std::map< unsigned int, tpc_view_hitmap > cryo_tpc_view_hitmap;
23 
24  class TrkCandidate;
25  class TrkCandidateColl;
26 }
27 
29 {
30 public:
31  TrkCandidate(void);
32  TrkCandidate(pma::Track3D* trk, int key = -1, int tid = -1);
33 
34  bool IsValid(void) const { return fTrack; }
35 
36  bool IsGood(void) const { return fGood; }
37  void SetGood(bool b) { fGood = b; }
38 
39  pma::Track3D* Track(void) const { return fTrack; }
40  void SetTrack(pma::Track3D* trk);
41  void DeleteTrack(void);
42 
43  const std::vector< size_t > & Clusters(void) const { return fClusters; }
44  std::vector< size_t > & Clusters(void) { return fClusters; }
45 
47  int Key(void) const { return fKey; }
48 
50  void SetKey(int key) { fKey = key; }
51 
52  int TreeId(void) const { return fTreeId; }
53  void SetTreeId(int id) { fTreeId = id; }
54 
55  double Mse(void) const { return fMse; }
56  void SetMse(double m) { fMse = m; }
57 
58  double Validation(void) const { return fValidation; }
59  void SetValidation(double v) { fValidation = v; }
60 
61  int Parent(void) const { return fParent; }
62  void SetParent(int idx) { fParent = idx; }
63 
64  const std::vector< size_t > & Daughters(void) const { return fDaughters; }
65  std::vector< size_t > & Daughters(void) { return fDaughters; }
66 
67 private:
68  int fParent;
69  std::vector< size_t > fDaughters;
70 
72  std::vector< size_t > fClusters;
73  int fKey, fTreeId;
74 
75  double fMse, fValidation;
76 
77  bool fGood;
78 };
79 
81 {
82 public:
83  size_t size(void) const { return fCandidates.size(); }
84  void resize(size_t n) { return fCandidates.resize(n); }
85  bool empty(void) const { return fCandidates.empty(); }
86 
87  void push_back(const TrkCandidate & trk) { fCandidates.push_back(trk); }
88  void erase_at(size_t pos) { fCandidates.erase(fCandidates.begin() + pos); }
89  void clear(void) { fCandidates.clear(); }
90 
91  TrkCandidate & operator[] (size_t i) { return fCandidates[i]; }
92  TrkCandidate const & operator[] (size_t i) const { return fCandidates[i]; }
93 
94  TrkCandidate & front(void) { return fCandidates.front(); }
95  TrkCandidate const & front(void) const { return fCandidates.front(); }
96 
97  TrkCandidate & back(void) { return fCandidates.back(); }
98  TrkCandidate const & back(void) const { return fCandidates.back(); }
99 
100  std::vector< TrkCandidate > const & tracks(void) const { return fCandidates; }
101  std::vector< TrkCandidate > & tracks(void) { return fCandidates; }
102 
103  std::vector< TrkCandidate > const & parents(void) const { return fParents; }
104 
105  int getCandidateIndex(pma::Track3D const * candidate) const;
106  int getCandidateTreeId(pma::Track3D const * candidate) const;
107 
108  void merge(size_t idx1, size_t idx2);
109 
110  void setParentDaughterConnections(void);
111 
112  void setTreeId(int id, size_t trkIdx, bool isRoot = true);
113  int setTreeIds(void);
114 
115  void flipTreesToCoordinate(size_t coordinate);
116  void flipTreesByDQdx();
117 
118  bool setTreeOriginAtFront(pma::Track3D* trk);
119  bool setTreeOriginAtBack(pma::Track3D* trk);
120 
121  pma::Track3D* getTreeCopy(pma::TrkCandidateColl & dst, size_t trkIdx, bool isRoot = true);
122 
123 private:
124  std::vector< TrkCandidate > fCandidates;
125  std::vector< TrkCandidate > fParents;
126 };
127 
128 #endif
129 
std::vector< TrkCandidate > & tracks(void)
void resize(size_t n)
const std::vector< size_t > & Clusters(void) const
std::vector< size_t > & Clusters(void)
std::vector< size_t > fDaughters
int TreeId(void) const
double Mse(void) const
TrkCandidate & back(void)
Implementation of the Projection Matching Algorithm.
int Parent(void) const
void SetKey(int key)
Set key of an external object associated to this track candidate.
TrkCandidate & front(void)
int Key(void) const
Get key of an external object (like a source PFParticle) associated to this track candidate...
std::vector< size_t > fClusters
TrkCandidate const & back(void) const
void erase_at(size_t pos)
bool IsGood(void) const
TrkCandidate const & front(void) const
void SetGood(bool b)
std::vector< TrkCandidate > const & tracks(void) const
void SetValidation(double v)
void SetTrack(pma::Track3D *trk)
bool IsValid(void) const
size_t size(void) const
std::vector< TrkCandidate > fParents
std::vector< TrkCandidate > const & parents(void) const
void SetTreeId(int id)
void SetMse(double m)
std::vector< size_t > & Daughters(void)
double Validation(void) const
void SetParent(int idx)
std::vector< TrkCandidate > fCandidates
pma::Track3D * fTrack
const std::vector< size_t > & Daughters(void) const
bool empty(void) const
std::map< unsigned int, view_hitmap > tpc_view_hitmap
Char_t n[5]
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > view_hitmap
std::map< unsigned int, tpc_view_hitmap > cryo_tpc_view_hitmap
void push_back(const TrkCandidate &trk)
pma::Track3D * Track(void) const