Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef _MultiVertexFitter_H_
0002 #define _MultiVertexFitter_H_
0003 
0004 #include <vector>
0005 #include <set>
0006 #include <utility>
0007 #include <map>
0008 #include "RecoVertex/VertexPrimitives/interface/CachingVertex.h"
0009 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0010 #include "RecoVertex/MultiVertexFit/interface/DefaultMVFAnnealing.h"
0011 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0012 #include "RecoVertex/LinearizationPointFinders/interface/DefaultLinearizationPointFinder.h"
0013 #include "RecoVertex/MultiVertexFit/interface/LinTrackCache.h"
0014 
0015 class MultiVertexFitter {
0016 public:
0017   /**
0018    *  \class MultiVertexFitter
0019    *  fits n vertices in parallel, associating weights for every
0020    *  track-vertex std::pair. The special constructor's arguments
0021    *  take precedence over the SimpleConfigurables.
0022    *
0023    *  SimpleConfigurables:
0024    *
0025    *  MultiVertexFitter:Debug = 0
0026    *  MultiVertexFitter:DisplacementLimit = 0.00001
0027    *  MultiVertexFitter:MaxIterations = 30
0028    *  MultiVertexFitter:ClaimLostVertices = true
0029    *  MultiVertexFitter:MinimumWeightFraction = 1e-6
0030    *  MultiVertexFitter:ReviveBelow = 0.3
0031    *  MultiVertexFitter:DiscardLightWeights = true
0032    *
0033    */
0034 
0035   MultiVertexFitter(const AnnealingSchedule &sched = DefaultMVFAnnealing(),
0036                     const LinearizationPointFinder &seeder = DefaultLinearizationPointFinder(),
0037                     float revive_below = -1.);
0038   MultiVertexFitter(const MultiVertexFitter &);
0039   ~MultiVertexFitter();
0040 
0041   typedef std::pair<reco::TransientTrack, float> TrackAndWeight;
0042   typedef std::map<int, double> SeedToWeightMap;
0043   typedef std::map<reco::TransientTrack, SeedToWeightMap> TrackAndSeedToWeightMap;
0044 
0045   /**
0046    * Supply simple clusters of reco::TransientTracks.
0047    * \paramname primaries: supply tracks which are hard coded
0048    * to the primary vertex.
0049    */
0050   std::vector<CachingVertex<5> > vertices(
0051       const std::vector<std::vector<reco::TransientTrack> > &,
0052       const std::vector<reco::TransientTrack> &primaries = std::vector<reco::TransientTrack>());
0053 
0054   /**
0055    *  Supply clusters of tracks with weights, association weights of the other
0056    *  vertices is considered zero.
0057    *  FIXME weights are currently ignored.
0058    * \paramname primaries: supply tracks which are hard coded
0059    * to the primary vertex.
0060    */
0061   std::vector<CachingVertex<5> > vertices(
0062       const std::vector<std::vector<TrackAndWeight> > &,
0063       const std::vector<reco::TransientTrack> &primaries = std::vector<reco::TransientTrack>());
0064 
0065   /**
0066    *  Supply full CachingVertices; CachingVertices are the first seeds.
0067    * \paramname primaries: supply tracks which are hard coded
0068    * to the primary vertex.
0069    */
0070   std::vector<CachingVertex<5> > vertices(
0071       const std::vector<CachingVertex<5> > &,
0072       const std::vector<reco::TransientTrack> &primaries = std::vector<reco::TransientTrack>());
0073 
0074   /**
0075    *  Same as above.
0076    */
0077   std::vector<CachingVertex<5> > vertices(
0078       const std::vector<TransientVertex> &,
0079       const std::vector<reco::TransientTrack> &primaries = std::vector<reco::TransientTrack>());
0080 
0081 private:
0082   std::vector<CachingVertex<5> > fit();
0083   void lostVertexClaimer();
0084   void updateWeights();
0085   bool updateSeeds();
0086 
0087   void clear();
0088   void createSeed(const std::vector<reco::TransientTrack> &tracks);
0089   void createSeed(const std::vector<TrackAndWeight> &tracks);
0090   void createPrimaries(const std::vector<reco::TransientTrack> &tracks);
0091   void printWeights() const;
0092   void printWeights(const reco::TransientTrack &) const;
0093   void printSeeds() const;
0094 
0095   int seedNr();
0096   void resetSeedNr();
0097 
0098 private:
0099   typedef CachingVertex<5>::RefCountedVertexTrack RefCountedVertexTrack;
0100   typedef ReferenceCountingPointer<LinearizedTrackState<5> > RefCountedLinearizedTrackState;
0101 
0102   // vertex seeds. Come with a seed number
0103   // makes the weight table simpler, faster,
0104   // and more reliable (I hope)
0105   std::vector<std::pair<int, CachingVertex<5> > > theVertexStates;
0106   int theVertexStateNr;
0107   float theReviveBelow;
0108   std::vector<reco::TransientTrack> theTracks;
0109   std::set<reco::TransientTrack> thePrimaries;
0110   AnnealingSchedule *theAssComp;
0111   LinearizationPointFinder *theSeeder;
0112   TrackAndSeedToWeightMap theWeights;
0113   LinTrackCache theCache;
0114 };
0115 
0116 #endif