All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
21 #include <utility>
22 #include <vector>
23 
25 public:
26  static constexpr double kMaxDistToTrack{4.0}; // max. dist. track to center to create vtx
27  static constexpr double kMinDistToNode{2.0}; // min. dist. to node needed to split segment
28 
29  VtxCandidate(double segMinLength = 0.5)
31  , fSegMinLength(segMinLength)
32  , fMse(0.0)
33  , fMse2D(0.0)
34  , fCenter(0., 0., 0.)
35  , fErr(0., 0., 0.)
36  {}
37 
38  bool Has(pma::Track3D* trk) const;
39 
40  bool Has(const VtxCandidate& other) const;
41 
42  bool IsAttached(pma::Track3D* trk) const;
43 
44  bool IsAttached(const VtxCandidate& other) const;
45 
46  bool HasLoops() const;
47 
48  bool Add(const pma::TrkCandidate& trk);
49 
50  double ComputeMse2D();
51 
52  double Test(const VtxCandidate& other) const;
53 
54  double MaxAngle(double minLength = 0.0) const;
55 
56  size_t
57  Size() const
58  {
59  return fAssigned.size();
60  }
61  size_t Size(double minLength) const;
62 
63  bool MergeWith(const VtxCandidate& other);
64 
65  double Compute();
66 
70 
71  const TVector3&
72  Center() const
73  {
74  return fCenter;
75  }
76  double
77  Mse() const
78  {
79  return fMse;
80  }
81  double
82  Mse2D() const
83  {
84  return fMse2D;
85  }
86 
87  std::pair<pma::Track3D*, size_t>
88  Track(size_t i) const
89  {
90  return std::pair<pma::Track3D*, size_t>(fAssigned[i].first.Track(), fAssigned[i].second);
91  }
92 
93 private:
94  bool
95  has(const std::vector<int>& v, int id) const
96  {
97  for (auto c : v)
98  if (c == id) return true;
99  return false;
100  }
101 
104  std::vector<std::pair<pma::TrkCandidate, size_t>> fAssigned;
105  TVector3 fCenter, fErr;
106 };
107 
108 #endif
bool Has(pma::Track3D *trk) const
ClusterModuleLabel join with tracks
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)
bool Add(const pma::TrkCandidate &trk)
bool IsAttached(pma::Track3D *trk) const
bool HasLoops() const
auto const detProp
bool has(const std::vector< int > &v, int id) const