#include <CachingVertex.h>
Public Types | |
typedef ROOT::Math::SMatrix < double, N-2, N-2, ROOT::Math::MatRepStd< double, N-2, N-2 > > | AlgebraicMatrixMM |
typedef ROOT::Math::SMatrix < double, N, N, ROOT::Math::MatRepSym< double, N > > | AlgebraicSymMatrixNN |
typedef ReferenceCountingPointer < VertexTrack< N > > | RefCountedVertexTrack |
typedef std::map < RefCountedVertexTrack, AlgebraicMatrixMM > | TrackMap |
typedef std::map < RefCountedVertexTrack, TrackMap > | TrackToTrackMap |
Public Member Functions | |
CachingVertex (const GlobalPoint &pos, const GlobalError &posErr, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const GlobalPoint &pos, const GlobalWeight &posWeight, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const GlobalPoint &priorPos, const GlobalError &priorErr, const GlobalPoint &pos, const GlobalError &posErr, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const VertexState &priorVertexState, const VertexState &aVertexState, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const VertexState &aVertexState, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq, const TrackToTrackMap &covMap) | |
CachingVertex (const GlobalPoint &priorPos, const GlobalError &priorErr, const GlobalPoint &pos, const GlobalWeight &posWeight, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const VertexState &priorVertexState, const VertexState &aVertexState, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq, const TrackToTrackMap &covMap) | |
CachingVertex () | |
CachingVertex (const AlgebraicVector3 &weightTimesPosition, const GlobalWeight &posWeight, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const GlobalPoint &priorPos, const GlobalError &priorErr, const AlgebraicVector3 &weightTimesPosition, const GlobalWeight &posWeight, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
CachingVertex (const VertexState &aVertexState, const std::vector< RefCountedVertexTrack > &tks, float totalChiSq) | |
float | degreesOfFreedom () const |
GlobalError | error () const |
bool | hasPrior () const |
bool | isValid () const |
operator TransientVertex () const | |
GlobalPoint | position () const |
GlobalError | priorError () const |
GlobalPoint | priorPosition () const |
VertexState | priorVertexState () const |
AlgebraicMatrixMM | tkToTkCovariance (const RefCountedVertexTrack t1, const RefCountedVertexTrack t2) const |
bool | tkToTkCovarianceIsAvailable () const |
float | totalChiSquared () const |
std::vector < RefCountedVertexTrack > | tracks () const |
VertexState | vertexState () const |
GlobalWeight | weight () const |
AlgebraicVector3 | weightTimesPosition () const |
Private Member Functions | |
void | computeNDF () const |
Private Attributes | |
float | theChiSquared |
TrackToTrackMap | theCovMap |
bool | theCovMapAvailable |
float | theNDF |
bool | theNDFAvailable |
VertexState | thePriorVertexState |
std::vector < RefCountedVertexTrack > | theTracks |
bool | theValid |
VertexState | theVertexState |
bool | withPrior |
Class for vertices fitted with Kalman and linear fit algorithms. Provides access to temporary data to speed up the vertex update.
Definition at line 26 of file CachingVertex.h.
typedef ROOT::Math::SMatrix<double,N-2,N-2,ROOT::Math::MatRepStd<double,N-2,N-2> > CachingVertex< N >::AlgebraicMatrixMM |
Definition at line 32 of file CachingVertex.h.
typedef ROOT::Math::SMatrix<double,N,N,ROOT::Math::MatRepSym<double,N> > CachingVertex< N >::AlgebraicSymMatrixNN |
Definition at line 31 of file CachingVertex.h.
typedef ReferenceCountingPointer<VertexTrack<N> > CachingVertex< N >::RefCountedVertexTrack |
Definition at line 30 of file CachingVertex.h.
typedef std::map<RefCountedVertexTrack, AlgebraicMatrixMM > CachingVertex< N >::TrackMap |
Definition at line 33 of file CachingVertex.h.
typedef std::map<RefCountedVertexTrack, TrackMap > CachingVertex< N >::TrackToTrackMap |
Definition at line 34 of file CachingVertex.h.
CachingVertex< N >::CachingVertex | ( | const GlobalPoint & | pos, |
const GlobalError & | posErr, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Constructors
Definition at line 10 of file CachingVertex.cc.
: theVertexState(pos, posErr), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), withPrior(false), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const GlobalPoint & | pos, |
const GlobalWeight & | posWeight, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 24 of file CachingVertex.cc.
: theVertexState(pos, posWeight), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), withPrior(false), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const AlgebraicVector3 & | weightTimesPosition, |
const GlobalWeight & | posWeight, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 37 of file CachingVertex.cc.
: theVertexState(weightTimesPosition, posWeight), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), withPrior(false), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const GlobalPoint & | priorPos, |
const GlobalError & | priorErr, | ||
const GlobalPoint & | pos, | ||
const GlobalError & | posErr, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 84 of file CachingVertex.cc.
: theVertexState(pos, posErr), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), thePriorVertexState(priorPos, priorErr), withPrior(true), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const GlobalPoint & | priorPos, |
const GlobalError & | priorErr, | ||
const GlobalPoint & | pos, | ||
const GlobalWeight & | posWeight, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 99 of file CachingVertex.cc.
: theVertexState(pos, posWeight), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), thePriorVertexState(priorPos, priorErr), withPrior(true), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const GlobalPoint & | priorPos, |
const GlobalError & | priorErr, | ||
const AlgebraicVector3 & | weightTimesPosition, | ||
const GlobalWeight & | posWeight, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 114 of file CachingVertex.cc.
: theVertexState(weightTimesPosition, posWeight), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), thePriorVertexState(priorPos, priorErr), withPrior(true), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const VertexState & | aVertexState, |
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 48 of file CachingVertex.cc.
: theVertexState(aVertexState), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), withPrior(false), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const VertexState & | priorVertexState, |
const VertexState & | aVertexState, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq | ||
) |
Definition at line 72 of file CachingVertex.cc.
: theVertexState(aVertexState), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMapAvailable(false), thePriorVertexState(priorVertexState), withPrior(true), theValid(true) {}
CachingVertex< N >::CachingVertex | ( | const VertexState & | aVertexState, |
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq, | ||
const TrackToTrackMap & | covMap | ||
) |
Definition at line 59 of file CachingVertex.cc.
References CachingVertex< N >::theCovMap, and CachingVertex< N >::theCovMapAvailable.
: theVertexState(aVertexState), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMap(covMap), theCovMapAvailable(true), withPrior(false), theValid(true) { if (theCovMap.empty()) theCovMapAvailable = false; }
CachingVertex< N >::CachingVertex | ( | const VertexState & | priorVertexState, |
const VertexState & | aVertexState, | ||
const std::vector< RefCountedVertexTrack > & | tks, | ||
float | totalChiSq, | ||
const TrackToTrackMap & | covMap | ||
) |
Definition at line 128 of file CachingVertex.cc.
References CachingVertex< N >::theCovMap, and CachingVertex< N >::theCovMapAvailable.
: theVertexState(aVertexState), theChiSquared(totalChiSq), theNDF(0), theNDFAvailable(false), theTracks(tks), theCovMap(covMap), theCovMapAvailable(true), thePriorVertexState(priorVertexState), withPrior(true), theValid(true) { if (theCovMap.empty()) theCovMapAvailable = false; }
CachingVertex< N >::CachingVertex | ( | ) |
Constructor for invalid CachingVertex
Definition at line 142 of file CachingVertex.cc.
: theChiSquared(-1), theNDF(0), theNDFAvailable(false), theTracks(), theCovMapAvailable(false), withPrior(false), theValid(false) {}
void CachingVertex< N >::computeNDF | ( | ) | const [private] |
Definition at line 185 of file CachingVertex.cc.
{ theNDF = 0; for (typename std::vector<RefCountedVertexTrack>::const_iterator itk = theTracks.begin(); itk != theTracks.end(); ++itk) { theNDF += (**itk).weight(); // adds up weights } theNDF *= 2.; // times 2df for each track if (!withPrior) theNDF -= 3.; // 3 position coordinates fitted theNDFAvailable = true; }
float CachingVertex< N >::degreesOfFreedom | ( | ) | const |
Definition at line 177 of file CachingVertex.cc.
Referenced by FinalTreeBuilder::buildTree(), fitChi2(), and KinematicVertex::KinematicVertex().
{ if (!theNDFAvailable) computeNDF(); return theNDF; }
GlobalError CachingVertex< N >::error | ( | ) | const |
Definition at line 156 of file CachingVertex.cc.
Referenced by FinalTreeBuilder::buildTree(), KinematicVertex::KinematicVertex(), trackVertexCompat(), and reco::GhostTrackVertexFinder::vertexCompat().
{ return theVertexState.error(); }
bool CachingVertex< N >::hasPrior | ( | ) | const [inline] |
Definition at line 95 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), KalmanSmoothedVertexChi2Estimator< N >::estimate(), GsfVertexMerger::merge(), SequentialVertexSmoother< N >::smooth(), GsfVertexSmoother::smooth(), and KalmanVertexUpdator< N >::update().
{return withPrior;}
bool CachingVertex< N >::isValid | ( | void | ) | const [inline] |
Definition at line 96 of file CachingVertex.h.
Referenced by SingleTrackVertexConstraint::constrain(), KalmanVertexTrackCompatibilityEstimator< N >::estimateNFittedTrack(), GsfVertexTrackCompatibilityEstimator::estimateNFittedTrack(), SequentialVertexFitter< N >::fit(), KinematicParticleVertexFitter::fit(), reco::GhostTrackVertexFinder::initialVertices(), reco::GhostTrackVertexFinder::mergeVertices(), reco::GhostTrackVertexFinder::reassignTracks(), reco::GhostTrackVertexFinder::recursiveMerge(), reco::GhostTrackVertexFinder::refitGhostTrack(), TrimmedVertexFinder::theWorst(), TrimmedVertexFinder::vertices(), and reco::GhostTrackVertexFinder::vertices().
{return theValid;}
CachingVertex< N >::operator TransientVertex | ( | ) | const |
Definition at line 238 of file CachingVertex.cc.
References i, j, TransientVertex::refittedTracks(), TransientVertex::tkToTkCovariance(), and TransientVertex::weightMap().
{ //If the vertex is invalid, return an invalid TV ! if (!isValid()) return TransientVertex(); typedef std::map<reco::TransientTrack, float> TransientTrackToFloatMap; // Construct Track vector std::vector<reco::TransientTrack> ttVect; ttVect.reserve(theTracks.size()); std::vector<reco::TransientTrack> refTTVect; TransientTrackToFloatMap theWeightMap; TTtoTTmap ttCovMap; // float theMinWeight = 0.5; for (typename std::vector<RefCountedVertexTrack>::const_iterator i = theTracks.begin(); i != theTracks.end(); ++i) { // discard tracks with too low weight // if ((**i).weight() < theMinWeight) continue; reco::TransientTrack t1((**i).linearizedTrack()->track()); ttVect.push_back(t1); //Fill in the weight map theWeightMap[t1] = (**i).weight(); //Fill in the tk-to-tk covariance map if (theCovMapAvailable) { for (typename std::vector<RefCountedVertexTrack>::const_iterator j = (i+1); j != theTracks.end(); ++j) { reco::TransientTrack t2((**j).linearizedTrack()->track()); ttCovMap[t1][t2] = tkToTkCovariance(*i, *j); } } if ((**i).refittedStateAvailable()) { refTTVect.push_back( (**i).refittedState()->transientTrack()) ; } } TransientVertex tv; if (withPrior) { tv = TransientVertex(priorVertexState(), vertexState(), ttVect, totalChiSquared(), degreesOfFreedom()); } else { tv = TransientVertex(vertexState(), ttVect, totalChiSquared(), degreesOfFreedom()); } tv.weightMap(theWeightMap); if (theCovMapAvailable) tv.tkToTkCovariance(ttCovMap); if (!refTTVect.empty()) tv.refittedTracks(refTTVect); return tv; }
GlobalPoint CachingVertex< N >::position | ( | void | ) | const |
Definition at line 149 of file CachingVertex.cc.
Referenced by FinalTreeBuilder::buildTree(), SingleTrackVertexConstraint::constrain(), SequentialVertexFitter< N >::fit(), KinematicVertex::KinematicVertex(), FinalTreeBuilder::momentumPart(), SequentialVertexSmoother< N >::smooth(), GsfVertexSmoother::smooth(), trackVertexCompat(), InvariantMassFromVertex::uncertainty(), MultiVertexFitter::updateSeeds(), MultiVertexFitter::updateWeights(), and reco::GhostTrackVertexFinder::vertexCompat().
{ return theVertexState.position(); }
GlobalError CachingVertex< N >::priorError | ( | ) | const [inline] |
Definition at line 94 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), and GsfVertexMerger::merge().
{return priorVertexState().error();}
GlobalPoint CachingVertex< N >::priorPosition | ( | ) | const [inline] |
Definition at line 93 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), and GsfVertexMerger::merge().
{return priorVertexState().position();}
VertexState CachingVertex< N >::priorVertexState | ( | ) | const [inline] |
Definition at line 87 of file CachingVertex.h.
Referenced by KalmanSmoothedVertexChi2Estimator< N >::estimate(), CachingVertex< 5 >::priorError(), CachingVertex< 5 >::priorPosition(), SequentialVertexSmoother< N >::smooth(), GsfVertexSmoother::smooth(), and KalmanVertexUpdator< N >::update().
{return thePriorVertexState;}
CachingVertex< N >::AlgebraicMatrixMM CachingVertex< N >::tkToTkCovariance | ( | const RefCountedVertexTrack | t1, |
const RefCountedVertexTrack | t2 | ||
) | const |
Track to track covariance
Definition at line 200 of file CachingVertex.cc.
Referenced by FinalTreeBuilder::momentumPart(), and InvariantMassFromVertex::uncertainty().
{ if (!tkToTkCovarianceIsAvailable()) { throw VertexException("CachingVertex::TkTkCovariance requested before been calculated"); } else { RefCountedVertexTrack tr1; RefCountedVertexTrack tr2; bool transp = false; if(t1 < t2) { tr1 = t1; tr2 = t2; } else { tr1 = t2; tr2 = t1; transp = true; } typename TrackToTrackMap::const_iterator it = theCovMap.find(tr1); if (it != theCovMap.end()) { const TrackMap & tm = it->second; typename TrackMap::const_iterator nit = tm.find(tr2); if (nit != tm.end()) { if (transp) return( ROOT::Math::Transpose(nit->second) ); else return( nit->second); } else { throw VertexException("CachingVertex::requested TkTkCovariance does not exist"); } } else { throw VertexException("CachingVertex::requested TkTkCovariance does not exist"); } } }
bool CachingVertex< N >::tkToTkCovarianceIsAvailable | ( | ) | const [inline] |
Definition at line 107 of file CachingVertex.h.
Referenced by InvariantMassFromVertex::invariantMass(), InvariantMassFromVertex::momentum(), and InvariantMassFromVertex::p4().
{ return theCovMapAvailable; }
float CachingVertex< N >::totalChiSquared | ( | ) | const [inline] |
Chi2, degrees of freedom. The latter may not be integer.
Definition at line 100 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), FinalTreeBuilder::buildTree(), KalmanVertexTrackCompatibilityEstimator< N >::estimateNFittedTrack(), GsfVertexTrackCompatibilityEstimator::estimateNFittedTrack(), fitChi2(), KinematicVertex::KinematicVertex(), GsfVertexMerger::merge(), SequentialVertexSmoother< N >::smooth(), and KalmanVertexUpdator< N >::update().
{ return theChiSquared; }
std::vector<RefCountedVertexTrack> CachingVertex< N >::tracks | ( | void | ) | const [inline] |
Definition at line 92 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), FinalTreeBuilder::buildTree(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), KalmanSmoothedVertexChi2Estimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), InvariantMassFromVertex::invariantMass(), GsfVertexMerger::merge(), reco::GhostTrackVertexFinder::mergeVertices(), InvariantMassFromVertex::momentum(), FinalTreeBuilder::momentumPart(), InvariantMassFromVertex::p4(), SequentialVertexSmoother< N >::smooth(), GsfVertexSmoother::smooth(), TrimmedVertexFinder::theWorst(), InvariantMassFromVertex::uncertainty(), KalmanVertexUpdator< N >::update(), and TrimmedVertexFinder::vertices().
{ return theTracks; }
VertexState CachingVertex< N >::vertexState | ( | ) | const [inline] |
Access methods
Definition at line 86 of file CachingVertex.h.
Referenced by GsfVertexUpdator::add(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), KalmanSmoothedVertexChi2Estimator< N >::estimate(), GsfVertexTrackCompatibilityEstimator::estimate(), SequentialVertexFitter< N >::fit(), GsfVertexMerger::merge(), reco::GhostTrackVertexFinder::mergeVertices(), SequentialVertexFitter< 5 >::reLinearizeTracks(), SequentialVertexSmoother< N >::smooth(), GsfVertexSmoother::smooth(), KalmanVertexTrackUpdator< N >::update(), KalmanVertexUpdator< N >::update(), and KVFHelper< N >::vertexChi2().
{return theVertexState;}
GlobalWeight CachingVertex< N >::weight | ( | ) | const |
Definition at line 163 of file CachingVertex.cc.
Referenced by SequentialVertexSmoother< N >::smooth().
{ return theVertexState.weight(); }
AlgebraicVector3 CachingVertex< N >::weightTimesPosition | ( | ) | const |
Definition at line 170 of file CachingVertex.cc.
{ return theVertexState.weightTimesPosition(); }
float CachingVertex< N >::theChiSquared [private] |
Definition at line 116 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::totalChiSquared().
TrackToTrackMap CachingVertex< N >::theCovMap [private] |
Definition at line 120 of file CachingVertex.h.
Referenced by CachingVertex< N >::CachingVertex().
bool CachingVertex< N >::theCovMapAvailable [private] |
Definition at line 121 of file CachingVertex.h.
Referenced by CachingVertex< N >::CachingVertex(), and CachingVertex< 5 >::tkToTkCovarianceIsAvailable().
float CachingVertex< N >::theNDF [mutable, private] |
Definition at line 117 of file CachingVertex.h.
bool CachingVertex< N >::theNDFAvailable [mutable, private] |
Definition at line 118 of file CachingVertex.h.
VertexState CachingVertex< N >::thePriorVertexState [mutable, private] |
Definition at line 122 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::priorVertexState().
std::vector<RefCountedVertexTrack> CachingVertex< N >::theTracks [private] |
Definition at line 119 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::tracks().
bool CachingVertex< N >::theValid [private] |
Definition at line 125 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::isValid().
VertexState CachingVertex< N >::theVertexState [mutable, private] |
Definition at line 115 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::vertexState().
bool CachingVertex< N >::withPrior [private] |
Definition at line 123 of file CachingVertex.h.
Referenced by CachingVertex< 5 >::hasPrior().