File indexing completed on 2024-04-06 12:26:54
0001 #ifndef RecoMuon_GlobalTrackingTools_GlobalMuonRefitter_H
0002 #define RecoMuon_GlobalTrackingTools_GlobalMuonRefitter_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "DataFormats/Common/interface/Handle.h"
0018 #include "FWCore/Utilities/interface/InputTag.h"
0019 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Framework/interface/ConsumesCollector.h"
0022 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0023 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
0024 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0025 #include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
0026 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
0027 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
0028 #include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
0029 #include "DataFormats/GEMRecHit/interface/ME0SegmentCollection.h"
0030 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0031 #include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
0032 #include "DataFormats/MuonReco/interface/DYTInfo.h"
0033 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0034 #include "DynamicTruncation.h"
0035
0036 namespace reco {
0037 class TransientTrack;
0038 }
0039
0040 class TrajectoryStateOnSurface;
0041 class TrackerTopology;
0042
0043 class MuonDetLayerMeasurements;
0044 class MuonServiceProxy;
0045 class Trajectory;
0046
0047 class TrajectoryFitter;
0048 class TrajectoryFitterRecord;
0049 class TransientRecHitRecord;
0050
0051 class GlobalMuonRefitter {
0052 public:
0053 typedef TransientTrackingRecHit::RecHitContainer RecHitContainer;
0054 typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
0055 typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
0056 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
0057
0058 typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
0059 typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
0060 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0061 typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer;
0062
0063 typedef std::vector<Trajectory> TC;
0064 typedef TC::const_iterator TI;
0065
0066 enum subDetector { PXB = 1, PXF = 2, TIB = 3, TID = 4, TOB = 5, TEC = 6 };
0067
0068 public:
0069
0070 GlobalMuonRefitter(const edm::ParameterSet&, const MuonServiceProxy*, edm::ConsumesCollector&);
0071
0072
0073 virtual ~GlobalMuonRefitter();
0074
0075
0076 virtual void setEvent(const edm::Event&);
0077
0078
0079 void setServices(const edm::EventSetup&);
0080
0081
0082 std::vector<Trajectory> refit(const reco::Track& globalTrack,
0083 const int theMuonHitsOption,
0084 const TrackerTopology* tTopo) const;
0085
0086
0087 std::vector<Trajectory> refit(const reco::Track& globalTrack,
0088 const reco::TransientTrack track,
0089 const TransientTrackingRecHit::ConstRecHitContainer& allRecHitsTemp,
0090 const int theMuonHitsOption,
0091 const TrackerTopology* tTopo) const;
0092
0093
0094 std::vector<Trajectory> transform(const reco::Track& newTrack,
0095 const reco::TransientTrack track,
0096 const TransientTrackingRecHit::ConstRecHitContainer& recHitsForReFit) const;
0097
0098
0099 ConstRecHitContainer getRidOfSelectStationHits(const ConstRecHitContainer& hits, const TrackerTopology* tTopo) const;
0100
0101
0102 const reco::DYTInfo* getDYTInfo() { return dytInfo; }
0103
0104 protected:
0105 enum RefitDirection { insideOut, outsideIn, undetermined };
0106
0107
0108 void checkMuonHits(const reco::Track&, ConstRecHitContainer&, std::map<DetId, int>&) const;
0109
0110
0111 void getFirstHits(const reco::Track&, ConstRecHitContainer&, ConstRecHitContainer&) const;
0112
0113
0114 ConstRecHitContainer selectMuonHits(const Trajectory&, const std::map<DetId, int>&) const;
0115
0116
0117 void printHits(const ConstRecHitContainer&) const;
0118
0119 RefitDirection checkRecHitsOrdering(const ConstRecHitContainer&) const;
0120
0121 const MuonServiceProxy* service() const { return theService; }
0122
0123 protected:
0124 std::string theCategory;
0125 bool theTkTrajsAvailableFlag;
0126 float thePtCut;
0127
0128 private:
0129 int theMuonHitsOption;
0130 float theProbCut;
0131 int theHitThreshold;
0132 float theDTChi2Cut;
0133 float theCSCChi2Cut;
0134 float theRPCChi2Cut;
0135 float theGEMChi2Cut;
0136 float theME0Chi2Cut;
0137 bool theCosmicFlag;
0138
0139 edm::InputTag theDTRecHitLabel;
0140 edm::InputTag theCSCRecHitLabel;
0141 edm::InputTag theGEMRecHitLabel;
0142 edm::InputTag theME0RecHitLabel;
0143 edm::Handle<DTRecHitCollection> theDTRecHits;
0144 edm::Handle<CSCRecHit2DCollection> theCSCRecHits;
0145 edm::Handle<GEMRecHitCollection> theGEMRecHits;
0146 edm::Handle<ME0SegmentCollection> theME0RecHits;
0147 edm::EDGetTokenT<DTRecHitCollection> theDTRecHitToken;
0148 edm::EDGetTokenT<CSCRecHit2DCollection> theCSCRecHitToken;
0149 edm::EDGetTokenT<GEMRecHitCollection> theGEMRecHitToken;
0150 edm::EDGetTokenT<ME0SegmentCollection> theME0RecHitToken;
0151
0152 int theSkipStation;
0153 int theTrackerSkipSystem;
0154 int theTrackerSkipSection;
0155
0156 unsigned long long theCacheId_TRH;
0157
0158 std::string thePropagatorName;
0159
0160 bool theRPCInTheFit;
0161
0162 double theRescaleErrorFactor;
0163
0164 RefitDirection theRefitDirection;
0165
0166 std::vector<int> theDYTthrs;
0167 int theDYTselector;
0168 bool theDYTupdator;
0169 bool theDYTuseAPE;
0170 bool theDYTParThrsMode;
0171 edm::ParameterSet theDYTthrsParameters;
0172 reco::DYTInfo* dytInfo;
0173
0174 edm::ESGetToken<TrajectoryFitter, TrajectoryFitterRecord> theFitterToken;
0175 std::unique_ptr<TrajectoryFitter> theFitter;
0176
0177 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTrackerRecHitBuilderToken;
0178 const TransientTrackingRecHitBuilder* theTrackerRecHitBuilder;
0179 TkClonerImpl hitCloner;
0180
0181 edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theMuonRecHitBuilderToken;
0182 const TransientTrackingRecHitBuilder* theMuonRecHitBuilder;
0183
0184 const MuonServiceProxy* theService;
0185 const edm::EventSetup* theEventSetup;
0186 edm::EDGetTokenT<CSCSegmentCollection> CSCSegmentsToken;
0187 edm::EDGetTokenT<DTRecSegment4DCollection> all4DSegmentsToken;
0188 edm::Handle<CSCSegmentCollection> CSCSegments;
0189 edm::Handle<DTRecSegment4DCollection> all4DSegments;
0190
0191 DynamicTruncation::Config theDynamicTruncationConfig;
0192 };
0193 #endif