Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:08

0001 #include "DataFormats/TrackReco/interface/Track.h"
0002 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
0003 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0004 #include "MagneticField/Engine/interface/MagneticField.h"
0005 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/Utilities/interface/ESGetToken.h"
0009 #include "FWCore/Framework/interface/ConsumesCollector.h"
0010 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0011 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0012 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0013 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0014 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0015 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0016 
0017 #include "DuplicateTrackType.h"
0018 
0019 class dso_hidden TrackMerger {
0020 public:
0021   TrackMerger(const edm::ParameterSet &iConfig, edm::ConsumesCollector);
0022   ~TrackMerger();
0023 
0024   void init(const edm::EventSetup &iSetup);
0025 
0026   TrackCandidate merge(const reco::Track &inner, const reco::Track &outer, DuplicateTrackType duplicateType) const;
0027 
0028 private:
0029   edm::ESHandle<TrackerGeometry> theGeometry;
0030   edm::ESHandle<MagneticField> theMagField;
0031   bool useInnermostState_;
0032   bool debug_;
0033   std::string theBuilderName;
0034   edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder;
0035   edm::ESHandle<TrackerTopology> theTrkTopo;
0036   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geometryToken_;
0037   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magFieldToken_;
0038   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> builderToken_;
0039   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoToken_;
0040 
0041   void addSecondTrackHits(std::vector<const TrackingRecHit *> &hits, const reco::Track &outer) const;
0042   void sortByHitPosition(const GlobalVector &v,
0043                          const std::vector<const TrackingRecHit *> &hits,
0044                          TrackCandidate::RecHitContainer &ownHits) const;
0045 
0046   class GlobalMomentumSort {
0047   public:
0048     GlobalMomentumSort(const GlobalVector &dir) : dir_(dir) {}
0049     bool operator()(const TransientTrackingRecHit::RecHitPointer &hit1,
0050                     const TransientTrackingRecHit::RecHitPointer &hit2) const;
0051 
0052   private:
0053     GlobalVector dir_;
0054   };
0055   class MomentumSort {
0056   public:
0057     MomentumSort(const GlobalVector &dir, const TrackerGeometry *geometry) : dir_(dir), geom_(geometry) {}
0058     bool operator()(const TrackingRecHit *hit1, const TrackingRecHit *hit2) const;
0059 
0060   private:
0061     GlobalVector dir_;
0062     const TrackerGeometry *geom_;
0063   };
0064 };