Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-15 05:17:36

0001 #ifndef TrackingTools_TrackRefitter_TrackTransformerForCosmicMuons_H
0002 #define TrackingTools_TrackRefitter_TrackTransformerForCosmicMuons_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  *  Rec hits are ordered in rank of increasing |z| assuing muons are coming from the 
0014  *  top of the detector.
0015  *
0016  *
0017  *  $Date: 2009/01/15
0018  *  \original author R. Bellan - CERN <riccardo.bellan@cern.ch>
0019  *  modified for zed ordering by N. Kypreos - UF <nicholas.theodore.kypreos@cern.ch> 
0020  */
0021 
0022 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0023 #include "FWCore/Framework/interface/ConsumesCollector.h"
0024 #include "FWCore/Framework/interface/ESHandle.h"
0025 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0026 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0027 #include "MagneticField/Engine/interface/MagneticField.h"
0028 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0029 #include "TrackingTools/TrackRefitter/interface/RefitDirection.h"
0030 #include "TrackingTools/TrackRefitter/interface/RefitDirection.h"
0031 #include "TrackingTools/TrackRefitter/interface/TrackTransformerBase.h"
0032 #include "TrackingTools/TrackRefitter/interface/TrackTransformerBase.h"
0033 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0034 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0035 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0036 #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
0037 
0038 namespace edm {
0039   class ParameterSet;
0040   class EventSetup;
0041 }  // namespace edm
0042 namespace reco {
0043   class TransientTrack;
0044 }
0045 
0046 class TrajectoryFitter;
0047 class TrajectorySmoother;
0048 class Propagator;
0049 class TransientTrackingRecHitBuilder;
0050 class Trajectory;
0051 
0052 class TrackTransformerForCosmicMuons : public TrackTransformerBase {
0053 public:
0054   /// Constructor
0055   TrackTransformerForCosmicMuons(const edm::ParameterSet&, edm::ConsumesCollector);
0056 
0057   /// Destructor
0058   ~TrackTransformerForCosmicMuons() override;
0059 
0060   // Operations
0061 
0062   /// Convert a reco::Track into Trajectory
0063   std::vector<Trajectory> transform(const reco::Track&) const override;
0064 
0065   /// the magnetic field
0066   const MagneticField* magneticField() const { return &*theMGField; }
0067 
0068   /// the tracking geometry
0069   edm::ESHandle<GlobalTrackingGeometry> trackingGeometry() const { return theTrackingGeometry; }
0070 
0071   /// set the services needed by the TrackTransformer
0072   void setServices(const edm::EventSetup&) override;
0073 
0074   ///calculate the sum of slopes for the track
0075   bool SlopeSum(const TransientTrackingRecHit::ConstRecHitContainer&) const;
0076   float SumDy(const TransientTrackingRecHit::ConstRecHitContainer&) const;
0077 
0078   /// the refitter used to refit the reco::Track
0079   edm::ESHandle<TrajectoryFitter> fitter(bool, int, float) const;
0080 
0081   /// the smoother used to smooth the trajectory which came from the refitting step
0082   edm::ESHandle<TrajectorySmoother> smoother(bool, int, float) const;
0083 
0084   TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::TransientTrack& track) const;
0085 
0086 protected:
0087 private:
0088   const edm::ESGetToken<Propagator, TrackingComponentsRecord> theIOpropToken;
0089   const edm::ESGetToken<Propagator, TrackingComponentsRecord> theOIpropToken;
0090   const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> thGlobTrackGeoToken;
0091   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMFToken;
0092   const edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> theIOFitterToken;
0093   const edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> theOIFitterToken;
0094   const edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> theIOSmootherToken;
0095   const edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> theOISmootherToken;
0096   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTkRecHitBuildToken;
0097   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMuonRecHitBuildToken;
0098 
0099   edm::ESHandle<Propagator> thePropagatorIO;
0100   edm::ESHandle<Propagator> thePropagatorOI;
0101 
0102   edm::ESHandle<Propagator> propagator(bool, int, float) const;
0103 
0104   unsigned long long theCacheId_TC;
0105   unsigned long long theCacheId_GTG;
0106   unsigned long long theCacheId_MG;
0107   unsigned long long theCacheId_TRH;
0108 
0109   bool theRPCInTheFit;
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 #endif