CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::VertexAssociation Class Reference

Analysis-level structure for vertex-related information. More...

#include "DataFormats/PatCandidates/interface/Vertexing.h"

Public Member Functions

const Measurement1DFloatdr () const
 Distance between the object and the vertex in the transverse plane, and it's error. More...
 
const Measurement1DFloatdz () const
 
bool hasErrors () const
 True if the errors on dr and dz have been set, false if they're nulls. More...
 
bool hasTrack () const
 Returns 'true' if a reference to a track was stored in this VertexAssociation. More...
 
bool hasTransverseIP () const
 True if the transverse distance was computed for this VertexAssociation. More...
 
bool isAvailable () const
 Return 'true' if the reco::Vertex is available in the file, false if it has been dropped. More...
 
bool isNonnull () const
 Return 'true' unless this is a null association (that is, no vertex) More...
 
bool isNull () const
 Return 'true' if this is a null association (that is, no vertex) More...
 
const reco::Vertexoperator* () const
 Return the vertex (that is, you can do "const reco::Vertex &vtx = *assoc") More...
 
const reco::Vertexoperator-> () const
 Allows VertexAssociation to behave like a vertex ref (e.g. to do "assoc->position()") More...
 
void setDistances (const AlgebraicVector3 &dist, const AlgebraicSymMatrix33 &err)
 Set dz and dr given the distance and the 3x3 total covariance matrix of the distance. More...
 
template<typename T1 , typename T2 >
void setDistances (const T1 &p1, const T2 &p2, const AlgebraicSymMatrix33 &err)
 
void setDr (const Measurement1D &dr)
 
void setDr (const Measurement1DFloat &dr)
 
void setDz (const Measurement1D &dz)
 
void setDz (const Measurement1DFloat &dz)
 
const reco::Tracktrack () const
 Returns a C++ pointer to the track stored in this vertex (can be a null pointer) More...
 
const reco::TrackBaseReftrackRef () const
 Returns a reference to the track stored in this vertex (can be null) More...
 
const reco::Vertexvertex () const
 Returns a pointer to the vertex, or a null pointer if there is no vertex (null association) More...
 
 VertexAssociation ()
 Create a null vertx association. More...
 
 VertexAssociation (const reco::VertexRef &vertex)
 Create a vertex association given a ref to a vertex. More...
 
 VertexAssociation (const reco::VertexRef &vertex, const reco::TrackBaseRef &tk)
 
const reco::VertexRefvertexRef () const
 Returns the reference to the vertex (can be a null reference) More...
 

Private Attributes

Measurement1DFloat dr_
 
Measurement1DFloat dz_
 
reco::TrackBaseRef track_
 
reco::VertexRef vertex_
 

Detailed Description

Analysis-level structure for vertex-related information.

pat::VertexAssociation holds a reference to a vertex and extended information like the distance between the object and the vertex.

For convenience, pat::VertexAssociation behaves like a VertexRef, that is (*assoc) is a reco::Vertex.

The original proposal is at https://hypernews.cern.ch/HyperNews/CMS/get/physTools/587.html

Author
Giovanni Petrucciani

Definition at line 25 of file Vertexing.h.

Constructor & Destructor Documentation

◆ VertexAssociation() [1/3]

pat::VertexAssociation::VertexAssociation ( )
inline

Create a null vertx association.

Definition at line 28 of file Vertexing.h.

28 {}

◆ VertexAssociation() [2/3]

pat::VertexAssociation::VertexAssociation ( const reco::VertexRef vertex)
inline

Create a vertex association given a ref to a vertex.

Definition at line 30 of file Vertexing.h.

30 : vertex_(vertex) {}

◆ VertexAssociation() [3/3]

pat::VertexAssociation::VertexAssociation ( const reco::VertexRef vertex,
const reco::TrackBaseRef tk 
)
inline

Create a vertex association given a ref to a vertex and a reference to a track object Note: you also have to set the distances, they can be computed by the VertexAssociation itself because it requires access to the magnetic field and other condition data.

Definition at line 34 of file Vertexing.h.

34 : vertex_(vertex), track_(tk) {}

Member Function Documentation

◆ dr()

const Measurement1DFloat& pat::VertexAssociation::dr ( ) const
inline

Distance between the object and the vertex in the transverse plane, and it's error.

Definition at line 62 of file Vertexing.h.

62 { return dr_; }

References dr_.

Referenced by pat::VertexAssociationSelector::operator()(), and setDr().

◆ dz()

const Measurement1DFloat& pat::VertexAssociation::dz ( ) const
inline

Distance between the object and the vertex along the Z axis, and it's error. Note 1: if the BeamSpot was used as Vertex, the error includes the BeamSpot spread!

Definition at line 60 of file Vertexing.h.

60 { return dz_; }

References dz_.

