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