PmaVtxCandidate.h
Go to the documentation of this file.
1 /**
2  * @file PmaVtxCandidate.h
3  *
4  * @author D.Stefan and R.Sulej
5  *
6  * @brief Vertex finding helper for the Projection Matching Algorithm
7  *
8  * Candidate for 3D vertex. Used to test intersections and join tracks in vertices.
9  * See PmaTrack3D.h file for details.
10  */
11 
12 #ifndef VtxCandidate_h
13 #define VtxCandidate_h
14 
16 
17 namespace pma {
18  class VtxCandidate;
19 }
20 
22 public:
23  static constexpr double kMaxDistToTrack{4.0}; // max. dist. track to center to create vtx
24  static constexpr double kMinDistToNode{2.0}; // min. dist. to node needed to split segment
25 
26  VtxCandidate(double segMinLength = 0.5)
27  : tracksJoined(false)
28  , fSegMinLength(segMinLength)
29  , fMse(0.0)
30  , fMse2D(0.0)
31  , fCenter(0., 0., 0.)
32  , fErr(0., 0., 0.)
33  {}
34 
35  bool Has(pma::Track3D* trk) const;
36 
37  bool Has(const VtxCandidate& other) const;
38 
39  bool IsAttached(pma::Track3D* trk) const;
40 
41  bool IsAttached(const VtxCandidate& other) const;
42 
43  bool HasLoops() const;
44 
45  bool Add(const pma::TrkCandidate& trk);
46 
47  double ComputeMse2D();
48 
49  double Test(const VtxCandidate& other) const;
50 
51  double MaxAngle(double minLength = 0.0) const;
52 
53  size_t
54  Size() const
55  {
56  return fAssigned.size();
57  }
58  size_t Size(double minLength) const;
59 
60  bool MergeWith(const VtxCandidate& other);
61 
62  double Compute();
63 
64  bool JoinTracks(detinfo::DetectorPropertiesData const& detProp,
67 
68  const TVector3&
69  Center() const
70  {
71  return fCenter;
72  }
73  double
74  Mse() const
75  {
76  return fMse;
77  }
78  double
79  Mse2D() const
80  {
81  return fMse2D;
82  }
83 
84  std::pair<pma::Track3D*, size_t>
85  Track(size_t i) const
86  {
87  return std::pair<pma::Track3D*, size_t>(fAssigned[i].first.Track(), fAssigned[i].second);
88  }
89 
90 private:
91  bool
92  has(const std::vector<int>& v, int id) const
93  {
94  for (auto c : v)
95  if (c == id) return true;
96  return false;
97  }
98 
101  std::vector<std::pair<pma::TrkCandidate, size_t>> fAssigned;
102  TVector3 fCenter, fErr;
103 };
104 
105 #endif
bool Has(pma::Track3D *trk) const
std::pair< pma::Track3D *, size_t > Track(size_t i) const
double Test(const VtxCandidate &other) const
bool JoinTracks(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks, pma::TrkCandidateColl &src)
std::vector< std::pair< pma::TrkCandidate, size_t > > fAssigned
double Mse() const
double Mse2D() const
size_t Size() const
const TVector3 & Center() const
static constexpr double kMinDistToNode
VtxCandidate(double segMinLength=0.5)
static constexpr double kMaxDistToTrack
double MaxAngle(double minLength=0.0) const
Track finding helper for the Projection Matching Algorithm.
bool MergeWith(const VtxCandidate &other)
Definition: tracks.py:1
bool Add(const pma::TrkCandidate &trk)
bool IsAttached(pma::Track3D *trk) const
bool HasLoops() const
bool has(const std::vector< int > &v, int id) const