CMS 3D CMS Logo

SequentialVertexFitter< N > Class Template Reference

Sequential vertex fitter, where the vertex is updated one track at the time. More...

#include <RecoVertex/VertexTools/interface/SequentialVertexFitter.h>

Inheritance diagram for SequentialVertexFitter< N >:

VertexFitter< N >

List of all members.

Public Types

typedef
ReferenceCountingPointer
< LinearizedTrackState< N > > 
RefCountedLinearizedTrackState
typedef
ReferenceCountingPointer
< RefittedTrackState< N > > 
RefCountedRefittedTrackState
typedef
ReferenceCountingPointer
< VertexTrack< N > > 
RefCountedVertexTrack

Public Member Functions

SequentialVertexFitterclone () const
 Fit vertex out of a VertexSeed.
const LinearizationPointFinderlinearizationPointFinder () const
 Method returning the fitted vertex, from a VertexSeed.
const AbstractLTSFactory< N > * linearizedTrackStateFactory () const
const float maxShift () const
const int maxStep () const
const edm::ParameterSet parameterSet () const
 SequentialVertexFitter (const SequentialVertexFitter &original)
 Copy constructor.
 SequentialVertexFitter (const edm::ParameterSet &pSet, const LinearizationPointFinder &linP, const VertexUpdator< N > &updator, const VertexSmoother< N > &smoother, const AbstractLTSFactory< N > &ltsf)
 Same as above, using a ParameterSet to set the convergence criteria.
 SequentialVertexFitter (const LinearizationPointFinder &linP, const VertexUpdator< N > &updator, const VertexSmoother< N > &smoother, const AbstractLTSFactory< N > &ltsf)
 Reimplemented constructors to use any kind of linearisation point finder, vertex updator and smoother.
void setMaximumDistance (float maxShift)
 Method to set the convergence criterion (the maximum distance between the vertex computed in the previous and the current iterations to consider the fit to have converged).
void setMaximumNumberOfIterations (int maxIterations)
 Method to set the maximum number of iterations to perform.
virtual CachingVertex< N > vertex (const std::vector< RefCountedVertexTrack > &tracks, const GlobalPoint &priorPos, const GlobalError &priorError) const
 Fit vertex out of a set of VertexTracks Uses the position and error for the prior estimate of the vertex.
virtual CachingVertex< N > vertex (const std::vector< reco::TransientTrack > &tracks, const GlobalPoint &priorPos, const GlobalError &priorError) const
 Fit vertex out of a set of RecTracks.
virtual CachingVertex< N > vertex (const vector< reco::TransientTrack > &tracks, const reco::BeamSpot &beamSpot) const
 Fit vertex out of a set of TransientTracks.
virtual CachingVertex< N > vertex (const std::vector< reco::TransientTrack > &tracks, const GlobalPoint &linPoint) const
 Fit vertex out of a set of RecTracks.
virtual CachingVertex< N > vertex (const std::vector< RefCountedVertexTrack > &tracks, const reco::BeamSpot &spot) const
 Same as above, only now also with BeamSpot!
virtual CachingVertex< N > vertex (const std::vector< RefCountedVertexTrack > &tracks) const
 Method returning the fitted vertex, from a container of VertexTracks.
virtual CachingVertex< N > vertex (const std::vector< reco::TransientTrack > &tracks) const
 Method returning the fitted vertex, from a container of reco::TransientTracks.
const VertexSmoother< N > * vertexSmoother () const
const VertexUpdator< N > * vertexUpdator () const
virtual ~SequentialVertexFitter ()

Protected Member Functions

 SequentialVertexFitter ()
 Default constructor.

Private Member Functions

CachingVertex< N > fit (const std::vector< RefCountedVertexTrack > &tracks, const VertexState priorVertex, bool withPrior) const
 The methode where the vrte fit is actually done.
bool hasNan (const GlobalPoint &point) const
 Checks whether any of the three coordinates is a Nan.
std::vector
< RefCountedVertexTrack
linearizeTracks (const std::vector< reco::TransientTrack > &tracks, const VertexState state) const
 Construct a container of VertexTrack from a set of RecTracks.
void readParameters ()
 Reads the configurable parameters.
std::vector
< RefCountedVertexTrack
reLinearizeTracks (const std::vector< RefCountedVertexTrack > &tracks, const VertexState state) const
 Construct new a container of VertexTrack with a new linearization point and vertex seed, from an existing set of VertexTrack, from which only the recTracks will be used.
