#include <DataFormats/VertexReco/interface/Vertex.h>
Public Types | |
enum | { dimension = 3 } |
error matrix dimension More... | |
enum | { size = dimension * ( dimension + 1 ) / 2 } |
matix size More... | |
typedef math::Error< dimension > ::type | CovarianceMatrix |
covariance error matrix (3x3) | |
typedef math::Error< dimension > ::type | Error |
covariance error matrix (3x3) | |
typedef unsigned int | index |
index type | |
typedef math::XYZPoint | Point |
point in the space | |
typedef std::vector < TrackBaseRef > ::const_iterator | trackRef_iterator |
The iteratator for the vector<TrackRef>. | |
Public Member Functions | |
void | add (const TrackBaseRef &r, const Track &refTrack, float w=1.0) |
add the original a Track(reference) and the smoothed Track | |
void | add (const TrackBaseRef &r, float w=1.0) |
add a reference to a Track | |
double | chi2 () const |
chi-squares | |
CovarianceMatrix | covariance () const |
return SMatrix | |
double | covariance (int i, int j) const |
Error | error () const |
return SMatrix | |
double | error (int i, int j) const |
(i, j)-th element of error matrix, i, j = 0, ... 2 | |
void | fill (CovarianceMatrix &v) const |
fill SMatrix | |
bool | hasRefittedTracks () const |
Checks whether refitted tracks are stored. | |
bool | isFake () const |
Tells whether a Vertex is fake, i.e. | |
bool | isValid () const |
Tells whether the vertex is valid. | |
double | ndof () const |
Number of degrees of freedom Meant to be Double32_t for soft-assignment fitters: tracks may contribute to the vertex with fractional weights. | |
double | normalizedChi2 () const |
chi-squared divided by n.d.o.f. | |
TrackBaseRef | originalTrack (const Track &refTrack) const |
Returns the original track which corresponds to a particular refitted Track Throws an exception if now refitted tracks are stored ot the track is not found in the list. | |
const Point & | position () const |
position | |
Track | refittedTrack (const TrackRef &track) const |
Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list. | |
Track | refittedTrack (const TrackBaseRef &track) const |
Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list. | |
const std::vector< Track > & | refittedTracks () const |
Returns the container of refitted tracks. | |
void | removeTracks () |
trackRef_iterator | tracks_begin () const |
first iterator over tracks | |
trackRef_iterator | tracks_end () const |
last iterator over tracks | |
size_t | tracksSize () const |
number of tracks | |
float | trackWeight (const TrackRef &r) const |
returns the weight with which a Track has contributed to the vertex-fit. | |
float | trackWeight (const TrackBaseRef &r) const |
returns the weight with which a Track has contributed to the vertex-fit. | |
Vertex (const Point &, const Error &, double chi2, double ndof, size_t size) | |
constructor for a valid vertex, with all data | |
Vertex (const Point &, const Error &) | |
Constructor for a fake vertex. | |
Vertex () | |
default constructor - The vertex will not be valid. | |
double | x () const |
x coordinate | |
double | xError () const |
error on x | |
double | y () const |
y coordinate | |
double | yError () const |
error on y | |
double | z () const |
y coordinate | |
double | zError () const |
error on z | |
Private Member Functions | |
index | idx (index i, index j) const |
position index | |
Private Attributes | |
Double32_t | chi2_ |
chi-sqared | |
Double32_t | covariance_ [size] |
covariance matrix (3x3) as vector | |
Double32_t | ndof_ |
number of degrees of freedom | |
Point | position_ |
position | |
std::vector< Track > | refittedTracks_ |
The vector of refitted tracks. | |
std::vector< TrackBaseRef > | tracks_ |
reference to tracks | |
bool | validity_ |
tells wether the vertex is really valid. | |
std::vector< float > | weights_ |
Classes | |
class | TrackEqual |
The vertex can be valid, fake, or invalid. A valid vertex is one which has been obtained from a vertex fit of tracks, and all data is meaningful A fake vertex is a vertex which was not made out of a proper fit with tracks, but still has a position and error (chi2 and ndof are null). For a primary vertex, it could simply be the beam line. A fake vertex is considered valid. An invalid vertex has no meaningful data.
Definition at line 33 of file Vertex.h.
typedef math::Error<dimension>::type reco::Vertex::CovarianceMatrix |
typedef math::Error<dimension>::type reco::Vertex::Error |
typedef unsigned int reco::Vertex::index |
typedef math::XYZPoint reco::Vertex::Point |
typedef std::vector<TrackBaseRef >::const_iterator reco::Vertex::trackRef_iterator |
anonymous enum |
anonymous enum |
reco::Vertex::Vertex | ( | ) | [inline] |
Constructor for a fake vertex.
Definition at line 17 of file Vertex.cc.
References covariance_, dimension, err, i, idx(), j, and validity_.
00017 : 00018 chi2_( 0.0 ), ndof_( 0 ), position_( p ) { 00019 index idx = 0; 00020 for( index i = 0; i < dimension; ++ i ) 00021 for( index j = 0; j <= i; ++ j ) 00022 covariance_[ idx ++ ] = err( i, j ); 00023 validity_ = true; 00024 }
constructor for a valid vertex, with all data
Definition at line 7 of file Vertex.cc.
References covariance_, dimension, err, i, idx(), j, tracks_, and validity_.
00007 : 00008 chi2_( chi2 ), ndof_( ndof ), position_( p ) { 00009 tracks_.reserve( size ); 00010 index idx = 0; 00011 for( index i = 0; i < dimension; ++ i ) 00012 for( index j = 0; j <= i; ++ j ) 00013 covariance_[ idx ++ ] = err( i, j ); 00014 validity_ = true; 00015 }
void Vertex::add | ( | const TrackBaseRef & | r, | |
const Track & | refTrack, | |||
float | w = 1.0 | |||
) |
add the original a Track(reference) and the smoothed Track
Definition at line 57 of file Vertex.cc.
References refittedTracks_, tracks_, and weights_.
00058 { 00059 tracks_.push_back ( r ); 00060 refittedTracks_.push_back ( refTrack ); 00061 weights_.push_back(w); 00062 }
void Vertex::add | ( | const TrackBaseRef & | r, | |
float | w = 1.0 | |||
) |
add a reference to a Track
Definition at line 50 of file Vertex.cc.
References tracks_, and weights_.
Referenced by NuclearVertexBuilder::FillVertexWithCrossingPoint(), NuclearVertexBuilder::FillVertexWithLastPrimHit(), and PixelVertexProducer::produce().
double reco::Vertex::chi2 | ( | void | ) | const [inline] |
chi-squares
Definition at line 79 of file Vertex.h.
References chi2_.
Referenced by KalmanVertexTrackCompatibilityEstimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), V0Fitter::fitAll(), ConeIsolation::produce(), CandCommonVertexFitterBase::set(), PFCandCommonVertexFitterBase::set(), and PrimaryVertexMonitor::vertexPlots().
00079 { return chi2_; }
CovarianceMatrix reco::Vertex::covariance | ( | void | ) | const [inline] |
Definition at line 109 of file Vertex.h.
References covariance_, and idx().
Referenced by SignedImpactParameter3D::apply(), SignedTransverseImpactParameter::apply(), SignedDecayLength3D::apply(), VertexDistance::compatibility(), reco::SecondaryVertex::computeDist2d(), reco::SecondaryVertex::computeDist3d(), VertexDistance::distance(), VertexCompatibleWithBeam::distanceToBeam(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), V0Fitter::fitAll(), VertexCompatibleWithBeam::operator()(), PixelTrackProducerWithZPos::refitWithVertex(), IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), PrimaryVertexMonitor::vertexPlots(), reco::V0Candidate::vtxCovariance(), and SignedTransverseImpactParameter::zImpactParameter().
00109 { 00110 return covariance_[ idx( i, j ) ]; 00111 }
Error reco::Vertex::error | ( | ) | const [inline] |
return SMatrix
Definition at line 115 of file Vertex.h.
Referenced by reco::SecondaryVertex::computeDist2d(), and reco::SecondaryVertex::computeDist3d().
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition at line 104 of file Vertex.h.
References GenMuonPlsPt100GeV_cfg::cout, covariance_, lat::endl(), and idx().
Referenced by pat::VertexAssociationSelector::operator()(), reco::print(), and ConeIsolation::produce().
00104 { 00105 std::cout << "reco::Vertex::error(i, j) OBSOLETE, use covariance(i, j)" 00106 << std::endl; 00107 return covariance_[ idx( i, j ) ]; 00108 }
void reco::Vertex::fill | ( | CovarianceMatrix & | v | ) | const |
fill SMatrix
Referenced by covariance(), error(), CandCommonVertexFitterBase::set(), and PFCandCommonVertexFitterBase::set().
bool reco::Vertex::hasRefittedTracks | ( | ) | const [inline] |
Checks whether refitted tracks are stored.
Definition at line 120 of file Vertex.h.
References refittedTracks_.
00120 {return !refittedTracks_.empty();}
bool reco::Vertex::isFake | ( | ) | const [inline] |
Tells whether a Vertex is fake, i.e.
not a vertex made out of a proper fit with tracks. For a primary vertex, it could simply be the beam line.
Definition at line 62 of file Vertex.h.
References chi2_, ndof_, and tracks_.
Referenced by TauTagTools::filteredPFChargedHadrCands(), TauTagTools::filteredTracks(), and PrimaryVertexMonitor::vertexPlots().
Tells whether the vertex is valid.
Definition at line 58 of file Vertex.h.
References validity_.
Referenced by ConvertedPhotonProducer::buildCollections(), NuclearLikelihood::calculate(), NuclearVertexBuilder::FillVertexWithAdaptVtxFitter(), SoftConversionProducer::produce(), and PrimaryVertexMonitor::vertexPlots().
00058 {return validity_;}
double reco::Vertex::ndof | ( | ) | const [inline] |
Number of degrees of freedom Meant to be Double32_t for soft-assignment fitters: tracks may contribute to the vertex with fractional weights.
The ndof is then = to the sum of the track weights. see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002
Definition at line 86 of file Vertex.h.
References ndof_.
Referenced by V0Fitter::fitAll(), ConeIsolation::produce(), CandCommonVertexFitterBase::set(), PFCandCommonVertexFitterBase::set(), and PrimaryVertexMonitor::vertexPlots().
00086 { return ndof_; }
double reco::Vertex::normalizedChi2 | ( | ) | const [inline] |
TrackBaseRef Vertex::originalTrack | ( | const Track & | refTrack | ) | const |
Returns the original track which corresponds to a particular refitted Track Throws an exception if now refitted tracks are stored ot the track is not found in the list.
Definition at line 85 of file Vertex.cc.
References it, refittedTracks_, and tracks_.
00086 { 00087 if (refittedTracks_.empty()) 00088 throw cms::Exception("Vertex") << "No refitted tracks stored in vertex\n"; 00089 std::vector<Track>::const_iterator it = 00090 find_if(refittedTracks_.begin(), refittedTracks_.end(), TrackEqual(refTrack)); 00091 if (it==refittedTracks_.end()) 00092 throw cms::Exception("Vertex") << "Refitted track not found in list\n"; 00093 size_t pos = it - refittedTracks_.begin(); 00094 return tracks_[pos]; 00095 }
const Point& reco::Vertex::position | ( | ) | const [inline] |
position
Definition at line 90 of file Vertex.h.
References position_.
Referenced by SignedImpactParameter3D::apply(), ConvertedPhotonProducer::buildCollections(), pat::LeptonVertexSignificance::calculate(), VertexDistance::compatibility(), reco::SecondaryVertex::computeDist2d(), reco::SecondaryVertex::computeDist3d(), reco::VZero::crossingPoint(), VertexDistance::distance(), VertexCompatibleWithBeam::distanceToBeam(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), VertexPlots::fill(), TauTagTools::filteredPFChargedHadrCands(), TauTagTools::filteredTracks(), NuclearVertexBuilder::isCompatible(), NuclearTrackCorrector::newTrajNeeded(), reco::VertexFilter::operator()(), VertexCompatibleWithBeam::operator()(), pat::VertexAssociationSelector::operator()(), print(), SecondaryVertexProducer::produce(), PixelTrackProducerWithZPos::refitWithVertex(), reco::V0Candidate::setVertex(), VertexDistanceXY::signedDistance(), VertexDistance3D::signedDistance(), ConeIsolationAlgorithm::tag(), PrimaryVertexMonitor::vertexPlots(), and reco::Conversion::zOfPrimaryVertexFromTracks().
00090 { return position_; }
Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list.
Definition at line 107 of file Vertex.cc.
References refittedTrack().
00108 { 00109 return refittedTrack(TrackBaseRef(track)); 00110 }
Track Vertex::refittedTrack | ( | const TrackBaseRef & | track | ) | const |
Returns the refitted track which corresponds to a particular original Track Throws an exception if now refitted tracks are stored ot the track is not found in the list.
Definition at line 97 of file Vertex.cc.
References Exception, find(), it, refittedTracks_, tracks_begin(), and tracks_end().
Referenced by refittedTrack().
00098 { 00099 if (refittedTracks_.empty()) 00100 throw cms::Exception("Vertex") << "No refitted tracks stored in vertex\n"; 00101 trackRef_iterator it = find(tracks_begin(), tracks_end(), track); 00102 if (it==tracks_end()) throw cms::Exception("Vertex") << "Track not found in list\n"; 00103 size_t pos = it - tracks_begin(); 00104 return refittedTracks_[pos]; 00105 }
const std::vector<Track>& reco::Vertex::refittedTracks | ( | ) | const [inline] |
Returns the container of refitted tracks.
Definition at line 135 of file Vertex.h.
References refittedTracks_.
00135 { return refittedTracks_;}
void Vertex::removeTracks | ( | ) |
Definition at line 64 of file Vertex.cc.
References refittedTracks_, tracks_, and weights_.
00065 { 00066 weights_.clear(); 00067 tracks_.clear(); 00068 refittedTracks_.clear(); 00069 }
Vertex::trackRef_iterator Vertex::tracks_begin | ( | ) | const |
first iterator over tracks
Definition at line 38 of file Vertex.cc.
References tracks_.
Referenced by NuclearVertexBuilder::addSecondaryTrack(), NuclearLikelihood::calculate(), PFPileUp::chargedHadronVertex(), computeSharedTracks(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), PATPrimaryVertexSelector::getVertexVariables(), NuclearVertexBuilder::isCompatible(), reco::VZero::negativeDaughter(), reco::VertexFilter::operator()(), reco::VZero::positiveDaughter(), reco::NuclearInteraction::primaryTrack(), SecondaryVertexProducer::produce(), PVClusterComparer::pTSquaredSum(), refittedTrack(), NuclearLikelihood::secondaryTrackMaxHits(), reco::NuclearInteraction::secondaryTracks_begin(), reco::NbSharedTracks::sharedTracks(), VertexHigherPtSquared::sumPtSquared(), reco::TrackKinematics::TrackKinematics(), trackWeight(), and PrimaryVertexMonitor::vertexPlots().
00039 { 00040 return tracks_.begin(); 00041 }
Vertex::trackRef_iterator Vertex::tracks_end | ( | ) | const |
last iterator over tracks
Definition at line 43 of file Vertex.cc.
References tracks_.
Referenced by NuclearVertexBuilder::addSecondaryTrack(), PFPileUp::chargedHadronVertex(), computeSharedTracks(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), PATPrimaryVertexSelector::getVertexVariables(), reco::VertexFilter::operator()(), SecondaryVertexProducer::produce(), PVClusterComparer::pTSquaredSum(), refittedTrack(), NuclearLikelihood::secondaryTrackMaxHits(), reco::NuclearInteraction::secondaryTracks_end(), reco::NbSharedTracks::sharedTracks(), VertexHigherPtSquared::sumPtSquared(), reco::TrackKinematics::TrackKinematics(), trackWeight(), and PrimaryVertexMonitor::vertexPlots().
00044 { 00045 // if ( !(tracks_.size() ) ) createTracks(); 00046 return tracks_.end(); 00047 // return weights_.keys().end(); 00048 }
size_t Vertex::tracksSize | ( | ) | const |
number of tracks
Definition at line 33 of file Vertex.cc.
References weights_.
Referenced by NuclearLikelihood::calculate(), NuclearVertexBuilder::FillVertexWithAdaptVtxFitter(), ConeIsolation::produce(), NuclearLikelihood::secondaryTrackMaxHits(), reco::NuclearInteraction::secondaryTracksSize(), and PrimaryVertexMonitor::vertexPlots().
00034 { 00035 return weights_.size(); 00036 }
float Vertex::trackWeight | ( | const TrackRef & | r | ) | const |
returns the weight with which a Track has contributed to the vertex-fit.
Definition at line 79 of file Vertex.cc.
References trackWeight().
00080 { 00081 return trackWeight(TrackBaseRef(track)); 00082 }
float Vertex::trackWeight | ( | const TrackBaseRef & | r | ) | const |
returns the weight with which a Track has contributed to the vertex-fit.
Definition at line 71 of file Vertex.cc.
References find(), it, tracks_begin(), tracks_end(), and weights_.
Referenced by computeSharedTracks(), reco::VertexFilter::operator()(), SecondaryVertexProducer::produce(), reco::TrackKinematics::TrackKinematics(), trackWeight(), and PrimaryVertexMonitor::vertexPlots().
00072 { 00073 trackRef_iterator it = find(tracks_begin(), tracks_end(), track); 00074 if (it==tracks_end()) return 0.0; 00075 size_t pos = it - tracks_begin(); 00076 return weights_[pos]; 00077 }
double reco::Vertex::x | ( | ) | const [inline] |
x coordinate
Definition at line 92 of file Vertex.h.
References position_.
Referenced by SignedImpactParameter3D::apply(), SignedTransverseImpactParameter::apply(), SignedDecayLength3D::apply(), IPTools::closestApproachToJet(), SignedDecayLength3D::closestApproachToJet(), SignedImpactParameter3D::closestApproachToJet(), SignedImpactParameter3D::distance(), SignedImpactParameter3D::distanceWithJetAxis(), V0Fitter::fitAll(), IPTools::jetTrackDistance(), pat::VertexAssociationSelector::operator()(), reco::print(), SecondaryVertexProducer::produce(), IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), and SignedTransverseImpactParameter::zImpactParameter().
00092 { return position_.X(); }
double reco::Vertex::xError | ( | ) | const [inline] |
error on x
Definition at line 98 of file Vertex.h.
References covariance(), and funct::sqrt().
Referenced by NuclearVertexBuilder::isCompatible(), and PrimaryVertexMonitor::vertexPlots().
00098 { return sqrt( covariance(0, 0) ); }
double reco::Vertex::y | ( | ) | const [inline] |
y coordinate
Definition at line 94 of file Vertex.h.
References position_.
Referenced by SignedImpactParameter3D::apply(), SignedTransverseImpactParameter::apply(), SignedDecayLength3D::apply(), IPTools::closestApproachToJet(), SignedDecayLength3D::closestApproachToJet(), SignedImpactParameter3D::closestApproachToJet(), SignedImpactParameter3D::distance(), SignedImpactParameter3D::distanceWithJetAxis(), V0Fitter::fitAll(), IPTools::jetTrackDistance(), pat::VertexAssociationSelector::operator()(), reco::print(), SecondaryVertexProducer::produce(), IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), and SignedTransverseImpactParameter::zImpactParameter().
00094 { return position_.Y(); }
double reco::Vertex::yError | ( | ) | const [inline] |
error on y
Definition at line 100 of file Vertex.h.
References covariance(), and funct::sqrt().
Referenced by NuclearVertexBuilder::isCompatible(), and PrimaryVertexMonitor::vertexPlots().
00100 { return sqrt( covariance(1, 1) ); }
double reco::Vertex::z | ( | ) | const [inline] |
y coordinate
Definition at line 96 of file Vertex.h.
References position_.
Referenced by SignedImpactParameter3D::apply(), SignedTransverseImpactParameter::apply(), SignedDecayLength3D::apply(), CaloRecoTauTagInfoAlgorithm::buildCaloTauTagInfo(), PFRecoTauTagInfoAlgorithm::buildPFTauTagInfo(), IPTools::closestApproachToJet(), SignedDecayLength3D::closestApproachToJet(), SignedImpactParameter3D::closestApproachToJet(), SignedImpactParameter3D::distance(), SignedImpactParameter3D::distanceWithJetAxis(), VertexPlots::fill(), V0Fitter::fitAll(), IPTools::jetTrackDistance(), OptTOA::LoopOverJetTracksAssociation(), PrimaryVertexAnalyzer::matchVertex(), pat::VertexAssociationSelector::operator()(), reco::print(), TrackIPProducer::produce(), ConeIsolation::produce(), SecondaryVertexProducer::produce(), IPTools::signedDecayLength3D(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), ConeIsolationAlgorithm::tag(), and SignedTransverseImpactParameter::zImpactParameter().
00096 { return position_.Z(); }
double reco::Vertex::zError | ( | ) | const [inline] |
error on z
Definition at line 102 of file Vertex.h.
References covariance(), and funct::sqrt().
Referenced by pat::LeptonVertexSignificance::calculate(), NuclearVertexBuilder::isCompatible(), pat::VertexAssociationSelector::operator()(), and PrimaryVertexMonitor::vertexPlots().
00102 { return sqrt( covariance(2, 2) ); }
Double32_t reco::Vertex::chi2_ [private] |
chi-sqared
Definition at line 146 of file Vertex.h.
Referenced by chi2(), isFake(), and normalizedChi2().
Double32_t reco::Vertex::covariance_[size] [private] |
covariance matrix (3x3) as vector
Definition at line 152 of file Vertex.h.
Referenced by covariance(), error(), and Vertex().
Double32_t reco::Vertex::ndof_ [private] |
number of degrees of freedom
Definition at line 148 of file Vertex.h.
Referenced by isFake(), ndof(), and normalizedChi2().
Point reco::Vertex::position_ [private] |
std::vector<Track> reco::Vertex::refittedTracks_ [private] |
The vector of refitted tracks.
Definition at line 156 of file Vertex.h.
Referenced by add(), hasRefittedTracks(), originalTrack(), refittedTrack(), refittedTracks(), and removeTracks().
std::vector<TrackBaseRef > reco::Vertex::tracks_ [private] |
reference to tracks
Definition at line 154 of file Vertex.h.
Referenced by add(), isFake(), originalTrack(), removeTracks(), tracks_begin(), tracks_end(), and Vertex().
bool reco::Vertex::validity_ [private] |
std::vector<float> reco::Vertex::weights_ [private] |
Definition at line 157 of file Vertex.h.
Referenced by add(), removeTracks(), tracksSize(), and trackWeight().