Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-22 02:39:53

0001 #ifndef RecoMuon_TrackerSeedGenerator_TSGFromPropagation_H
0002 #define RecoMuon_TrackerSeedGenerator_TSGFromPropagation_H
0003 
0004 /** \class TSGFromPropagation
0005  *  Tracker Seed Generator by propagating and updating a standAlone muon
0006  *  to the first 2 (or 1) rechits it meets in tracker system 
0007  *
0008  *  \author Chang Liu - Purdue University 
0009  */
0010 
0011 #include "RecoMuon/TrackerSeedGenerator/interface/TrackerSeedGenerator.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0014 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0015 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0016 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
0017 #include "RecoMuon/TrackingTools/interface/MuonErrorMatrix.h"
0018 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0019 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
0020 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0021 #include "FWCore/Framework/interface/ConsumesCollector.h"
0022 
0023 #include <memory>
0024 
0025 class Chi2MeasurementEstimator;
0026 class Propagator;
0027 class MeasurementTracker;
0028 class GeometricSearchTracker;
0029 class DirectTrackerNavigation;
0030 struct TrajectoryStateTransform;
0031 class TrackerTopology;
0032 class TrackerRecoGeometryRecord;
0033 
0034 class TSGFromPropagation : public TrackerSeedGenerator {
0035 public:
0036   /// constructor
0037   TSGFromPropagation(const edm::ParameterSet& pset, edm::ConsumesCollector& iC);
0038 
0039   TSGFromPropagation(const edm::ParameterSet& par, edm::ConsumesCollector& iC, const MuonServiceProxy*);
0040 
0041   /// destructor
0042   ~TSGFromPropagation() override;
0043 
0044   /// generate seed(s) for a track
0045   void trackerSeeds(const TrackCand&,
0046                     const TrackingRegion&,
0047                     const TrackerTopology*,
0048                     std::vector<TrajectorySeed>&) override;
0049 
0050   /// initialize
0051   void init(const MuonServiceProxy*) override;
0052 
0053   /// set an event
0054   void setEvent(const edm::Event&) override;
0055 
0056 private:
0057   TrajectoryStateOnSurface innerState(const TrackCand&) const;
0058 
0059   TrajectoryStateOnSurface outerTkState(const TrackCand&) const;
0060 
0061   const TrajectoryStateUpdator* updator() const { return theUpdator.get(); }
0062 
0063   const Chi2MeasurementEstimator* estimator() const { return theEstimator.get(); }
0064 
0065   edm::ESHandle<Propagator> propagator() const { return theService->propagator(thePropagatorName); }
0066 
0067   /// create a hitless seed from a trajectory state
0068   TrajectorySeed createSeed(const TrajectoryStateOnSurface&, const DetId&) const;
0069 
0070   /// create a seed from a trajectory state
0071   TrajectorySeed createSeed(const TrajectoryStateOnSurface& tsos,
0072                             const edm::OwnVector<TrackingRecHit>& container,
0073                             const DetId& id) const;
0074 
0075   /// select valid measurements
0076   void validMeasurements(std::vector<TrajectoryMeasurement>&) const;
0077 
0078   /// look for measurements on the first compatible layer
0079   std::vector<TrajectoryMeasurement> findMeasurements(const DetLayer*, const TrajectoryStateOnSurface&) const;
0080 
0081   /// check some quantity and beam-spot compatibility and decide to continue
0082   bool passSelection(const TrajectoryStateOnSurface&) const;
0083 
0084   void getRescalingFactor(const TrackCand& staMuon);
0085 
0086   /// adjust the error matrix of the FTS
0087   void adjust(FreeTrajectoryState&) const;
0088 
0089   /// adjust the error matrix of the TSOS
0090   void adjust(TrajectoryStateOnSurface&) const;
0091 
0092   double dxyDis(const TrajectoryStateOnSurface& tsos) const;
0093 
0094   double zDis(const TrajectoryStateOnSurface& tsos) const;
0095 
0096   struct increasingEstimate {
0097     bool operator()(const TrajectoryMeasurement& lhs, const TrajectoryMeasurement& rhs) const {
0098       return lhs.estimate() < rhs.estimate();
0099     }
0100   };
0101 
0102   struct isInvalid {
0103     bool operator()(const TrajectoryMeasurement& measurement) {
0104       return (((measurement).recHit() == nullptr) || !((measurement).recHit()->isValid()) ||
0105               !((measurement).updatedState().isValid()));
0106     }
0107   };
0108 
0109   unsigned long long theCacheId_TG;
0110 
0111   const std::string theCategory;
0112 
0113   edm::Handle<MeasurementTrackerEvent> theMeasTrackerEvent;
0114 
0115   std::unique_ptr<const DirectTrackerNavigation> theNavigation;
0116 
0117   const MuonServiceProxy* theService;
0118 
0119   std::unique_ptr<const TrajectoryStateUpdator> theUpdator;
0120 
0121   std::unique_ptr<const Chi2MeasurementEstimator> theEstimator;
0122 
0123   const double theMaxChi2;
0124 
0125   double theFlexErrorRescaling;
0126 
0127   const double theFixedErrorRescaling;
0128 
0129   const bool theUseVertexStateFlag;
0130 
0131   const bool theUpdateStateFlag;
0132 
0133   enum class ResetMethod { discrete, fixed, matrix };
0134   const ResetMethod theResetMethod;
0135 
0136   const bool theSelectStateFlag;
0137 
0138   const std::string thePropagatorName;
0139 
0140   std::unique_ptr<MuonErrorMatrix> theErrorMatrixAdjuster;
0141 
0142   const double theSigmaZ;
0143 
0144   const edm::ParameterSet theErrorMatrixPset;
0145 
0146   edm::Handle<reco::BeamSpot> beamSpot;
0147   const edm::EDGetTokenT<reco::BeamSpot> theBeamSpotToken;
0148   const edm::EDGetTokenT<MeasurementTrackerEvent> theMeasurementTrackerEventToken;
0149   const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> theTrackerToken;
0150 };
0151 
0152 #endif