Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:07

0001 #ifndef _GsfVertexSmoother_H_
0002 #define _GsfVertexSmoother_H_
0003 
0004 #include "RecoVertex/VertexPrimitives/interface/VertexSmoother.h"
0005 #include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexUpdator.h"
0006 #include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexMerger.h"
0007 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexUpdator.h"
0008 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexTrackUpdator.h"
0009 #include "RecoVertex/KalmanVertexFit/interface/KalmanSmoothedVertexChi2Estimator.h"
0010 #include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexWeightCalculator.h"
0011 #include "RecoVertex/VertexTools/interface/VertexTrackFactory.h"
0012 #include "DataFormats/GeometryCommonDetAlgo/interface/DeepCopyPointerByClone.h"
0013 #include "RecoVertex/KalmanVertexFit/interface/KVFHelper.h"
0014 
0015 /**
0016  *  The class which handles the track-refit and smoothed chi**2 calculations
0017  *  for the Gaussian Sum vertex fit. 
0018  *  The track-to-track covariance matrix calculation is not yet done.
0019  */
0020 
0021 class GsfVertexSmoother : public VertexSmoother<5> {
0022 public:
0023   /**
0024    *  The constructor
0025    *  \param limit Specifies whether the number of components of the vertex
0026    *             should be limited
0027    */
0028 
0029   GsfVertexSmoother(bool limit, const GsfVertexMerger* merger);
0030 
0031   ~GsfVertexSmoother() override {}
0032 
0033   /**
0034    *  Methode which will refit the tracks with the vertex constraint
0035    *  and calculate the smoothed vertex chi**2
0036    *  \param vertex is the final estimate of the vertex, as given by the 
0037    *    last update.
0038    *  \return the final vertex estimate, with all the supplementary information
0039    */
0040   CachingVertex<5> smooth(const CachingVertex<5>& vertex) const override;
0041 
0042   /**
0043    *  Access methods
0044    */
0045 
0046   const VertexUpdator<5>* vertexUpdator() const { return &theUpdator; }
0047 
0048   /**
0049    * Clone method 
0050    */
0051   VertexSmoother<5>* clone() const override { return new GsfVertexSmoother(*this); }
0052 
0053 private:
0054   typedef CachingVertex<5>::RefCountedVertexTrack RefCountedVertexTrack;
0055   typedef VertexTrack<5>::RefCountedLinearizedTrackState RefCountedLinearizedTrackState;
0056   typedef VertexTrack<5>::RefCountedRefittedTrackState RefCountedRefittedTrackState;
0057   typedef VertexTrack<5>::AlgebraicMatrix3M AlgebraicMatrix3M;
0058   typedef VertexTrack<5>::AlgebraicSymMatrixOO AlgebraicSymMatrixOO;
0059 
0060   typedef std::vector<VertexState> VSC;
0061   typedef std::vector<RefCountedLinearizedTrackState> LTC;
0062   typedef std::pair<double, double> VtxTrkChi2Pair;
0063   typedef std::pair<RefCountedRefittedTrackState, double> TrackWeightPair;
0064   typedef std::pair<RefCountedRefittedTrackState, VtxTrkChi2Pair> TrackChi2Pair;
0065   typedef std::pair<TrackWeightPair, VtxTrkChi2Pair> RefittedTrackComponent;
0066 
0067   VertexState meanVertex(const VertexState& vertexA, const VertexState& vertexB) const;
0068 
0069   TrackChi2Pair vertexAndTrackUpdate(const VertexState& oldVertex,
0070                                      const RefCountedVertexTrack track,
0071                                      const GlobalPoint& referencePosition) const;
0072 
0073   RefittedTrackComponent createNewComponent(const VertexState& oldVertex,
0074                                             const RefCountedLinearizedTrackState linTrack,
0075                                             float weight) const;
0076 
0077   TrackChi2Pair assembleTrackComponents(const std::vector<RefittedTrackComponent>& trackComponents,
0078                                         const GlobalPoint& referencePosition) const;
0079 
0080   /**
0081    *  Methode which calculates the chi**2 between the prior and the fitted 
0082    *  vertex.
0083    *  This method takes into account multiple states.
0084    *  \param priorVertex The prior vertex state
0085    *  \param fittedVertex The fitted vertex state
0086    */
0087   double priorVertexChi2(const VertexState priorVertex, const VertexState fittedVertex) const;
0088 
0089   bool limitComponents;
0090   DeepCopyPointerByClone<GsfVertexMerger> theMerger;
0091   GsfVertexUpdator theUpdator;
0092   KalmanVertexUpdator<5> kalmanVertexUpdator;
0093   KalmanSmoothedVertexChi2Estimator<5> smoothedChi2Estimator;
0094   KalmanVertexTrackUpdator<5> theVertexTrackUpdator;
0095   GsfVertexWeightCalculator theWeightCalculator;
0096   VertexTrackFactory<5> theVTFactory;
0097   KVFHelper<5> helper;
0098 };
0099 
0100 #endif