Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:51

0001 #ifndef RecoMuon_CosmicMuonProducer_GlobalCosmicMuonTrajectoryBuilder_H
0002 #define RecoMuon_CosmicMuonProducer_GlobalCosmicMuonTrajectoryBuilder_H
0003 
0004 /** \file GlobalCosmicMuonTrajectoryBuilder
0005  *  class to build combined trajectory from cosmic tracks in tk and mu
0006  *
0007  *  \author Chang Liu  -  Purdue University
0008  */
0009 #include "FWCore/Framework/interface/ConsumesCollector.h"
0010 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
0011 #include "DataFormats/Common/interface/Handle.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0016 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0017 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0018 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
0019 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
0020 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
0021 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0022 #include "RecoMuon/CosmicMuonProducer/interface/CosmicMuonSmoother.h"
0023 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0024 #include "RecoMuon/GlobalTrackingTools/interface/GlobalMuonTrackMatcher.h"
0025 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0026 
0027 namespace edm {
0028   class ParameterSet;
0029   class Event;
0030   class EventSetup;
0031 }  // namespace edm
0032 
0033 class Trajectory;
0034 class TrajectoryMeasurement;
0035 class CosmicMuonUtilities;
0036 
0037 class GlobalCosmicMuonTrajectoryBuilder : public MuonTrajectoryBuilder {
0038 public:
0039   typedef TransientTrackingRecHit::RecHitContainer RecHitContainer;
0040   typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
0041   typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
0042   typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
0043 
0044   typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
0045   typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
0046   typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0047   typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer;
0048   typedef std::pair<const Trajectory*, reco::TrackRef> TrackCand;
0049 
0050   /// Constructor
0051   GlobalCosmicMuonTrajectoryBuilder(const edm::ParameterSet&,
0052                                     const MuonServiceProxy* service,
0053                                     edm::ConsumesCollector& iC);
0054 
0055   /// Destructor
0056   ~GlobalCosmicMuonTrajectoryBuilder() override;
0057 
0058   /// dummy implementation, unused in this class
0059   TrajectoryContainer trajectories(const TrajectorySeed&) override { return TrajectoryContainer{}; }
0060 
0061   const Propagator* propagator() const { return &*theService->propagator(thePropagatorName); }
0062 
0063   /// choose tk Track and build combined trajectories
0064   CandidateContainer trajectories(const TrackCand&) override;
0065 
0066   /// check if tk and muon Tracks are matched
0067   std::vector<TrackCand> match(const TrackCand&, const edm::Handle<reco::TrackCollection>&);
0068 
0069   void setEvent(const edm::Event&) override;
0070 
0071 private:
0072   void sortHits(ConstRecHitContainer&, ConstRecHitContainer&, ConstRecHitContainer&);
0073 
0074   ConstRecHitContainer getTransientRecHits(const reco::Track&) const;
0075 
0076   CosmicMuonSmoother* smoother() const { return theSmoother; }
0077 
0078   const CosmicMuonUtilities* utilities() const { return smoother()->utilities(); }
0079 
0080   bool isTraversing(const reco::Track& tk) const;
0081 
0082   const MuonServiceProxy* theService;
0083 
0084   CosmicMuonSmoother* theSmoother;
0085 
0086   GlobalMuonTrackMatcher* theTrackMatcher;
0087 
0088   std::string thePropagatorName;
0089   edm::EDGetTokenT<reco::TrackCollection> theTkTrackToken;
0090 
0091   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTrackerRecHitBuilderToken;
0092   edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
0093 
0094   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMuonRecHitBuilderToken;
0095   edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
0096 
0097   edm::Handle<reco::TrackCollection> theTrackerTracks;
0098 
0099   bool tkTrajsAvailable;
0100 
0101   const std::vector<Trajectory>* allTrackerTrajs;
0102 
0103   std::string category_;
0104 };
0105 #endif