Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef _RecoVertex_TrimmedVertexFinder_H_
0002 #define _RecoVertex_TrimmedVertexFinder_H_
0003 
0004 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
0005 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0006 #include "RecoVertex/VertexPrimitives/interface/CachingVertex.h"
0007 #include "RecoVertex/VertexPrimitives/interface/VertexFitter.h"
0008 #include "RecoVertex/VertexPrimitives/interface/VertexUpdator.h"
0009 #include "RecoVertex/VertexPrimitives/interface/VertexTrackCompatibilityEstimator.h"
0010 #include <vector>
0011 
0012 /** Algorithm to find 0 or 1 cluster of tracks that are compatible 
0013  *  with a single vertex, among `remain`, the initial set of tracks. 
0014  *  A track is declared incompatible with the vertex if the chi-squared 
0015  *  probability between the track and the vertex is smaller than `min`. 
0016  *  The algorithm applied is:  <BR>
0017  *    1) fit a single vertex with all tracks;  <BR>
0018  *    2) remove incompatible tracks 1 by 1 starting from 
0019  *  the least compatible one.  <BR>
0020  *  On output, `remain` contains the incompatible tracks. 
0021  *  This algorithm has 1 parameter that can be set at runtime 
0022  *  via the corresponding set() method: 
0023  *   - "trackCompatibilityCut" (default: 0.05)
0024  *  which defines the probability below which a track is considered 
0025  *  incompatible with a vertex. 
0026  */
0027 
0028 class TrimmedVertexFinder {
0029 public:
0030   typedef ReferenceCountingPointer<VertexTrack<5> > RefCountedVertexTrack;
0031   typedef ReferenceCountingPointer<LinearizedTrackState<5> > RefCountedLinearizedTrackState;
0032 
0033   TrimmedVertexFinder(const VertexFitter<5>* vf,
0034                       const VertexUpdator<5>* vu,
0035                       const VertexTrackCompatibilityEstimator<5>* ve);
0036 
0037   /** Copy constructor, needed to handle copy of pointer data members correctly
0038    */
0039   TrimmedVertexFinder(const TrimmedVertexFinder& other);
0040   ~TrimmedVertexFinder();
0041 
0042   /** Make 0 or 1 vertex 
0043    *  On output, `remain` contains the incompatible tracks
0044    */
0045   std::vector<TransientVertex> vertices(std::vector<reco::TransientTrack>& remain) const;
0046 
0047   /** Same as above,
0048    * only with the extra information of the beamspot
0049    * constraint.
0050    */
0051   std::vector<TransientVertex> vertices(std::vector<reco::TransientTrack>& remain,
0052                                         const reco::BeamSpot& s,
0053                                         bool use_beamspot = true) const;
0054 
0055   /** Access to parameter
0056    */
0057   float trackCompatibilityCut() const { return theMinProb; }
0058 
0059   /** Set parameter
0060    */
0061   void setTrackCompatibilityCut(float cut) { theMinProb = cut; }
0062 
0063   /** clone method
0064    */
0065   TrimmedVertexFinder* clone() const { return new TrimmedVertexFinder(*this); }
0066 
0067 private:
0068   // finds least compatible track
0069   // returns vtxTracks.end() if all tracks are compatible
0070   //
0071   std::vector<RefCountedVertexTrack>::iterator theWorst(const CachingVertex<5>& vtx,
0072                                                         std::vector<RefCountedVertexTrack>& vtxTracks,
0073                                                         float cut) const;
0074 
0075   VertexFitter<5>* theFitter;
0076   VertexUpdator<5>* theUpdator;
0077   VertexTrackCompatibilityEstimator<5>* theEstimator;
0078   float theMinProb;
0079 };
0080 
0081 #endif