CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TransientVertex Class Reference

#include <TransientVertex.h>

List of all members.

Public Types

typedef std::map
< reco::TransientTrack, float > 
TransientTrackToFloatMap

Public Member Functions

float degreesOfFreedom () const
bool hasPrior () const
bool hasRefittedTracks () const
bool hasTrackWeight () const
bool isValid () const
float normalisedChiSquared () const
 operator reco::Vertex () const
reco::TransientTrack originalTrack (const reco::TransientTrack &refTrack) const
std::vector< reco::TransientTrackoriginalTracks () const
GlobalPoint position () const
GlobalError positionError () const
GlobalError priorError () const
GlobalPoint priorPosition () const
reco::TransientTrack refittedTrack (const reco::TransientTrack &track) const
std::vector< reco::TransientTrackrefittedTracks () const
void refittedTracks (const std::vector< reco::TransientTrack > &refittedTracks)
void tkToTkCovariance (const TTtoTTmap covMap)
AlgebraicMatrix33 tkToTkCovariance (const reco::TransientTrack &t1, const reco::TransientTrack &t2) const
bool tkToTkCovarianceIsAvailable () const
float totalChiSquared () const
float trackWeight (const reco::TransientTrack &track) const
 TransientVertex (const GlobalPoint &priorPos, const GlobalError &priorErr, const GlobalPoint &pos, const GlobalError &posError, const std::vector< reco::TransientTrack > &tracks, float chi2, float ndf)
 TransientVertex (const GlobalPoint &priorPos, const GlobalError &priorErr, const GlobalPoint &pos, const GlobalError &posError, const std::vector< reco::TransientTrack > &tracks, float chi2)
 TransientVertex (const GlobalPoint &pos, const GlobalError &posError, const std::vector< reco::TransientTrack > &tracks, float chi2, float ndf)
 TransientVertex (const GlobalPoint &pos, const GlobalError &posError, const std::vector< reco::TransientTrack > &tracks, float chi2)
 TransientVertex (const VertexState &prior, const VertexState &state, const std::vector< reco::TransientTrack > &tracks, float chi2, float ndf)
 TransientVertex (const VertexState &state, const std::vector< reco::TransientTrack > &tracks, float chi2)
 TransientVertex (const VertexState &state, const std::vector< reco::TransientTrack > &tracks, float chi2, float ndf)
 TransientVertex ()
 TransientVertex (const VertexState &prior, const VertexState &state, const std::vector< reco::TransientTrack > &tracks, float chi2)
VertexState vertexState () const
TransientTrackToFloatMap weightMap () const
void weightMap (const TransientTrackToFloatMap &theMap)

Private Attributes

float theChi2
TTtoTTmap theCovMap
bool theCovMapAvailable
float theNDF
std::vector< reco::TransientTracktheOriginalTracks
VertexState thePriorVertexState
std::vector< reco::TransientTracktheRefittedTracks
VertexState theVertexState
TransientTrackToFloatMap theWeightMap
bool theWeightMapIsAvailable
bool vertexValid
bool withPrior
bool withRefittedTracks

Detailed Description

Definition at line 17 of file TransientVertex.h.


Member Typedef Documentation

Definition at line 21 of file TransientVertex.h.


Constructor & Destructor Documentation

TransientVertex::TransientVertex ( )

Empty constructor, produces invalid vertex

Definition at line 9 of file TransientVertex.cc.

TransientVertex::TransientVertex ( const GlobalPoint pos,
const GlobalError posError,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2 
)

Constructor defining the RecVertex by its 3D position and position uncertainty, its associated tracks and its chi-squared. The number of degrees of freedom is equal to 2*nb of tracks - 3.

Definition at line 16 of file TransientVertex.cc.

References theNDF, and theOriginalTracks.

                                                                           :
    theVertexState(pos, posError), theOriginalTracks(tracks),
    theChi2(chi2), theNDF(0), vertexValid(true), withPrior(false),
  theWeightMapIsAvailable(false), theCovMapAvailable(false), 
  withRefittedTracks(false)
{
  theNDF = 2.*theOriginalTracks.size() - 3.;
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const GlobalPoint pos,
const GlobalError posError,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2,
float  ndf 
)

Constructor defining the RecVertex by its 3D position and position uncertainty, its associated tracks, its chi-squared and its number of degrees of freedom. The ndf can be a float.

Definition at line 28 of file TransientVertex.cc.

                                                                                      :
    theVertexState(pos, posError), theOriginalTracks(tracks),
    theChi2(chi2), theNDF(ndf), vertexValid(true), withPrior(false),
    theWeightMapIsAvailable(false), theCovMapAvailable(false), 
    withRefittedTracks(false)
{
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const GlobalPoint priorPos,
const GlobalError priorErr,
const GlobalPoint pos,
const GlobalError posError,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2 
)

