Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:16

0001 #ifndef RecoMuon_TrackerSeedGenerator_TSGForOIFromL2_H
0002 #define RecoMuon_TrackerSeedGenerator_TSGForOIFromL2_H
0003 
0004 /**
0005  \class    TSGForOIFromL2
0006  \brief    Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside-in manner
0007  \author   Benjamin Radburn-Smith, Santiago Folgueras, Bibhuprasad Mahakud, Jan Frederik Schulte (Purdue University, West Lafayette)
0008  */
0009 
0010 #include "DataFormats/TrackReco/interface/Track.h"
0011 #include "FWCore/Framework/interface/global/EDProducer.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0019 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
0020 #include "MagneticField/Engine/interface/MagneticField.h"
0021 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0022 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0023 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0024 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
0025 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
0026 #include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
0027 #include "TrackingTools/PatternTools/interface/TrajMeasLessEstim.h"
0028 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0029 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0030 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0031 #include "TrackingTools/GeomPropagators/interface/StateOnTrackerBound.h"
0032 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0033 
0034 class TSGForOIFromL2 : public edm::global::EDProducer<> {
0035 public:
0036   explicit TSGForOIFromL2(const edm::ParameterSet& iConfig);
0037   ~TSGForOIFromL2() override;
0038   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0039   void produce(edm::StreamID sid, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0040 
0041 private:
0042   /// Labels for input collections
0043   const edm::EDGetTokenT<reco::TrackCollection> src_;
0044 
0045   /// Maximum number of seeds for each L2
0046   const unsigned int maxSeeds_;
0047 
0048   /// Maximum number of hitless seeds for each L2
0049   const unsigned int maxHitlessSeeds_;
0050 
0051   /// Maximum number of hitbased seeds for each L2
0052   const unsigned int maxHitSeeds_;
0053 
0054   /// How many layers to try
0055   const unsigned int numOfLayersToTry_;
0056 
0057   /// How many hits to try per layer
0058   const unsigned int numOfHitsToTry_;
0059 
0060   ///L2 valid hit cuts to decide seed creation by both states
0061   const unsigned int numL2ValidHitsCutAllEta_;
0062   const unsigned int numL2ValidHitsCutAllEndcap_;
0063 
0064   /// Rescale L2 parameter uncertainties (fixed error vs pT, eta)
0065   const double fixedErrorRescalingForHits_;
0066   const double fixedErrorRescalingForHitless_;
0067 
0068   /// Whether or not to use an automatically calculated scale-factor value
0069   const bool adjustErrorsDynamicallyForHits_;
0070   const bool adjustErrorsDynamicallyForHitless_;
0071 
0072   /// Estimator used to find dets and TrajectoryMeasurements
0073   const std::string estimatorName_;
0074 
0075   /// Minimum eta value to activate searching in the TEC
0076   const double minEtaForTEC_;
0077 
0078   /// Maximum eta value to activate searching in the TOB
0079   const double maxEtaForTOB_;
0080 
0081   /// Switch ON  (True) : use additional hits for seeds depending on the L2 properties (ignores numOfMaxSeeds_)
0082   /// Switch OFF (False): the numOfMaxSeeds_ defines if we will use hitless (numOfMaxSeeds_==1) or hitless+hits (numOfMaxSeeds_>1)
0083   const bool useHitLessSeeds_;
0084 
0085   /// KFUpdator defined in constructor
0086   const std::unique_ptr<TrajectoryStateUpdator> updator_;
0087 
0088   const edm::EDGetTokenT<MeasurementTrackerEvent> measurementTrackerTag_;
0089 
0090   /// pT, eta ranges and scale factor values
0091   const double pT1_, pT2_, pT3_;
0092   const double eta1_, eta2_, eta3_, eta4_, eta5_, eta6_, eta7_;
0093   const double SF1_, SF2_, SF3_, SF4_, SF5_, SF6_;
0094   const double SFHld_, SFHd_;
0095 
0096   /// Distance of L2 TSOSs before and after updated with vertex
0097   const double tsosDiff1_;
0098   const double tsosDiff2_;
0099 
0100   /// Displaced reconstruction
0101   const bool displacedReco_;
0102 
0103   /// Counters and flags for the implementation
0104   const std::string propagatorName_;
0105   const std::string theCategory_;
0106   const edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> estimatorToken_;
0107   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magfieldToken_;
0108   const edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorToken_;
0109   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tmpTkGeometryToken_;
0110   const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> geometryToken_;
0111   const edm::ESGetToken<Propagator, TrackingComponentsRecord> sHPOppositeToken_;
0112 
0113   /// Create seeds without hits on a given layer (TOB or TEC)
0114   void makeSeedsWithoutHits(const GeometricSearchDet& layer,
0115                             const TrajectoryStateOnSurface& tsos,
0116                             const Propagator& propagatorAlong,
0117                             const edm::ESHandle<Chi2MeasurementEstimatorBase>& estimator,
0118                             double errorSF,
0119                             unsigned int& hitlessSeedsMade,
0120                             unsigned int& numSeedsMade,
0121                             std::vector<TrajectorySeed>& out) const;
0122 
0123   /// Find hits on a given layer (TOB or TEC) and create seeds from updated TSOS with hit
0124   void makeSeedsFromHits(const GeometricSearchDet& layer,
0125                          const TrajectoryStateOnSurface& tsos,
0126                          const Propagator& propagatorAlong,
0127                          const edm::ESHandle<Chi2MeasurementEstimatorBase>& estimator,
0128                          const edm::Handle<MeasurementTrackerEvent>& measurementTracker,
0129                          double errorSF,
0130                          unsigned int& hitSeedsMade,
0131                          unsigned int& numSeedsMade,
0132                          unsigned int& layerCount,
0133                          std::vector<TrajectorySeed>& out) const;
0134 
0135   /// Calculate the dynamic error SF by analysing the L2
0136   double calculateSFFromL2(const reco::TrackRef track) const;
0137 
0138   /// Find compatability between two TSOSs
0139   double match_Chi2(const TrajectoryStateOnSurface& tsos1, const TrajectoryStateOnSurface& tsos2) const;
0140 };
0141 
0142 #endif