Referenced by Electron.Electron::cutBasedId(), ntupleDataFormat.Track::dzPull(), pat::VertexAssociationSelector::operator()(), and setDz().

◆ hasErrors()

bool pat::VertexAssociation::hasErrors ( ) const
inline

True if the errors on dr and dz have been set, false if they're nulls.

Definition at line 66 of file Vertexing.h.

66 { return (dz_.error() != 0) && (!hasTransverseIP() || dr_.error() != 0); }

References dr_, dz_, Measurement1DFloat::error(), and hasTransverseIP().

◆ hasTrack()

bool pat::VertexAssociation::hasTrack ( ) const
inline

Returns 'true' if a reference to a track was stored in this VertexAssociation.

Definition at line 52 of file Vertexing.h.

52 { return !track_.isNull(); }

References edm::RefToBase< T >::isNull(), and track_.

Referenced by track().

◆ hasTransverseIP()

bool pat::VertexAssociation::hasTransverseIP ( ) const
inline

True if the transverse distance was computed for this VertexAssociation.

Definition at line 64 of file Vertexing.h.

64 { return (dr_.value() != 0); }

References dr_, and Measurement1DFloat::value().

Referenced by hasErrors().

◆ isAvailable()

bool pat::VertexAssociation::isAvailable ( ) const
inline

Return 'true' if the reco::Vertex is available in the file, false if it has been dropped.

Definition at line 41 of file Vertexing.h.

41 { return vertex_.isAvailable(); }

References edm::Ref< C, T, F >::isAvailable(), and vertex_.

◆ isNonnull()

bool pat::VertexAssociation::isNonnull ( ) const
inline

Return 'true' unless this is a null association (that is, no vertex)

Definition at line 39 of file Vertexing.h.

39 { return vertex_.isNonnull(); }

References edm::Ref< C, T, F >::isNonnull(), and vertex_.

◆ isNull()

bool pat::VertexAssociation::isNull ( ) const
inline

Return 'true' if this is a null association (that is, no vertex)

Definition at line 37 of file Vertexing.h.

37 { return vertex_.isNull(); }

References edm::Ref< C, T, F >::isNull(), and vertex_.

Referenced by pat::VertexAssociationSelector::operator()().

◆ operator*()

const reco::Vertex& pat::VertexAssociation::operator* ( void  ) const
inline

Return the vertex (that is, you can do "const reco::Vertex &vtx = *assoc")

Definition at line 43 of file Vertexing.h.

43 { return *operator->(); }

References operator->().

◆ operator->()

const reco::Vertex* pat::VertexAssociation::operator-> ( ) const
inline

Allows VertexAssociation to behave like a vertex ref (e.g. to do "assoc->position()")

Definition at line 45 of file Vertexing.h.

45 { return vertex_.isNull() ? nullptr : vertex_.get(); }

References edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isNull(), and vertex_.

Referenced by operator*().

◆ setDistances() [1/2]

void VertexAssociation::setDistances ( const AlgebraicVector3 dist,
const AlgebraicSymMatrix33 err 
)

Set dz and dr given the distance and the 3x3 total covariance matrix of the distance.

Definition at line 5 of file Vertexing.cc.

5  {
6  setDz(Measurement1DFloat(std::abs(dist[2]), std::sqrt(err(2, 2))));
7 
8  AlgebraicVector3 dist2D(dist[0], dist[1], 0);
9  float d2 = dist2D[0] * dist2D[0] + dist2D[1] * dist2D[1];
10  setDr(Measurement1DFloat(sqrt(d2), sqrt(ROOT::Math::Similarity(dist2D, err) / d2)));
11 }

References funct::abs(), submitPVResolutionJobs::err, setDr(), setDz(), and mathSSE::sqrt().

Referenced by setDistances().

◆ setDistances() [2/2]

template<typename T1 , typename T2 >
void pat::VertexAssociation::setDistances ( const T1 &  p1,
const T2 &  p2,
const AlgebraicSymMatrix33 err 
)
inline

Set dz and dr given the two points (object and vertex) and the 3x3 total covariance matrix of the distance The covariance matrix must already include the covariance matrix of the vertex 'p1', 'p2' can be anything that has methods .x(), .y(), .z() (e.g. GlobalPoint, Vertex, ...)

Definition at line 78 of file Vertexing.h.

78  {
79  AlgebraicVector3 dist(p1.x() - p2.x(), p1.y() - p2.y(), p1.z() - p2.z());
80  setDistances(dist, err);
81  }

References submitPVResolutionJobs::err, p1, p2, and setDistances().

◆ setDr() [1/2]

void pat::VertexAssociation::setDr ( const Measurement1D dr)
inline

Definition at line 71 of file Vertexing.h.

References dr(), dr_, Measurement1DFloat::error(), and Measurement1DFloat::value().

◆ setDr() [2/2]

void pat::VertexAssociation::setDr ( const Measurement1DFloat dr)
inline

