File indexing completed on 2024-04-06 12:11:18
0001 #ifndef FastSimulation_Muons_FastTSGFromPropagation_H
0002 #define FastSimulation_Muons_FastTSGFromPropagation_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "RecoMuon/TrackerSeedGenerator/interface/TrackerSeedGenerator.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/Utilities/interface/EDGetToken.h"
0016 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0017 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0018 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0019 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
0020 #include "RecoMuon/TrackingTools/interface/MuonErrorMatrix.h"
0021 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0022 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
0023
0024 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0025 #include "MagneticField/Engine/interface/MagneticField.h"
0026 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0027
0028 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0029 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0030 #include "FWCore/Framework/interface/ConsumesCollector.h"
0031
0032 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHitCollection.h"
0033 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
0034
0035 #include <memory>
0036
0037 class LayerMeasurements;
0038 class Chi2MeasurementEstimator;
0039 class Propagator;
0040 class MeasurementTracker;
0041 class GeometricSearchTracker;
0042 class DirectTrackerNavigation;
0043 struct TrajectoryStateTransform;
0044 class SimTrack;
0045 class TrackerGeometry;
0046 class TrackerTopology;
0047 class TransientRecHitRecord;
0048 class CkfComponentsRecord;
0049 class TrackerRecoGeometryRecord;
0050
0051 class FastTSGFromPropagation : public TrackerSeedGenerator {
0052 public:
0053
0054 FastTSGFromPropagation(const edm::ParameterSet& pset, edm::ConsumesCollector& iC);
0055
0056 FastTSGFromPropagation(const edm::ParameterSet& par, const MuonServiceProxy*, edm::ConsumesCollector& iC);
0057
0058
0059 ~FastTSGFromPropagation() override;
0060
0061
0062 void trackerSeeds(const TrackCand&,
0063 const TrackingRegion&,
0064 const TrackerTopology* tTopo,
0065 std::vector<TrajectorySeed>&) override;
0066
0067
0068 void init(const MuonServiceProxy*) override;
0069
0070
0071 void setEvent(const edm::Event&) override;
0072
0073 private:
0074
0075 void stateOnDet(const TrajectoryStateOnSurface& ts, unsigned int detid, PTrajectoryStateOnDet& pts) const;
0076
0077 TrajectoryStateOnSurface innerState(const TrackCand&) const;
0078
0079 TrajectoryStateOnSurface outerTkState(const TrackCand&) const;
0080
0081 const TrajectoryStateUpdator* updator() const { return theUpdator.get(); }
0082
0083 const Chi2MeasurementEstimator* estimator() const { return theEstimator.get(); }
0084
0085 edm::ESHandle<Propagator> propagator() const { return theService->propagator(thePropagatorName); }
0086
0087
0088 TrajectorySeed createSeed(const TrajectoryStateOnSurface&, const DetId&) const;
0089
0090
0091 TrajectorySeed createSeed(const TrajectoryStateOnSurface& tsos,
0092 const edm::OwnVector<TrackingRecHit>& container,
0093 const DetId& id) const;
0094
0095
0096 void validMeasurements(std::vector<TrajectoryMeasurement>&) const;
0097
0098
0099 std::vector<TrajectoryMeasurement> findMeasurements(const DetLayer*, const TrajectoryStateOnSurface&) const;
0100
0101
0102 bool passSelection(const TrajectoryStateOnSurface&) const;
0103
0104 void getRescalingFactor(const TrackCand& staMuon);
0105
0106
0107 void adjust(FreeTrajectoryState&) const;
0108
0109
0110 void adjust(TrajectoryStateOnSurface&) const;
0111
0112 double dxyDis(const TrajectoryStateOnSurface& tsos) const;
0113
0114 double zDis(const TrajectoryStateOnSurface& tsos) const;
0115
0116 struct increasingEstimate {
0117 bool operator()(const TrajectoryMeasurement& lhs, const TrajectoryMeasurement& rhs) const {
0118 return lhs.estimate() < rhs.estimate();
0119 }
0120 };
0121
0122 struct isInvalid {
0123 bool operator()(const TrajectoryMeasurement& measurement) {
0124 return (((measurement).recHit() == nullptr) || !((measurement).recHit()->isValid()) ||
0125 !((measurement).updatedState().isValid()));
0126 }
0127 };
0128
0129 unsigned long long theCacheId_TG;
0130
0131 std::string theCategory;
0132
0133 std::unique_ptr<const DirectTrackerNavigation> theNavigation;
0134
0135 const TrackerGeometry* theGeometry;
0136
0137 const MuonServiceProxy* theService;
0138
0139 std::unique_ptr<const TrajectoryStateUpdator> theUpdator;
0140
0141 std::unique_ptr<const Chi2MeasurementEstimator> theEstimator;
0142
0143 double theMaxChi2;
0144
0145 double theFlexErrorRescaling;
0146
0147 double theFixedErrorRescaling;
0148
0149 bool theUseVertexStateFlag;
0150
0151 bool theUpdateStateFlag;
0152
0153 std::string theResetMethod;
0154
0155 bool theSelectStateFlag;
0156
0157 std::string thePropagatorName;
0158
0159 std::unique_ptr<MuonErrorMatrix> theErrorMatrixAdjuster;
0160
0161 bool theAdjustAtIp;
0162
0163 double theSigmaZ;
0164
0165 const edm::ParameterSet theConfig;
0166 edm::EDGetTokenT<edm::SimTrackContainer> theSimTrackCollectionToken_;
0167 edm::EDGetTokenT<FastTrackerRecHitCombinationCollection> recHitCombinationsToken_;
0168 edm::EDGetTokenT<reco::BeamSpot> beamSpot_;
0169 edm::EDGetTokenT<MeasurementTrackerEvent> theMeasurementTrackerEventToken_;
0170
0171 edm::Handle<reco::BeamSpot> theBeamSpot;
0172 edm::Handle<edm::SimTrackContainer> theSimTracks;
0173 edm::Handle<FastTrackerRecHitCombinationCollection> recHitCombinations;
0174 edm::Handle<MeasurementTrackerEvent> theMeasTrackerEvent;
0175 edm::ESHandle<TransientTrackingRecHitBuilder> theTTRHBuilder;
0176
0177
0178 edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theGeometryToken;
0179 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTTRHBuilderToken;
0180
0181
0182 edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> theTrackerToken;
0183 };
0184
0185 #endif