File indexing completed on 2024-04-06 12:31:39
0001 #ifndef TrackingTools_TrackRefitter_TrackTransformer_H
0002 #define TrackingTools_TrackRefitter_TrackTransformer_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "TrackingTools/TrackRefitter/interface/TrackTransformerBase.h"
0017
0018 #include "TrackingTools/TrackRefitter/interface/RefitDirection.h"
0019
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include "FWCore/Utilities/interface/ESGetToken.h"
0023
0024 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0025 #include "MagneticField/Engine/interface/MagneticField.h"
0026 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0027 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0028
0029 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0030
0031 namespace reco {
0032 class TransientTrack;
0033 }
0034
0035 class TrajectoryFitter;
0036 class TrajectorySmoother;
0037 class Propagator;
0038 class TransientTrackingRecHitBuilder;
0039 class Trajectory;
0040 class GlobalTrackingGeometryRecord;
0041 class IdealMagneticFieldRecord;
0042 class TrajectoryFitterRecord;
0043 class TrackingComponentsRecord;
0044 class TransientRecHitRecord;
0045
0046 class TrackTransformer final : public TrackTransformerBase {
0047 public:
0048
0049 explicit TrackTransformer(const edm::ParameterSet&, edm::ConsumesCollector&);
0050 explicit TrackTransformer(const edm::ParameterSet& parameterSet, edm::ConsumesCollector&& iC)
0051 : TrackTransformer(parameterSet, iC) {}
0052
0053
0054 ~TrackTransformer() override;
0055
0056
0057 static void fillPSetDescription(edm::ParameterSetDescription& descriptions,
0058 bool doPredictionsOnly = false,
0059 const std::string& fitter = "KFFitterForRefitInsideOut",
0060 const std::string& smoother = "KFSmootherForRefitInsideOut",
0061 const std::string& propagator = "SmartPropagatorAnyRK",
0062 const std::string& refitDirection = "alongMomentum",
0063 bool refitRPCHits = true,
0064 const std::string& trackerRecHitBuilder = "WithTrackAngle",
0065 const std::string& muonRecHitBuilder = "MuonRecHitBuilder",
0066 const std::string& mtdRecHitBuilder = "MTDRecHitBuilder");
0067
0068
0069
0070
0071 std::vector<Trajectory> transform(const reco::Track&) const override;
0072
0073
0074 std::vector<Trajectory> transform(const reco::TrackRef&) const;
0075
0076
0077 std::vector<Trajectory> transform(const reco::TransientTrack&, TransientTrackingRecHit::ConstRecHitContainer&) const;
0078
0079
0080 const MagneticField* magneticField() const { return &*theMGField; }
0081
0082
0083 edm::ESHandle<GlobalTrackingGeometry> trackingGeometry() const { return theTrackingGeometry; }
0084
0085
0086 void setServices(const edm::EventSetup&) override;
0087
0088
0089 std::unique_ptr<TrajectoryFitter> const& refitter() const { return theFitter; }
0090
0091
0092 std::unique_ptr<TrajectorySmoother> const& smoother() const { return theSmoother; }
0093
0094 TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits(const reco::TransientTrack& track) const;
0095
0096 private:
0097 RefitDirection::GeometricalDirection checkRecHitsOrdering(TransientTrackingRecHit::ConstRecHitContainer const&) const;
0098
0099 unsigned long long theCacheId_TRH = 0;
0100
0101 const bool theRPCInTheFit;
0102
0103 const bool theDoPredictionsOnly;
0104 const RefitDirection theRefitDirection;
0105
0106 edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> theTrackingGeometryToken;
0107 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMGFieldToken;
0108 edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
0109 edm::ESHandle<MagneticField> theMGField;
0110
0111 const std::string theFitterName;
0112 edm::ESGetToken<TrajectoryFitter, TrajectoryFitterRecord> theFitterToken;
0113 std::unique_ptr<TrajectoryFitter> theFitter;
0114
0115 const std::string theSmootherName;
0116 edm::ESGetToken<TrajectorySmoother, TrajectoryFitterRecord> theSmootherToken;
0117 std::unique_ptr<TrajectorySmoother> theSmoother;
0118
0119 const std::string thePropagatorName;
0120 edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropagatorToken;
0121 edm::ESHandle<Propagator> const& propagator() const { return thePropagator; }
0122 edm::ESHandle<Propagator> thePropagator;
0123
0124 const std::string theTrackerRecHitBuilderName;
0125 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTrackerRecHitBuilderToken;
0126 const TransientTrackingRecHitBuilder* theTrackerRecHitBuilder;
0127 TkClonerImpl hitCloner;
0128
0129 const std::string theMuonRecHitBuilderName;
0130 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMuonRecHitBuilderToken;
0131 edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
0132
0133 const std::string theMTDRecHitBuilderName;
0134 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMTDRecHitBuilderToken;
0135 bool theMtdAvailable;
0136 edm::ESHandle<TransientTrackingRecHitBuilder> theMTDRecHitBuilder;
0137 };
0138 #endif