Definition at line 69 of file Vertexing.h.

69 { dr_ = dr; }

References dr(), and dr_.

Referenced by setDistances().

◆ setDz() [1/2]

void pat::VertexAssociation::setDz ( const Measurement1D dz)
inline

Definition at line 70 of file Vertexing.h.

References dz(), dz_, Measurement1DFloat::error(), and Measurement1DFloat::value().

◆ setDz() [2/2]

void pat::VertexAssociation::setDz ( const Measurement1DFloat dz)
inline

Definition at line 68 of file Vertexing.h.

68 { dz_ = dz; }

References dz(), and dz_.

Referenced by setDistances().

◆ track()

const reco::Track* pat::VertexAssociation::track ( ) const
inline

Returns a C++ pointer to the track stored in this vertex (can be a null pointer)

Definition at line 56 of file Vertexing.h.

56 { return hasTrack() ? track_.get() : nullptr; }

References edm::RefToBase< T >::get(), hasTrack(), and track_.

◆ trackRef()

const reco::TrackBaseRef& pat::VertexAssociation::trackRef ( ) const
inline

Returns a reference to the track stored in this vertex (can be null)

Definition at line 54 of file Vertexing.h.

54 { return track_; }

References track_.

◆ vertex()

const reco::Vertex* pat::VertexAssociation::vertex ( ) const
inline

Returns a pointer to the vertex, or a null pointer if there is no vertex (null association)

Definition at line 50 of file Vertexing.h.

50 { return vertex_.isNull() ? nullptr : vertex_.get(); }

References edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isNull(), and vertex_.

Referenced by Tau.Tau::dxy().

◆ vertexRef()

const reco::VertexRef& pat::VertexAssociation::vertexRef ( ) const
inline

Returns the reference to the vertex (can be a null reference)

Definition at line 48 of file Vertexing.h.

48 { return vertex_; }

References vertex_.

Member Data Documentation

◆ dr_

Measurement1DFloat pat::VertexAssociation::dr_
private

Definition at line 89 of file Vertexing.h.

Referenced by dr(), hasErrors(), hasTransverseIP(), and setDr().

◆ dz_

Measurement1DFloat pat::VertexAssociation::dz_
private

Definition at line 89 of file Vertexing.h.

Referenced by dz(), hasErrors(), and setDz().

◆ track_

reco::TrackBaseRef pat::VertexAssociation::track_
private

Definition at line 92 of file Vertexing.h.

Referenced by hasTrack(), track(), and trackRef().

◆ vertex_

reco::VertexRef pat::VertexAssociation::vertex_
private

Definition at line 88 of file Vertexing.h.

Referenced by isAvailable(), isNonnull(), isNull(), operator->(), vertex(), and vertexRef().

edm::RefToBase::isNull
bool isNull() const
Checks for null.
Definition: RefToBase.h:295
pat::VertexAssociation::dz
const Measurement1DFloat & dz() const
Definition: Vertexing.h:60
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
pat::VertexAssociation::dr_
Measurement1DFloat dr_
Definition: Vertexing.h:89
Measurement1DFloat::error
float error() const
Definition: Measurement1DFloat.h:25
pat::VertexAssociation::hasTransverseIP
bool hasTransverseIP() const
True if the transverse distance was computed for this VertexAssociation.
Definition: Vertexing.h:64
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
pat::VertexAssociation::setDz
void setDz(const Measurement1DFloat &dz)
Definition: Vertexing.h:68
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
pat::VertexAssociation::hasTrack
bool hasTrack() const
Returns 'true' if a reference to a track was stored in this VertexAssociation.
Definition: Vertexing.h:52
pat::VertexAssociation::dr
const Measurement1DFloat & dr() const
Distance between the object and the vertex in the transverse plane, and it's error.
Definition: Vertexing.h:62
Measurement1DFloat::value
float value() const
Definition: Measurement1DFloat.h:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
pat::VertexAssociation::setDistances
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
edm::RefToBase::get
value_type const * get() const
Definition: RefToBase.h:209
pat::VertexAssociation::dz_
Measurement1DFloat dz_
Definition: Vertexing.h:89
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::VertexAssociation::setDr
void setDr(const Measurement1DFloat &dr)
Definition: Vertexing.h:69
p1
double p1[4]
Definition: TauolaWrapper.h:89
Measurement1DFloat
Definition: Measurement1DFloat.h:9
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
pat::VertexAssociation::track_
reco::TrackBaseRef track_
Definition: Vertexing.h:92
pat::VertexAssociation::vertex_
reco::VertexRef vertex_
Definition: Vertexing.h:88
pat::VertexAssociation::vertex
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
pat::VertexAssociation::operator->
const reco::Vertex * operator->() const
Allows VertexAssociation to behave like a vertex ref (e.g. to do "assoc->position()")
Definition: Vertexing.h:45
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22