Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:17

0001 #ifndef RecoMuon_TrackingTools_MuonTrackLoader_H
0002 #define RecoMuon_TrackingTools_MuonTrackLoader_H
0003 
0004 /** \class MuonTrackLoader
0005  *  Class to load the tracks in the event, it provide some common functionalities
0006  *  both for all the RecoMuon producers.
0007  *
0008  *  \author R. Bellan - INFN Torino <riccardo.bellan@cern.ch>
0009  */
0010 
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 
0014 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0015 #include "DataFormats/TrackReco/interface/TrackExtraFwd.h"
0016 #include "DataFormats/Common/interface/Handle.h"
0017 #include "DataFormats/Common/interface/OrphanHandle.h"
0018 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0019 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0020 
0021 #include "FWCore/Utilities/interface/InputTag.h"
0022 
0023 #include "RecoMuon/TrackingTools/interface/MuonCandidate.h"
0024 #include "FWCore/Framework/interface/ConsumesCollector.h"
0025 
0026 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0027 #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
0028 
0029 namespace edm {
0030   class Event;
0031   class EventSetup;
0032   class ParameterSet;
0033 }  // namespace edm
0034 
0035 class Trajectory;
0036 class Propagator;
0037 class MuonServiceProxy;
0038 class MuonUpdatorAtVertex;
0039 class TrajectorySmoother;
0040 class ForwardDetLayer;
0041 class BarrelDetLayer;
0042 class TrackerTopology;
0043 class TransientRecHitRecord;
0044 
0045 class MuonTrackLoader {
0046 public:
0047   typedef MuonCandidate::TrajectoryContainer TrajectoryContainer;
0048   typedef MuonCandidate::CandidateContainer CandidateContainer;
0049 
0050   /// Constructor for the STA reco the args must be specify!
0051   MuonTrackLoader(edm::ParameterSet& parameterSet,
0052                   edm::ConsumesCollector& iC,
0053                   const MuonServiceProxy* service = nullptr);
0054 
0055   /// Destructor
0056   virtual ~MuonTrackLoader();
0057 
0058   /// Convert the trajectories into tracks and load the tracks in the event
0059   edm::OrphanHandle<reco::TrackCollection> loadTracks(
0060       TrajectoryContainer&, edm::Event&, const TrackerTopology& ttopo, const std::string& = "", bool = true);
0061 
0062   /// Convert the trajectories into tracks and load the tracks in the event
0063   edm::OrphanHandle<reco::TrackCollection> loadTracks(TrajectoryContainer&,
0064                                                       edm::Event&,
0065                                                       std::vector<bool>&,
0066                                                       const TrackerTopology& ttopo,
0067                                                       const std::string& = "",
0068                                                       bool = true);
0069 
0070   /// Convert the trajectories into tracks and load the tracks in the event
0071   edm::OrphanHandle<reco::TrackCollection> loadTracks(TrajectoryContainer&,
0072                                                       edm::Event&,
0073                                                       const std::vector<std::pair<Trajectory*, reco::TrackRef> >&,
0074                                                       edm::Handle<reco::TrackCollection> const& trackHandle,
0075                                                       const TrackerTopology& ttopo,
0076                                                       const std::string& = "",
0077                                                       bool = true);
0078 
0079   /// Convert the trajectories into tracks and load the tracks in the event
0080   edm::OrphanHandle<reco::MuonTrackLinksCollection> loadTracks(CandidateContainer&,
0081                                                                edm::Event&,
0082                                                                const TrackerTopology& ttopo);
0083 
0084 private:
0085   static std::vector<const TrackingRecHit*> unpackHit(const TrackingRecHit& hit);
0086 
0087   /// Build a track at the PCA WITHOUT any vertex constriant
0088   std::pair<bool, reco::Track> buildTrackAtPCA(const Trajectory& trajectory, const reco::BeamSpot&) const;
0089 
0090   /// Takes a track at the PCA and applies the vertex constriant
0091   std::pair<bool, reco::Track> buildTrackUpdatedAtPCA(const reco::Track& trackAtPCA, const reco::BeamSpot&) const;
0092 
0093   reco::TrackExtra buildTrackExtra(const Trajectory&) const;
0094 
0095   const MuonServiceProxy* theService;
0096 
0097   bool theUpdatingAtVtx;
0098   std::unique_ptr<MuonUpdatorAtVertex> theUpdatorAtVtx;
0099 
0100   bool theTrajectoryFlag;
0101 
0102   bool theSmoothingStep;
0103   edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> theSmootherToken;
0104   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTrackerRecHitBuilderToken;
0105   std::unique_ptr<TrajectorySmoother> theSmoother;
0106   TkClonerImpl hitCloner;
0107 
0108   edm::InputTag theBeamSpotInputTag;
0109   edm::EDGetTokenT<reco::BeamSpot> theBeamSpotToken;
0110 
0111   /// Label for L2SeededTracks
0112   std::string theL2SeededTkLabel;
0113   bool thePutTkTrackFlag;
0114   bool theSmoothTkTrackFlag;
0115   bool theAllowNoVtxFlag;
0116 };
0117 #endif