LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
VertexWrapper.h
Go to the documentation of this file.
1 #ifndef VERTEXWRAPPER_H
2 #define VERTEXWRAPPER_H
3 
4 #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:
31 
33  VertexWrapper(const recob::Vertex& vtx) : vtx_(vtx) {}
34  VertexWrapper(const recob::tracking::Point_t& pos, const recob::tracking::SMatrixSym33& cov, double chi2, int ndof) { vtx_ = recob::Vertex(pos,cov,chi2,ndof); }
35  //
36  const recob::Vertex& vertex() const { return vtx_; }
37  bool isValid() const {return vtx_.isValid();}
38  const recob::tracking::Point_t& position() const { return vtx_.position(); }
40  //
41  void setVertexId(int newID) { vtx_.setID(newID); }
42  //
43  void addTrack(const recob::Track& tk) { vtxtks_.push_back(tk); }
45  double chi2, int ndof, const recob::Track& tk) {
46  vtx_ = recob::Vertex(pos, cov, vtx_.chi2()+chi2, vtx_.ndof()+ndof);
47  addTrack(tk);
48  }
49  //
50  size_t findTrack(const recob::Track& tk) const {
51  for (size_t it = 0; it!=vtxtks_.size(); ++it) {
52  if (&tk==&vtxtks_[it].get()) return it;
53  }
54  return vtxtks_.size();
55  }
56  //
57  size_t tracksSize() const { return vtxtks_.size(); }
58  const TrackRefVec& tracks() const { return vtxtks_; }
59  TrackRefVec tracksWithoutElement(size_t element) const {
60  TrackRefVec tks = vtxtks_;
61  tks.erase(tks.begin()+element);
62  return tks;
63  }
64 
65  private:
67  TrackRefVec vtxtks_;
68  };
69 }
70 
71 #endif
const recob::tracking::Point_t & position() const
Definition: VertexWrapper.h:38
TrackRefVec tracksWithoutElement(size_t element) const
Definition: VertexWrapper.h:59
const recob::tracking::SMatrixSym33 & covariance() const
Definition: VertexWrapper.h:39
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
bool isValid() const
Definition: VertexWrapper.h:37
Wrapper class to facilitate vertex production.
Definition: VertexWrapper.h:28
VertexWrapper(const recob::Vertex &vtx)
Definition: VertexWrapper.h:33
void addTrack(const recob::Track &tk)
Definition: VertexWrapper.h:43
void addTrackAndUpdateVertex(const recob::tracking::Point_t &pos, const recob::tracking::SMatrixSym33 &cov, double chi2, int ndof, const recob::Track &tk)
Definition: VertexWrapper.h:44
TrackRefVec vtxtks_
Definition: VertexWrapper.h:67
void setID(int newID)
Set vertex id.
Definition: Vertex.h:82
recob::Vertex vtx_
Definition: VertexWrapper.h:66
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
double chi2() const
Definition: Vertex.h:64
size_t tracksSize() const
Definition: VertexWrapper.h:57
const TrackRefVec & tracks() const
Definition: VertexWrapper.h:58
bool isValid() const
Definition: Vertex.h:72
Provides recob::Track data product.
const SMatrixSym33 & covariance() const
Return vertex 3D covariance (be careful, the matrix may have rank=2).
Definition: Vertex.h:62
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > SMatrixSym33
Definition: TrackingTypes.h:56
void setVertexId(int newID)
Definition: VertexWrapper.h:41
VertexWrapper(const recob::tracking::Point_t &pos, const recob::tracking::SMatrixSym33 &cov, double chi2, int ndof)
Definition: VertexWrapper.h:34
double ndof() const
Definition: Vertex.h:66
size_t findTrack(const recob::Track &tk) const
Definition: VertexWrapper.h:50
const Point_t & position() const
Return vertex 3D position.
Definition: Vertex.h:60
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:51
const recob::Vertex & vertex() const
Definition: VertexWrapper.h:36
std::vector< std::reference_wrapper< const recob::Track > > TrackRefVec
Definition: VertexWrapper.h:26