void setDefaultParameters ()

Private Attributes

LinearizationPointFindertheLinP
const AbstractLTSFactory< N > * theLTrackFactory
float theMaxShift
int theMaxStep
edm::ParameterSet thePSet
VertexSmoother< N > * theSmoother
VertexUpdator< N > * theUpdator
VertexTrackFactory< N > theVTrackFactory


Detailed Description

template<unsigned int N>
class SequentialVertexFitter< N >

Sequential vertex fitter, where the vertex is updated one track at the time.

The fitter will iterate over the set of tracks until the transverse distance between vertices computed in the previous and the current iterations is less than the specified convergence criteria, or until the maximum number of iterations is reached. The transverse distance determines the linearization error. The default convergence criterion is 1 mm. The default maximum number of steps is 10. These parameters can be configured in .orcarc ( SequentialVertexFitter:maximumDistance and SequentialVertexFitter:maximumNumberOfIterations). After the vertex fit, the tracks can be refit with the additional constraint of the vertex position.

Definition at line 33 of file SequentialVertexFitter.h.


Member Typedef Documentation

template<unsigned int N>
typedef ReferenceCountingPointer<LinearizedTrackState<N> > SequentialVertexFitter< N >::RefCountedLinearizedTrackState

Definition at line 39 of file SequentialVertexFitter.h.

template<unsigned int N>
typedef ReferenceCountingPointer<RefittedTrackState<N> > SequentialVertexFitter< N >::RefCountedRefittedTrackState

Definition at line 37 of file SequentialVertexFitter.h.

template<unsigned int N>
typedef ReferenceCountingPointer<VertexTrack<N> > SequentialVertexFitter< N >::RefCountedVertexTrack

Definition at line 38 of file SequentialVertexFitter.h.


Constructor & Destructor Documentation

template<unsigned int N>
SequentialVertexFitter< N >::SequentialVertexFitter ( const LinearizationPointFinder linP,
const VertexUpdator< N > &  updator,
const VertexSmoother< N > &  smoother,
const AbstractLTSFactory< N > &  ltsf 
) [inline]

Reimplemented constructors to use any kind of linearisation point finder, vertex updator and smoother.

If no smoother is to be used, do not specify an instance for it.

Definition at line 23 of file SequentialVertexFitter.cc.

References SequentialVertexFitter< N >::setDefaultParameters().

00026                                        : 
00027   theLinP(linP.clone()), theUpdator(updator.clone()), 
00028   theSmoother(smoother.clone()), theLTrackFactory ( ltsf.clone() )
00029 {
00030   setDefaultParameters();
00031 }

template<unsigned int N>
SequentialVertexFitter< N >::SequentialVertexFitter ( const edm::ParameterSet pSet,
const LinearizationPointFinder linP,
const VertexUpdator< N > &  updator,
const VertexSmoother< N > &  smoother,
const AbstractLTSFactory< N > &  ltsf 
) [inline]

Same as above, using a ParameterSet to set the convergence criteria.

Definition at line 34 of file SequentialVertexFitter.cc.

References SequentialVertexFitter< N >::readParameters().

00037                                       : 
00038   thePSet(pSet), theLinP(linP.clone()), theUpdator(updator.clone()), 
00039   theSmoother(smoother.clone()), theLTrackFactory ( ltsf.clone() )
00040 {
00041   readParameters();
00042 }

template<unsigned int N>
SequentialVertexFitter< N >::SequentialVertexFitter ( const SequentialVertexFitter< N > &  original  )  [inline]

Copy constructor.

Definition at line 46 of file SequentialVertexFitter.cc.

References LinearizationPointFinder::clone(), SequentialVertexFitter< N >::linearizationPointFinder(), SequentialVertexFitter< N >::linearizedTrackStateFactory(), SequentialVertexFitter< N >::maxShift(), SequentialVertexFitter< N >::maxStep(), SequentialVertexFitter< N >::parameterSet(), SequentialVertexFitter< N >::theLinP, SequentialVertexFitter< N >::theLTrackFactory, SequentialVertexFitter< N >::theMaxShift, SequentialVertexFitter< N >::theMaxStep, SequentialVertexFitter< N >::thePSet, SequentialVertexFitter< N >::theSmoother, SequentialVertexFitter< N >::theUpdator, SequentialVertexFitter< N >::vertexSmoother(), and SequentialVertexFitter< N >::vertexUpdator().

