LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
VertexWrapper.h
Go to the documentation of this file.
1 #ifndef VERTEXWRAPPER_H
2 #define VERTEXWRAPPER_H
3 
6 #include <functional>
7 
8 namespace trkf {
9  //
25  // use reference_wrapper instead of pointers: we do not want ownership of the tracks
26  typedef std::vector<std::reference_wrapper<const recob::Track>> TrackRefVec;
27 
28  class VertexWrapper {
29 
30  public:
32  VertexWrapper(const recob::Vertex& vtx) : vtx_(vtx) {}
35  double chi2,
36  int ndof)
37  {
38  vtx_ = recob::Vertex(pos, cov, chi2, ndof);
39  }
40  //
41  const recob::Vertex& vertex() const { return vtx_; }
42  bool isValid() const { return vtx_.isValid(); }
43  const recob::tracking::Point_t& position() const { return vtx_.position(); }
45  //
46  void setVertexId(int newID) { vtx_.setID(newID); }
47  //
48  void addTrack(const recob::Track& tk) { vtxtks_.push_back(tk); }
51  double chi2,
52  int ndof,
53  const recob::Track& tk)
54  {
55  vtx_ = recob::Vertex(pos, cov, vtx_.chi2() + chi2, vtx_.ndof() + ndof);
56  addTrack(tk);
57  }
58  //
59  size_t findTrack(const recob::Track& tk) const
60  {
61  for (size_t it = 0; it != vtxtks_.size(); ++it) {
62  if (&tk == &vtxtks_[it].get()) return it;
63  }
64  return vtxtks_.size();
65  }
66  //
67  size_t tracksSize() const { return vtxtks_.size(); }
68  const TrackRefVec& tracks() const { return vtxtks_; }
69  TrackRefVec tracksWithoutElement(size_t element) const
70  {
71  TrackRefVec tks = vtxtks_;
72  tks.erase(tks.begin() + element);
73  return tks;
74  }
75 
76  private:
78  TrackRefVec vtxtks_;
79  };
80 }
81 
82 #endif
const recob::tracking::Point_t & position() const
Definition: VertexWrapper.h:43
TrackRefVec tracksWithoutElement(size_t element) const
Definition: VertexWrapper.h:69
const recob::tracking::SMatrixSym33 & covariance() const
Definition: VertexWrapper.h:44
bool isValid() const
Definition: VertexWrapper.h:42
Wrapper class to facilitate vertex production.
Definition: VertexWrapper.h:28
VertexWrapper(const recob::Vertex &vtx)
Definition: VertexWrapper.h:32
void addTrack(const recob::Track &tk)
Definition: VertexWrapper.h:48
void addTrackAndUpdateVertex(const recob::tracking::Point_t &pos, const recob::tracking::SMatrixSym33 &cov, double chi2, int ndof, const recob::Track &tk)
Definition: VertexWrapper.h:49
TrackRefVec vtxtks_
Definition: VertexWrapper.h:78
void setID(int newID)
Set vertex id.
Definition: Vertex.h:86
recob::Vertex vtx_
Definition: VertexWrapper.h:77
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
double chi2() const
Definition: Vertex.h:68
size_t tracksSize() const
Definition: VertexWrapper.h:67
const TrackRefVec & tracks() const
Definition: VertexWrapper.h:68
ROOT::Math::SMatrix< Double32_t, 3, 3, ROOT::Math::MatRepSym< Double32_t, 3 >> SMatrixSym33
Provides recob::Track data product.
bool isValid() const
Definition: Vertex.h:76
const SMatrixSym33 & covariance() const
Return vertex 3D covariance (be careful, the matrix may have rank=2).
Definition: Vertex.h:66
void setVertexId(int newID)
Definition: VertexWrapper.h:46
int ndof() const
Definition: Vertex.h:70
VertexWrapper(const recob::tracking::Point_t &pos, const recob::tracking::SMatrixSym33 &cov, double chi2, int ndof)
Definition: VertexWrapper.h:33
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
size_t findTrack(const recob::Track &tk) const
Definition: VertexWrapper.h:59
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more detai...
Definition: TrackingTypes.h:27
const Point_t & position() const
Return vertex 3D position.
Definition: Vertex.h:64
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
const recob::Vertex & vertex() const
Definition: VertexWrapper.h:41
std::vector< std::reference_wrapper< const recob::Track > > TrackRefVec
Definition: VertexWrapper.h:26