Constructor defining the RecVertex by the prior, the vertex 3D position and uncertainty, the associated tracks and the chi-squared. Since the prior brings information on 3 coordinates, the number of degrees of freedom is equal to 2*nb of tracks.

Definition at line 39 of file TransientVertex.cc.

References theNDF, and theOriginalTracks.

                                                                           :
    thePriorVertexState(priorPos, priorErr), theVertexState(pos, posError),
    theOriginalTracks(tracks), theChi2(chi2), theNDF(0), vertexValid(true),
    withPrior(true), theWeightMapIsAvailable(false), theCovMapAvailable(false),
    withRefittedTracks(false)
{
  theNDF = 2.*theOriginalTracks.size();
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const GlobalPoint priorPos,
const GlobalError priorErr,
const GlobalPoint pos,
const GlobalError posError,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2,
float  ndf 
)

Constructor defining the RecVertex by the prior, the vertex 3D position and uncertainty, the associated tracks, the chi-squared and the number of degrees of freedom. The ndf can be a float.

Definition at line 52 of file TransientVertex.cc.

                                                                                      :
    thePriorVertexState(priorPos, priorErr), theVertexState(pos, posError),
    theOriginalTracks(tracks), theChi2(chi2), theNDF(ndf), vertexValid(true),
    withPrior(true), theWeightMapIsAvailable(false), theCovMapAvailable(false),
    withRefittedTracks(false)
{
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const VertexState state,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2 
)

Constructor defining the RecVertex by its 3D position and position uncertainty, its associated tracks and its chi-squared. The number of degrees of freedom is equal to 2*nb of tracks - 3.

Definition at line 64 of file TransientVertex.cc.

References theNDF, and theOriginalTracks.

TransientVertex::TransientVertex ( const VertexState state,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2,
float  ndf 
)

Constructor defining the RecVertex by its 3D position and position uncertainty, its associated tracks, its chi-squared and its number of degrees of freedom. The ndf can be a float.

Definition at line 75 of file TransientVertex.cc.

                                                                                      : 
    theVertexState(state), theOriginalTracks(tracks),
    theChi2(chi2), theNDF(ndf), vertexValid(true), withPrior(false),
    theWeightMapIsAvailable(false), theCovMapAvailable(false), 
    withRefittedTracks(false) 
{
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const VertexState prior,
const VertexState state,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2 
)

Constructor defining the RecVertex by the prior, the vertex 3D position and uncertainty, the associated tracks and the chi-squared. Since the prior brings information on 3 coordinates, the number of degrees of freedom is equal to 2*nb of tracks.

Definition at line 86 of file TransientVertex.cc.

References theNDF, and theOriginalTracks.

                                                 :
    thePriorVertexState(prior), theVertexState(state),
    theOriginalTracks(tracks), theChi2(chi2), theNDF(0), vertexValid(true),
    withPrior(true), theWeightMapIsAvailable(false), theCovMapAvailable(false),
    withRefittedTracks(false)
{
  theNDF = 2.*theOriginalTracks.size();
  //  addTracks(tracks);
}
TransientVertex::TransientVertex ( const VertexState prior,
const VertexState state,
const std::vector< reco::TransientTrack > &  tracks,
float  chi2,
float  ndf 
)

Constructor defining the RecVertex by the prior, the vertex 3D position and uncertainty, the associated tracks, the chi-squared and the number of degrees of freedom. The ndf can be a float.

Definition at line 100 of file TransientVertex.cc.

                                            :
    thePriorVertexState(prior), theVertexState(state),
    theOriginalTracks(tracks), theChi2(chi2), theNDF(ndf), vertexValid(true),
    withPrior(true), theWeightMapIsAvailable(false),
    theCovMapAvailable(false), withRefittedTracks(false)
{
  //  addTracks(tracks);
}

Member Function Documentation

float TransientVertex::degreesOfFreedom ( ) const [inline]
bool TransientVertex::hasPrior ( ) const [inline]

Definition at line 117 of file TransientVertex.h.

References withPrior.

Referenced by AdaptiveVertexReconstructor::cleanUp().

{ return withPrior; }
bool TransientVertex::hasRefittedTracks ( ) const [inline]

Returns true if at for at least one of the original tracks, the refitted track is available

Definition at line 149 of file TransientVertex.h.

References withRefittedTracks.

Referenced by AdaptiveVertexReconstructor::cleanUp(), V0Fitter::fitAll(), and HPSPFRecoTauAlgorithm::refitThreeProng().

{ return withRefittedTracks; }
bool TransientVertex::hasTrackWeight ( ) const [inline]

Returns true if the track-weights are available.