00048 {
00049   thePSet = original.parameterSet();
00050   theLinP = original.linearizationPointFinder()->clone();
00051   theUpdator = original.vertexUpdator()->clone();
00052   theSmoother = original.vertexSmoother()->clone();
00053   theMaxShift = original.maxShift();
00054   theMaxStep = original.maxStep();
00055   theLTrackFactory = original.linearizedTrackStateFactory()->clone();
00056 }

template<unsigned int N>
SequentialVertexFitter< N >::~SequentialVertexFitter (  )  [inline, virtual]

Definition at line 60 of file SequentialVertexFitter.cc.

References SequentialVertexFitter< N >::theLinP, SequentialVertexFitter< N >::theLTrackFactory, SequentialVertexFitter< N >::theSmoother, and SequentialVertexFitter< N >::theUpdator.

00061 {
00062   delete theLinP;
00063   delete theUpdator;
00064   delete theSmoother;
00065   delete theLTrackFactory;
00066 }

template<unsigned int N>
SequentialVertexFitter< N >::SequentialVertexFitter (  )  [inline, protected]

Default constructor.

Is here, as we do not want anybody to use it.

Definition at line 191 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::clone().

00191 {}


Member Function Documentation

template<unsigned int N>
SequentialVertexFitter* SequentialVertexFitter< N >::clone (  )  const [inline, virtual]

Fit vertex out of a VertexSeed.

Implements VertexFitter< N >.

Definition at line 178 of file SequentialVertexFitter.h.

Referenced by GsfVertexFitter::GsfVertexFitter().

00178                                          {
00179     return new SequentialVertexFitter(* this);
00180   }

template<unsigned int N>
CachingVertex<N> SequentialVertexFitter< N >::fit ( const std::vector< RefCountedVertexTrack > &  tracks,
const VertexState  priorVertex,
bool  withPrior 
) const [private]

The methode where the vrte fit is actually done.

