# Project CMSSW displayed by LXR

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

```0001 #ifndef CrossingPtBasedLinearizationPointFinder_H
0002 #define CrossingPtBasedLinearizationPointFinder_H
0003
0004 #include "RecoVertex/VertexTools/interface/LinearizationPointFinder.h"
0005 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0006 #include "RecoVertex/VertexTools/interface/ModeFinder3d.h"
0007 #include "RecoVertex/VertexTools/interface/RecTracksDistanceMatrix.h"
0008
0009 /** A linearization point finder. It works the following way:
0010    *  1. Calculate in an optimal way 'n_pairs' different crossing points.
0011    *     Optimal in this context means the following:
0012    *     a. Try to use as many different tracks as possible;
0013    *        avoid using the same track all the time.
0014    *     b. Use the most energetic tracks.
0015    *     c. Try not to group the most energetic tracks together.
0016    *        Try to group more energetic tracks with less energetic tracks.
0017    *        We assume collimated bundles here, so this is why.
0018    *     d. Perform optimally. Do not sort more tracks (by total energy, see b)
0019    *        than necessary.
0020    *     e. If n_pairs >= (number of all possible combinations),
0021    *        do not leave any combinations out.
0022    *     ( a. and e. are almost but not entirely fulfilled in the current impl )
0023    *  2. Apply theAlgo on the n points.
0024    */
0025
0026 class CrossingPtBasedLinearizationPointFinder : public LinearizationPointFinder {
0027 public:
0028   /** \param n_pairs: how many track pairs will be considered (maximum)
0029    *                  a value of -1 means full combinatorics.
0030    */
0031   CrossingPtBasedLinearizationPointFinder(const ModeFinder3d &algo, const signed int n_pairs = 5);
0032
0033   /** This constructor exploits the information stored in a
0034    *  RecTracksDistanceMatrix object.
0035    *  \param n_pairs: how many track pairs will be considered (maximum)
0036    *                  a value of -1 means full combinatorics.
0037    */
0038
0039   CrossingPtBasedLinearizationPointFinder(const RecTracksDistanceMatrix *m,
0040                                           const ModeFinder3d &algo,
0041                                           const signed int n_pairs = -1);
0042
0043   CrossingPtBasedLinearizationPointFinder(const CrossingPtBasedLinearizationPointFinder &);
0044
0045   ~CrossingPtBasedLinearizationPointFinder() override;
0046
0047   /** Method giving back the Initial Linearization Point.
0048  */
0049   GlobalPoint getLinearizationPoint(const std::vector<reco::TransientTrack> &) const override;
0050   GlobalPoint getLinearizationPoint(const std::vector<FreeTrajectoryState> &) const override;
0051
0052   CrossingPtBasedLinearizationPointFinder *clone() const override {
0053     return new CrossingPtBasedLinearizationPointFinder(*this);
0054   };
0055
0056 protected:
0057   const bool useMatrix;
0058   signed int theNPairs;
0059   const RecTracksDistanceMatrix *theMatrix;
0060
0061 private:
0062   /// calls (*theAglo) (input)
0063   /// can optionally save input / output in .root file
0064   GlobalPoint find(const std::vector<std::pair<GlobalPoint, float> > &) const;
0065
0066 private:
0067   ModeFinder3d *theAlgo;
0068
0069   /** Private struct to order tracks by momentum
0070    */
0071   struct CompareTwoTracks {
0072     int operator()(const reco::TransientTrack &a, const reco::TransientTrack &b) {
0073       return a.initialFreeState().momentum().mag() > b.initialFreeState().momentum().mag();
0074       //       return a.p() > b.p();
0075     };
0076   };
0077   std::vector<reco::TransientTrack> getBestTracks(const std::vector<reco::TransientTrack> &) const;
0078   GlobalPoint useFullMatrix(const std::vector<reco::TransientTrack> &) const;
0079   GlobalPoint useAllTracks(const std::vector<reco::TransientTrack> &) const;
0080 };
0081
0082 #endif```