Definition at line 180 of file TransientVertex.h.

References theWeightMapIsAvailable.

Referenced by PrimaryVertexValidation::analyze().

bool TransientVertex::isValid ( void  ) const [inline]
float TransientVertex::normalisedChiSquared ( ) const [inline]
TransientVertex::operator reco::Vertex ( ) const

Definition at line 206 of file TransientVertex.cc.

References reco::Vertex::add(), and i.

{
   //If the vertex is invalid, return an invalid TV !
  if (!isValid()) return Vertex();

  Vertex vertex(Vertex::Point(theVertexState.position()),
//      RecoVertex::convertError(theVertexState.error()), 
        theVertexState.error().matrix_new(), 
        totalChiSquared(), degreesOfFreedom(), theOriginalTracks.size() );
  for (std::vector<TransientTrack>::const_iterator i = theOriginalTracks.begin();
       i != theOriginalTracks.end(); ++i) {
//     const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>((*i).basicTransientTrack());
//     if ((ttt!=0) && (ttt->persistentTrackRef().isNonnull()))
//     {
//       TrackRef tr = ttt->persistentTrackRef();
//       TrackBaseRef tbr(tr);
      if (withRefittedTracks) {
        
        vertex.add((*i).trackBaseRef(), refittedTrack(*i).track(), trackWeight ( *i ) );
      } else { 
        vertex.add((*i).trackBaseRef(), trackWeight ( *i ) );
      }
    //}
  }
  return vertex;
}
TransientTrack TransientVertex::originalTrack ( const reco::TransientTrack 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 182 of file TransientVertex.cc.

References spr::find(), pos, theOriginalTracks, and theRefittedTracks.

{
  if (theRefittedTracks.empty())
        throw VertexException("No refitted tracks stored in vertex");
  std::vector<TransientTrack>::const_iterator it =
        find(theRefittedTracks.begin(), theRefittedTracks.end(), refTrack);
  if (it==theRefittedTracks.end())
        throw VertexException("Refitted track not found in list");
  size_t pos = it - theRefittedTracks.begin();
  return theOriginalTracks[pos];
}
std::vector<reco::TransientTrack> TransientVertex::originalTracks ( ) const [inline]
GlobalPoint TransientVertex::position ( void  ) const [inline]
GlobalError TransientVertex::positionError ( ) const [inline]
GlobalError TransientVertex::priorError ( ) const [inline]

Definition at line 116 of file TransientVertex.h.

References VertexState::error(), and thePriorVertexState.

Referenced by AdaptiveVertexReconstructor::cleanUp().

{ return thePriorVertexState.error(); }
GlobalPoint TransientVertex::priorPosition ( ) const [inline]
TransientTrack TransientVertex::refittedTrack ( const reco::TransientTrack 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 194 of file TransientVertex.cc.

References spr::find(), pos, theOriginalTracks, and theRefittedTracks.

Referenced by PFDisplacedVertexFinder::fitVertexFromSeed().

{
  if (theRefittedTracks.empty())
        throw VertexException("No refitted tracks stored in vertex");
  std::vector<TransientTrack>::const_iterator it =
        find(theOriginalTracks.begin(), theOriginalTracks.end(), track);
  if (it==theOriginalTracks.end())
        throw VertexException("Track not found in list");
  size_t pos = it - theOriginalTracks.begin();
  return theRefittedTracks[pos];
}
void TransientVertex::refittedTracks ( const std::vector< reco::TransientTrack > &  refittedTracks)

Method to set the refitted tracks used to make the vertex.

std::vector<reco::TransientTrack> TransientVertex::refittedTracks ( ) const [inline]

Access to the refitted tracks used to make the vertex. Returns track container by value.

Definition at line 155 of file TransientVertex.h.

References theRefittedTracks.

Referenced by AdaptiveVertexReconstructor::cleanUp(), V0Fitter::fitAll(), CachingVertex< N >::operator TransientVertex(), HPSPFRecoTauAlgorithm::refitThreeProng(), CandCommonVertexFitterBase::set(), and PFCandCommonVertexFitterBase::set().

                                                       {
    return theRefittedTracks;
  }
AlgebraicMatrix33 TransientVertex::tkToTkCovariance ( const reco::TransientTrack t1,
const reco::TransientTrack t2 
) const

Returns the Track-to-track covariance matrix for two specified tracks. In case these do not exist, or one of the tracks does not belong to the vertex, an exception is thrown.

Definition at line 151 of file TransientVertex.cc.

References theCovMap, and theCovMapAvailable.

Referenced by CachingVertex< N >::operator TransientVertex().

{
  if (!theCovMapAvailable) {
   throw VertexException("TransientVertex::Track-to-track covariance matrices not available");
  }
  const TransientTrack* tr1;
  const TransientTrack* tr2;
  if (t1<t2) {
    tr1 = &t1;
    tr2 = &t2;
  } else {
    tr1 = &t2;
    tr2 = &t1;
  }
  TTtoTTmap::const_iterator it = theCovMap.find(*tr1);
  if (it !=  theCovMap.end()) {
    const TTmap & tm = it->second;
    TTmap::const_iterator nit = tm.find(*tr2);
    if (nit != tm.end()) {
      return( nit->second);
    }
    else {
      throw VertexException("TransientVertex::requested Track-to-track covariance matrix does not exist");
    }
  }
  else {
    throw VertexException("TransientVertex::requested Track-to-track covariance matrix does not exist");
  }
}
void TransientVertex::tkToTkCovariance ( const TTtoTTmap  covMap)

Definition at line 130 of file TransientVertex.cc.

References theCovMap, and theCovMapAvailable.

{
  theCovMap = covMap;
  theCovMapAvailable = true;
}
bool TransientVertex::tkToTkCovarianceIsAvailable ( ) const [inline]

Returns true if the Track-to-track covariance matrices have been calculated.

Definition at line 199 of file TransientVertex.h.

References theCovMapAvailable.

{ return theCovMapAvailable; }
float TransientVertex::totalChiSquared ( ) const [inline]
float TransientVertex::trackWeight ( const reco::TransientTrack track) const

Returns the weight with which a track has been used in the fit. If the track is not present in the list, it is obviously not used, and this method returns a weight of 0. If this information has not been provided at construction, a weight of 1.0 is assumed for all tracks used and present in the originalTracks() std::vector.

Definition at line 136 of file TransientVertex.cc.

References spr::find(), theOriginalTracks, theWeightMap, and theWeightMapIsAvailable.

Referenced by PrimaryVertexValidation::analyze(), AdaptiveVertexReconstructor::cleanUp(), edm::RefVector< TrackingRecHitCollection >::erase(), and PFDisplacedVertexFinder::fitVertexFromSeed().

                                                                     {
  if (!theWeightMapIsAvailable) {
    std::vector<TransientTrack>::const_iterator foundTrack = find(theOriginalTracks.begin(), 
                theOriginalTracks.end(), track);
    return ((foundTrack != theOriginalTracks.end()) ? 1. : 0.);
  }
  TransientTrackToFloatMap::const_iterator it = theWeightMap.find(track);
  if (it !=  theWeightMap.end()) {
    return(it->second);
  }
  return 0.;

}
VertexState TransientVertex::vertexState ( ) const [inline]

Constructor defining the RecVertex by its 3D position and position uncertainty, its associated tracks, its chi-squared and its number of degrees of freedom, and the track weights. The ndf can be a float. Access methods

Definition at line 112 of file TransientVertex.h.

References theVertexState.

Referenced by AdaptiveVertexReconstructor::cleanUp().

{ return theVertexState; }
void TransientVertex::weightMap ( const TransientTrackToFloatMap theMap)

Definition at line 112 of file TransientVertex.cc.

References theWeightMap, and theWeightMapIsAvailable.

{
  theWeightMap = theMap;
  theWeightMapIsAvailable = true;
//   removeTracks(); // remove trackrefs from reco::Vertex
//   addTracks( theOriginalTracks );
}
TransientTrackToFloatMap TransientVertex::weightMap ( ) const [inline]

Member Data Documentation

float TransientVertex::theChi2 [private]

Definition at line 224 of file TransientVertex.h.

Referenced by totalChiSquared().

Definition at line 229 of file TransientVertex.h.

Referenced by tkToTkCovariance().

Definition at line 227 of file TransientVertex.h.

Referenced by tkToTkCovariance(), and tkToTkCovarianceIsAvailable().

float TransientVertex::theNDF [private]

Definition at line 225 of file TransientVertex.h.

Referenced by degreesOfFreedom(), and TransientVertex().

Definition at line 215 of file TransientVertex.h.

Referenced by priorError(), and priorPosition().

Definition at line 221 of file TransientVertex.h.

Referenced by originalTrack(), refittedTrack(), and refittedTracks().

Definition at line 216 of file TransientVertex.h.

Referenced by position(), positionError(), and vertexState().

Definition at line 230 of file TransientVertex.h.

Referenced by trackWeight(), and weightMap().

Definition at line 227 of file TransientVertex.h.

Referenced by hasTrackWeight(), trackWeight(), and weightMap().

Definition at line 226 of file TransientVertex.h.

Referenced by isValid().

Definition at line 227 of file TransientVertex.h.

Referenced by hasPrior().

Definition at line 228 of file TransientVertex.h.

Referenced by hasRefittedTracks().