The seed is used as the prior estimate in the vertex fit (in case its error is large, it will have little influence on the fit. The tracks will be relinearized in case further loops are needed. tracks The tracks to use in the fit. priorVertex The prior estimate of the vertex

Returns:
The fitted vertex

Referenced by SequentialVertexFitter< N >::vertex().

template<unsigned int N>
bool SequentialVertexFitter< N >::hasNan ( const GlobalPoint point  )  const [inline, private]

Checks whether any of the three coordinates is a Nan.

Definition at line 242 of file SequentialVertexFitter.h.

00242                                                      {
00243     return (isnan(point.x())|| isnan(point.y()) || isnan(point.z()));
00244   }

template<unsigned int N>
const LinearizationPointFinder* SequentialVertexFitter< N >::linearizationPointFinder ( void   )  const [inline]

Method returning the fitted vertex, from a VertexSeed.

For the first loop, the position of the VertexSeed will be used as linearization point. If subsequent loops are needed, the new VertexTracks will be created with the last estimate of the vertex as linearization point. In case a non-sero error is given, the position and error of the VertexSeed will be used as prior estimate in the vertex fit.

Parameters:
seed The VertexSeed to fit.
Returns:
The fitted vertex Access methods

Definition at line 160 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00161   {return theLinP;}

template<unsigned int N>
const AbstractLTSFactory<N>* SequentialVertexFitter< N >::linearizedTrackStateFactory (  )  const [inline]

Definition at line 182 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00183   { return theLTrackFactory;}

template<unsigned int N>
std::vector<RefCountedVertexTrack> SequentialVertexFitter< N >::linearizeTracks ( const std::vector< reco::TransientTrack > &  tracks,
const VertexState  state 
) const [private]

Construct a container of VertexTrack from a set of RecTracks.

Parameters:
tracks The container of RecTracks.
seed The seed to use for the VertexTracks. This position will also be used as the new linearization point.
Returns:
The container of VertexTracks which are to be used in the next fit.

Referenced by SequentialVertexFitter< N >::vertex().

template<unsigned int N>
const float SequentialVertexFitter< N >::maxShift (  )  const [inline]

Definition at line 169 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00170   {return theMaxShift;}

template<unsigned int N>
const int SequentialVertexFitter< N >::maxStep (  )  const [inline]

Definition at line 172 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00173   {return theMaxStep;}

template<unsigned int N>
const edm::ParameterSet SequentialVertexFitter< N >::parameterSet (  )  const [inline]

Definition at line 175 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00176   {return thePSet;}

template<unsigned int N>
void SequentialVertexFitter< N >::readParameters (  )  [inline, private]

Reads the configurable parameters.

Definition at line 70 of file SequentialVertexFitter.cc.

References edm::ParameterSet::getParameter(), SequentialVertexFitter< N >::theMaxShift, SequentialVertexFitter< N >::theMaxStep, and SequentialVertexFitter< N >::thePSet.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter(), and SequentialVertexFitter< N >::setDefaultParameters().

00071 {
00072   theMaxShift = thePSet.getParameter<double>("maxDistance"); //0.01
00073   theMaxStep = thePSet.getParameter<int>("maxNbrOfIterations"); //10
00074 }

template<unsigned int N>
std::vector<RefCountedVertexTrack> SequentialVertexFitter< N >::reLinearizeTracks ( const std::vector< RefCountedVertexTrack > &  tracks,
const VertexState  state 
) const [private]

Construct new a container of VertexTrack with a new linearization point and vertex seed, from an existing set of VertexTrack, from which only the recTracks will be used.

Parameters:
tracks The original container of VertexTracks, from which the RecTracks will be extracted.
seed The seed to use for the VertexTracks. This position will also be used as the new linearization point.
Returns:
The container of VertexTracks which are to be used in the next fit.

template<unsigned int N>
void SequentialVertexFitter< N >::setDefaultParameters (  )  [inline, private]

Definition at line 77 of file SequentialVertexFitter.cc.

References edm::ParameterSet::addParameter(), SequentialVertexFitter< N >::readParameters(), and SequentialVertexFitter< N >::thePSet.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00078 {
00079   thePSet.addParameter<double>("maxDistance", 0.01);
00080   thePSet.addParameter<int>("maxNbrOfIterations", 10); //10
00081   readParameters();
00082 }

template<unsigned int N>
void SequentialVertexFitter< N >::setMaximumDistance ( float  maxShift  )  [inline]

Method to set the convergence criterion (the maximum distance between the vertex computed in the previous and the current iterations to consider the fit to have converged).

Definition at line 77 of file SequentialVertexFitter.h.

00077 {theMaxShift = maxShift;}

template<unsigned int N>
void SequentialVertexFitter< N >::setMaximumNumberOfIterations ( int  maxIterations  )  [inline]

Method to set the maximum number of iterations to perform.

Definition at line 84 of file SequentialVertexFitter.h.

00085         {theMaxStep = maxIterations;}

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< RefCountedVertexTrack > &  tracks,
const GlobalPoint priorPos,
const GlobalError priorError 
) const [virtual]

Fit vertex out of a set of VertexTracks Uses the position and error for the prior estimate of the vertex.

This position is not used to relinearize the tracks.

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< reco::TransientTrack > &  tracks,
const GlobalPoint priorPos,
const GlobalError priorError 
) const [virtual]

Fit vertex out of a set of RecTracks.

Uses the position as both the linearization point AND as prior estimate of the vertex position. The error is used for the weight of the prior estimate.

template<unsigned int N>
CachingVertex< N > SequentialVertexFitter< N >::vertex ( const vector< reco::TransientTrack > &  tracks,
const reco::BeamSpot beamSpot 
) const [inline, virtual]

Fit vertex out of a set of TransientTracks.

The specified BeamSpot will be used as priot, but NOT for the linearization. The specified LinearizationPointFinder will be used to find the linearization point.

Implements VertexFitter< N >.

Definition at line 145 of file SequentialVertexFitter.cc.

References error, SequentialVertexFitter< N >::fit(), LinearizationPointFinder::getLinearizationPoint(), insideTrackerBounds(), SequentialVertexFitter< N >::linearizeTracks(), and SequentialVertexFitter< N >::theLinP.

00147 {
00148   VertexState beamSpotState(beamSpot);
00149   vector<RefCountedVertexTrack> vtContainer;
00150 
00151   if (tracks.size() > 1) {
00152     // Linearization Point search if there are more than 1 track
00153     GlobalPoint linP = theLinP->getLinearizationPoint(tracks);
00154     if (!insideTrackerBounds(linP)) linP = GlobalPoint(0,0,0);
00155     AlgebraicSymMatrix we(3,1);
00156     GlobalError error(we*10000);
00157     VertexState lpState(linP, error);
00158     vtContainer = linearizeTracks(tracks, lpState);
00159   } else {
00160     // otherwise take the beamspot position.
00161     vtContainer = linearizeTracks(tracks, beamSpotState);
00162   }
00163 
00164   return fit(vtContainer, beamSpotState, true);
00165 }

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< reco::TransientTrack > &  tracks,
const GlobalPoint linPoint 
) const [virtual]

