CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
25 namespace pat {
27  public:
36  // --- Methods to mimick VertexRef
38  bool isNull() const { return vertex_.isNull(); }
40  bool isNonnull() const { return vertex_.isNonnull(); }
42  bool isAvailable() const { return vertex_.isAvailable(); }
44  const reco::Vertex & operator*() const { return * operator->(); }
46  const reco::Vertex * operator->() const { return vertex_.isNull() ? 0 : vertex_.get(); }
47  // --- Methods to get the Vertex and track
49  const reco::VertexRef & vertexRef() const { return vertex_; }
51  const reco::Vertex * vertex() const { return vertex_.isNull() ? 0 : vertex_.get(); }
53  bool hasTrack() const { return !track_.isNull(); }
55  const reco::TrackBaseRef & trackRef() const { return track_; }
57  const reco::Track * track() const { return hasTrack() ? track_.get() : 0; }
58  // --- Methods to return distances
61  const Measurement1DFloat & dz() const { return dz_; }
63  const Measurement1DFloat & dr() const { return dr_; }
65  bool hasTransverseIP() const { return (dr_.value() != 0); }
67  bool hasErrors() const { return (dz_.error() != 0) && ( !hasTransverseIP() || dr_.error() != 0 ); }
68  // ---- Methods to set distances
69  void setDz(const Measurement1DFloat & dz) { dz_ = dz; }
70  void setDr(const Measurement1DFloat & dr) { dr_ = dr; }
71  void setDz(const Measurement1D & dz) { dz_ = Measurement1DFloat(dz.value(), dz.error()); }
72  void setDr(const Measurement1D & dr) { dr_ = Measurement1DFloat(dr.value(), dr.error()); }
74  void setDistances(const AlgebraicVector3 & dist, const AlgebraicSymMatrix33 &err) ;
78  template<typename T1, typename T2>
79  void setDistances(const T1 & p1, const T2 &p2, const AlgebraicSymMatrix33 &err) {
80  AlgebraicVector3 dist(p1.x() - p2.x(), p1.y() - p2.y(), p1.z() - p2.z());
81  setDistances(dist, err);
82  }
83  // ---- 3D significance of the impact parameter
84  // float signif3d() const { return signif3d_; }
85  // bool hasSignif3d() const { return signif3d_ != 0; }
86  // void setSignif3d(float signif3d) { signif3d_ = signif3d; }
87  private:
88  // basic information
91  // float signif3d_;
92  // extended info
94  // fixme: add refitted momentum
95  };
96 }
97 
98 #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
Definition: Ref.h:576
value_type const * get() const
Definition: RefToBase.h:225
VertexAssociation()
Create a null vertx association.
Definition: Vertexing.h:29
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
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:42
bool isNonnull() const
Return &#39;true&#39; unless this is a null association (that is, no vertex)
Definition: Vertexing.h:40
void setDr(const Measurement1DFloat &dr)
Definition: Vertexing.h:70
bool isNull() const
Return &#39;true&#39; if this is a null association (that is, no vertex)
Definition: Vertexing.h:38
float error() const
double error() const
Definition: Measurement1D.h:30
const reco::TrackBaseRef & trackRef() const
Returns a reference to the track stored in this vertex (can be null)
Definition: Vertexing.h:55
reco::VertexRef vertex_
Definition: Vertexing.h:89
VertexAssociation(const reco::VertexRef &vertex, const reco::TrackBaseRef &tk)
Definition: Vertexing.h:35
const Measurement1DFloat & dz() const
Definition: Vertexing.h:61
void setDz(const Measurement1D &dz)
Definition: Vertexing.h:71
bool hasTransverseIP() const
True if the transverse distance was computed for this VertexAssociation.
Definition: Vertexing.h:65
void setDz(const Measurement1DFloat &dz)
Definition: Vertexing.h:69
bool hasErrors() const
True if the errors on dr and dz have been set, false if they&#39;re nulls.
Definition: Vertexing.h:67
const reco::Track * track() const
Returns a C++ pointer to the track stored in this vertex (can be a null pointer)
Definition: Vertexing.h:57
bool hasTrack() const
Returns &#39;true&#39; if a reference to a track was stored in this VertexAssociation.
Definition: Vertexing.h:53
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
ROOT::Math::SVector< double, 3 > AlgebraicVector3
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
const reco::VertexRef & vertexRef() const
Returns the reference to the vertex (can be a null reference)
Definition: Vertexing.h:49
double p2[4]
Definition: TauolaWrapper.h:90
const reco::Vertex * operator->() const
Allows VertexAssociation to behave like a vertex ref (e.g. to do &quot;assoc-&gt;position()&quot;) ...
Definition: Vertexing.h:46
bool isNull() const
Checks for null.
Definition: Ref.h:249
void setDr(const Measurement1D &dr)
Definition: Vertexing.h:72
const Measurement1DFloat & dr() const
Distance between the object and the vertex in the transverse plane, and it&#39;s error.
Definition: Vertexing.h:63
VertexAssociation(const reco::VertexRef &vertex)
Create a vertex association given a ref to a vertex.
Definition: Vertexing.h:31
bool isNull() const
Checks for null.
Definition: RefToBase.h:321
float value() const
double value() const
Definition: Measurement1D.h:28
double p1[4]
Definition: TauolaWrapper.h:89
Measurement1DFloat dr_
Definition: Vertexing.h:90
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:26
const reco::Vertex & operator*() const
Return the vertex (that is, you can do &quot;const reco::Vertex &amp;vtx = *assoc&quot;)
Definition: Vertexing.h:44
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:51
void setDistances(const T1 &p1, const T2 &p2, const AlgebraicSymMatrix33 &err)
Definition: Vertexing.h:79
reco::TrackBaseRef track_
Definition: Vertexing.h:93
Measurement1DFloat dz_
Definition: Vertexing.h:90