CMS 3D CMS Logo

Vertexing.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_interface_Vertexing_h
2 #define DataFormats_PatCandidates_interface_Vertexing_h
3 
10 
24 namespace pat {
26  public:
35  // --- Methods to mimick VertexRef
37  bool isNull() const { return vertex_.isNull(); }
39  bool isNonnull() const { return vertex_.isNonnull(); }
41  bool isAvailable() const { return vertex_.isAvailable(); }
43  const reco::Vertex &operator*() const { return *operator->(); }
45  const reco::Vertex *operator->() const { return vertex_.isNull() ? nullptr : vertex_.get(); }
46  // --- Methods to get the Vertex and track
48  const reco::VertexRef &vertexRef() const { return vertex_; }
50  const reco::Vertex *vertex() const { return vertex_.isNull() ? nullptr : vertex_.get(); }
52  bool hasTrack() const { return !track_.isNull(); }
54  const reco::TrackBaseRef &trackRef() const { return track_; }
56  const reco::Track *track() const { return hasTrack() ? track_.get() : nullptr; }
57  // --- Methods to return distances
60  const Measurement1DFloat &dz() const { return dz_; }
62  const Measurement1DFloat &dr() const { return dr_; }
64  bool hasTransverseIP() const { return (dr_.value() != 0); }
66  bool hasErrors() const { return (dz_.error() != 0) && (!hasTransverseIP() || dr_.error() != 0); }
67  // ---- Methods to set distances
68  void setDz(const Measurement1DFloat &dz) { dz_ = dz; }
69  void setDr(const Measurement1DFloat &dr) { dr_ = dr; }
73  void setDistances(const AlgebraicVector3 &dist, const AlgebraicSymMatrix33 &err);
77  template <typename T1, typename T2>
78  void setDistances(const T1 &p1, const T2 &p2, const AlgebraicSymMatrix33 &err) {
79  AlgebraicVector3 dist(p1.x() - p2.x(), p1.y() - p2.y(), p1.z() - p2.z());
80  setDistances(dist, err);
81  }
82  // ---- 3D significance of the impact parameter
83  // float signif3d() const { return signif3d_; }
84  // bool hasSignif3d() const { return signif3d_ != 0; }
85  // void setSignif3d(float signif3d) { signif3d_ = signif3d; }
86  private:
87  // basic information
90  // float signif3d_;
91  // extended info
93  // fixme: add refitted momentum
94  };
95 } // namespace pat
96 
97 #endif
void setDistances(const AlgebraicVector3 &dist, const AlgebraicSymMatrix33 &err)
Set dz and dr given the distance and the 3x3 total covariance matrix of the distance.
Definition: Vertexing.cc:5
bool isAvailable() const
Return &#39;true&#39; if the reco::Vertex is available in the file, false if it has been dropped.
Definition: Vertexing.h:41
bool isNonnull() const
Return &#39;true&#39; unless this is a null association (that is, no vertex)
Definition: Vertexing.h:39
VertexAssociation()
Create a null vertx association.
Definition: Vertexing.h:28
void setDr(const Measurement1DFloat &dr)
Definition: Vertexing.h:69
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const Measurement1DFloat & dz() const
Definition: Vertexing.h:60
reco::VertexRef vertex_
Definition: Vertexing.h:88
VertexAssociation(const reco::VertexRef &vertex, const reco::TrackBaseRef &tk)
Definition: Vertexing.h:34
const reco::Vertex * operator->() const
Allows VertexAssociation to behave like a vertex ref (e.g. to do "assoc->position()") ...
Definition: Vertexing.h:45
void setDz(const Measurement1D &dz)
Definition: Vertexing.h:70
const reco::Vertex * vertex() const
Returns a pointer to the vertex, or a null pointer if there is no vertex (null association) ...
Definition: Vertexing.h:50
void setDz(const Measurement1DFloat &dz)
Definition: Vertexing.h:68
Definition: HeavyIon.h:7
const reco::TrackBaseRef & trackRef() const
Returns a reference to the track stored in this vertex (can be null)
Definition: Vertexing.h:54
bool hasErrors() const
True if the errors on dr and dz have been set, false if they&#39;re nulls.
Definition: Vertexing.h:66
bool isAvailable() const
Definition: Ref.h:541
const Measurement1DFloat & dr() const
Distance between the object and the vertex in the transverse plane, and it&#39;s error.
Definition: Vertexing.h:62
bool isNull() const
Checks for null.
Definition: RefToBase.h:297
bool isNull() const
Checks for null.
Definition: Ref.h:235
void setDr(const Measurement1D &dr)
Definition: Vertexing.h:71
bool isNull() const
Return &#39;true&#39; if this is a null association (that is, no vertex)
Definition: Vertexing.h:37
VertexAssociation(const reco::VertexRef &vertex)
Create a vertex association given a ref to a vertex.
Definition: Vertexing.h:30
const reco::VertexRef & vertexRef() const
Returns the reference to the vertex (can be a null reference)
Definition: Vertexing.h:48
bool hasTrack() const
Returns &#39;true&#39; if a reference to a track was stored in this VertexAssociation.
Definition: Vertexing.h:52
const reco::Track * track() const
Returns a C++ pointer to the track stored in this vertex (can be a null pointer)
Definition: Vertexing.h:56
ROOT::Math::SVector< double, 3 > AlgebraicVector3
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Measurement1DFloat dr_
Definition: Vertexing.h:89
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:25
bool hasTransverseIP() const
True if the transverse distance was computed for this VertexAssociation.
Definition: Vertexing.h:64
const reco::Vertex & operator*() const
Return the vertex (that is, you can do "const reco::Vertex &vtx = *assoc")
Definition: Vertexing.h:43
value_type const * get() const
Definition: RefToBase.h:211
void setDistances(const T1 &p1, const T2 &p2, const AlgebraicSymMatrix33 &err)
Definition: Vertexing.h:78
reco::TrackBaseRef track_
Definition: Vertexing.h:92
Measurement1DFloat dz_
Definition: Vertexing.h:89