Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:39

0001 #ifndef TrackingTools_TrackRefitter_TrackTransformerForGlobalCosmicMuons_H
0002 #define TrackingTools_TrackRefitter_TrackTransformerForGlobalCosmicMuons_H
0003 
0004 /** \class TrackTransformer
0005  *  This class takes a reco::Track and refits the rechits inside it.
0006  *  The final result is a Trajectory refitted and smoothed.
0007  *  To make the refitting (and the smoothing) the usual KF tools are used.
0008  *
0009  *  CAVEAT: till now (it will be changed in the near future) the class stores the
0010  *  pointers to the services, therefore EACH event the setServices(const edm::EventSetup&)
0011  *  method MUST be called in the code in which the TrackTransformer is used.
0012  *
0013  *  \author R. Bellan - CERN <riccardo.bellan@cern.ch>
0014  */
0015 
0016 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0017 #include "FWCore/Framework/interface/ConsumesCollector.h"
0018 #include "FWCore/Framework/interface/ESHandle.h"
0019 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0020 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0021 #include "MagneticField/Engine/interface/MagneticField.h"
0022 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0023 #include "TrackingTools/TrackRefitter/interface/RefitDirection.h"
0024 #include "TrackingTools/TrackRefitter/interface/TrackTransformerBase.h"
0025 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0026 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0027 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0028 #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
0029 
0030 namespace edm {
0031   class ParameterSet;
0032   class EventSetup;
0033 }  // namespace edm
0034 namespace reco {
0035   class TransientTrack;
0036 }
0037 
0038 class TrajectoryFitter;
0039 class TrajectorySmoother;
0040 class Propagator;
0041 class TransientTrackingRecHitBuilder;
0042 class Trajectory;
0043 class TrackerTopology;
0044 
0045 class TrackTransformerForGlobalCosmicMuons : public TrackTransformerBase {
0046 public:
0047   /// Constructor
0048   TrackTransformerForGlobalCosmicMuons(const edm::ParameterSet&, edm::ConsumesCollector);
0049 
0050   /// Destructor
0051   ~TrackTransformerForGlobalCosmicMuons() override;
0052 
0053   // Operations
0054 
0055   /// Convert a reco::Track into Trajectory
0056   std::vector<Trajectory> transform(const reco::Track&) const override;
0057 
0058   /// the magnetic field
0059   const MagneticField* magneticField() const { return &*theMGField; }
0060 
0061   /// the tracking geometry
0062   edm::ESHandle<GlobalTrackingGeometry> trackingGeometry() const { return theTrackingGeometry; }
0063 
0064   /// set the services needed by the TrackTransformer
0065   void setServices(const edm::EventSetup&) override;
0066 
0067   /// the refitter used to refit the reco::Track
0068   edm::ESHandle<TrajectoryFitter> fitter(bool) const;
0069 
0070   /// the smoother used to smooth the trajectory which came from the refitting step
0071   edm::ESHandle<TrajectorySmoother> smoother(bool) const;
0072 
0073   TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::TransientTrack& track) const;
0074 
0075   /// check (via options) if this is a tracker rec hit for removal
0076   bool TrackerKeep(DetId id) const;
0077   /// check (via options) if this is a muon rec hit for removal
0078   bool MuonKeep(DetId id) const;
0079 
0080 protected:
0081 private:
0082   const edm::ESGetToken<Propagator, TrackingComponentsRecord> theIOpropToken;
0083   const edm::ESGetToken<Propagator, TrackingComponentsRecord> theOIpropToken;
0084   const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> thGlobTrackGeoToken;
0085   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMFToken;
0086   const edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> theIOFitterToken;
0087   const edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> theOIFitterToken;
0088   const edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> theIOSmootherToken;
0089   const edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> theOISmootherToken;
0090   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTkRecHitBuildToken;
0091   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMuonRecHitBuildToken;
0092   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTopologyToken;
0093 
0094   edm::ESHandle<Propagator> thePropagatorIO;
0095   edm::ESHandle<Propagator> thePropagatorOI;
0096 
0097   edm::ESHandle<Propagator> propagator(bool) const;
0098 
0099   unsigned long long theCacheId_TC;
0100   unsigned long long theCacheId_GTG;
0101   unsigned long long theCacheId_MG;
0102   unsigned long long theCacheId_TRH;
0103 
0104   bool theRPCInTheFit;
0105   int theSkipStationDT;
0106   int theSkipStationCSC;
0107   int theSkipWheelDT;
0108   int theTrackerSkipSystem;
0109   int theTrackerSkipSection;
0110 
0111   edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
0112   edm::ESHandle<MagneticField> theMGField;
0113 
0114   edm::ESHandle<TrajectoryFitter> theFitterIO;
0115   edm::ESHandle<TrajectoryFitter> theFitterOI;
0116 
0117   edm::ESHandle<TrajectorySmoother> theSmootherIO;
0118   edm::ESHandle<TrajectorySmoother> theSmootherOI;
0119 
0120   std::string theTrackerRecHitBuilderName;
0121   edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
0122 
0123   std::string theMuonRecHitBuilderName;
0124   edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
0125 
0126   const TrackerTopology* tTopo_;
0127 };
0128 #endif