Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-31 02:17:41

0001 #ifndef RecoMuon_TrackerSeedGenerator_TSGForOI_H
0002 #define RecoMuon_TrackerSeedGenerator_TSGForOI_H
0003 
0004 /**
0005   \class    TSGForOI
0006   \brief    Create L3MuonTrajectorySeeds from L2 Muons updated at vertex in an outside in manner
0007   \author   Benjamin Radburn-Smith, Santiago Folgueras
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 
0033 class TSGForOI : public edm::global::EDProducer<> {
0034 public:
0035   explicit TSGForOI(const edm::ParameterSet& iConfig);
0036   ~TSGForOI() override;
0037   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0038   void produce(edm::StreamID sid, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0039 
0040 private:
0041   /// Labels for input collections
0042   const edm::EDGetTokenT<reco::TrackCollection> src_;
0043 
0044   /// Estimator used to find dets and TrajectoryMeasurements
0045   const edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> estimatorToken_;
0046 
0047   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magfieldToken_;
0048   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tmpTkGeometryToken_;
0049   const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> geometryToken_;
0050   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0051   const edm::ESGetToken<Propagator, TrackingComponentsRecord> smartOppositeToken_;
0052   const edm::ESGetToken<Propagator, TrackingComponentsRecord> shpOppositeToken_;
0053 
0054   /// Maximum number of seeds for each L2
0055   const unsigned int numOfMaxSeedsParam_;
0056 
0057   /// How many layers to try
0058   const unsigned int numOfLayersToTry_;
0059 
0060   /// How many hits to try per layer
0061   const unsigned int numOfHitsToTry_;
0062 
0063   /// How much to rescale errors from the L2 (fixed error vs pT, eta)
0064   const double fixedErrorRescalingForHits_;
0065   const double fixedErrorRescalingForHitless_;
0066 
0067   /// Whether or not to use an automatically calculated scale-factor value
0068   const bool adjustErrorsDynamicallyForHits_;
0069   const bool adjustErrorsDynamicallyForHitless_;
0070 
0071   /// Minimum eta value to activate searching in the TEC
0072   const double minEtaForTEC_;
0073 
0074   /// Maximum eta value to activate searching in the TOB
0075   const double maxEtaForTOB_;
0076 
0077   /// Switch ON  (True) : use additional hits for seeds depending on the L2 properties (ignores numOfMaxSeeds_)
0078   /// Switch OFF (False): the numOfMaxSeeds_ defines if we will use hitless (numOfMaxSeeds_==1) or hitless+hits (numOfMaxSeeds_>1)
0079   const bool useHitLessSeeds_;
0080 
0081   /// Switch ON to use Stereo layers instead of using every layer in TEC.
0082   const bool useStereoLayersInTEC_;
0083 
0084   /// KFUpdator defined in constructor
0085   const std::unique_ptr<TrajectoryStateUpdator> updator_;
0086 
0087   const edm::EDGetTokenT<MeasurementTrackerEvent> measurementTrackerTag_;
0088 
0089   /// pT, eta ranges and scale factor values
0090   const double pT1_, pT2_, pT3_;
0091   const double eta1_, eta2_;
0092   const double SF1_, SF2_, SF3_, SF4_, SF5_;
0093 
0094   /// Distance of TSOSs to trigger using hits or not
0095   const double tsosDiff_;
0096 
0097   /// Counters and flags for the implementation
0098   const std::string propagatorName_;
0099   const std::string theCategory;
0100   const edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorAlongToken_;
0101   const edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorOppositeToken_;
0102 
0103   /// Function to find seeds on a given layer
0104   void findSeedsOnLayer(const TrackerTopology* tTopo,
0105                         const GeometricSearchDet& layer,
0106                         const TrajectoryStateOnSurface& tsosAtIP,
0107                         const Propagator& propagatorAlong,
0108                         const Propagator& propagatorOpposite,
0109                         const reco::TrackRef l2,
0110                         edm::ESHandle<Chi2MeasurementEstimatorBase>& estimator_,
0111                         edm::Handle<MeasurementTrackerEvent>& measurementTrackerH,
0112                         unsigned int& numSeedsMade,
0113                         unsigned int& numOfMaxSeeds,
0114                         unsigned int& layerCount,
0115                         bool& analysedL2,
0116                         std::unique_ptr<std::vector<TrajectorySeed> >& out) const;
0117 
0118   /// Function used to calculate the dynamic error SF by analysing the L2
0119   double calculateSFFromL2(const reco::TrackRef track) const;
0120 
0121   /// Function to find hits on layers and create seeds from updated TSOS
0122   int makeSeedsFromHits(const TrackerTopology* tTopo,
0123                         const GeometricSearchDet& layer,
0124                         const TrajectoryStateOnSurface& tsosAtIP,
0125                         std::vector<TrajectorySeed>& out,
0126                         const Propagator& propagatorAlong,
0127                         const MeasurementTrackerEvent& measurementTracker,
0128                         edm::ESHandle<Chi2MeasurementEstimatorBase>& estimator_,
0129                         unsigned int& numSeedsMade,
0130                         const double errorSF,
0131                         const double l2Eta) const;
0132 
0133   //Find compatability between two TSOSs
0134   double match_Chi2(const TrajectoryStateOnSurface& tsos1, const TrajectoryStateOnSurface& tsos2) const;
0135 };
0136 
0137 #endif