Fit vertex out of a set of RecTracks.

Uses the specified linearization point.

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< RefCountedVertexTrack > &  tracks,
const reco::BeamSpot spot 
) const [virtual]

Same as above, only now also with BeamSpot!

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< RefCountedVertexTrack > &  tracks  )  const [virtual]

Method returning the fitted vertex, from a container of VertexTracks.

For the first loop, the LinearizedTrackState contained in the VertexTracks will be used. If subsequent loops are needed, the new VertexTracks will be created with the last estimate of the vertex as linearization point. No prior vertex position will be used in the vertex fit.

Parameters:
tracks The container of VertexTracks to fit.
Returns:
The fitted vertex

template<unsigned int N>
virtual CachingVertex<N> SequentialVertexFitter< N >::vertex ( const std::vector< reco::TransientTrack > &  tracks  )  const [virtual]

Method returning the fitted vertex, from a container of reco::TransientTracks.

The linearization point will be searched with the given LP finder. No prior vertex position will be used in the vertex fit.

Parameters:
tracks The container of RecTracks to fit.
Returns:
The fitted vertex

Referenced by KalmanVertexFitter::vertex(), and GsfVertexFitter::vertex().

template<unsigned int N>
const VertexSmoother<N>* SequentialVertexFitter< N >::vertexSmoother (  )  const [inline]

Definition at line 166 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00167   {return theSmoother;}

template<unsigned int N>
const VertexUpdator<N>* SequentialVertexFitter< N >::vertexUpdator (  )  const [inline]

Definition at line 163 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter().

00164   {return theUpdator;}


Member Data Documentation

template<unsigned int N>
LinearizationPointFinder* SequentialVertexFitter< N >::theLinP [private]

Definition at line 251 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::linearizationPointFinder(), SequentialVertexFitter< N >::SequentialVertexFitter(), SequentialVertexFitter< N >::vertex(), and SequentialVertexFitter< N >::~SequentialVertexFitter().

template<unsigned int N>
const AbstractLTSFactory<N>* SequentialVertexFitter< N >::theLTrackFactory [private]

Definition at line 254 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::linearizedTrackStateFactory(), SequentialVertexFitter< N >::SequentialVertexFitter(), and SequentialVertexFitter< N >::~SequentialVertexFitter().

template<unsigned int N>
float SequentialVertexFitter< N >::theMaxShift [private]

Definition at line 247 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::maxShift(), SequentialVertexFitter< N >::readParameters(), SequentialVertexFitter< N >::SequentialVertexFitter(), and SequentialVertexFitter< 5 >::setMaximumDistance().

template<unsigned int N>
int SequentialVertexFitter< N >::theMaxStep [private]

Definition at line 248 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::maxStep(), SequentialVertexFitter< N >::readParameters(), SequentialVertexFitter< N >::SequentialVertexFitter(), and SequentialVertexFitter< 5 >::setMaximumNumberOfIterations().

template<unsigned int N>
edm::ParameterSet SequentialVertexFitter< N >::thePSet [private]

Definition at line 250 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< 5 >::parameterSet(), SequentialVertexFitter< N >::readParameters(), SequentialVertexFitter< N >::SequentialVertexFitter(), and SequentialVertexFitter< N >::setDefaultParameters().

template<unsigned int N>
VertexSmoother<N>* SequentialVertexFitter< N >::theSmoother [private]

Definition at line 253 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter(), SequentialVertexFitter< 5 >::vertexSmoother(), and SequentialVertexFitter< N >::~SequentialVertexFitter().

template<unsigned int N>
VertexUpdator<N>* SequentialVertexFitter< N >::theUpdator [private]

Definition at line 252 of file SequentialVertexFitter.h.

Referenced by SequentialVertexFitter< N >::SequentialVertexFitter(), SequentialVertexFitter< 5 >::vertexUpdator(), and SequentialVertexFitter< N >::~SequentialVertexFitter().

template<unsigned int N>
VertexTrackFactory<N> SequentialVertexFitter< N >::theVTrackFactory [private]

Definition at line 256 of file SequentialVertexFitter.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:31 2009 for CMSSW by  doxygen 1.5.4