CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FastSimulation/Muons/plugins/FastTSGFromPropagation.h

Go to the documentation of this file.
00001 #ifndef FastSimulation_Muons_FastTSGFromPropagation_H
00002 #define FastSimulation_Muons_FastTSGFromPropagation_H
00003 
00013 #include "RecoMuon/TrackerSeedGenerator/interface/TrackerSeedGenerator.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include "FWCore/Utilities/interface/InputTag.h"
00016 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00017 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00018 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
00019 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00020 #include "RecoMuon/TrackingTools/interface/MuonErrorMatrix.h"
00021 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00022 
00023 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00024 #include "MagneticField/Engine/interface/MagneticField.h"
00025 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSRecHit2DCollection.h"
00026 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSMatchedRecHit2DCollection.h"
00027 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00028 
00029 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
00030 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
00031 
00032 
00033 class LayerMeasurements;
00034 class Chi2MeasurementEstimator;
00035 class Propagator;
00036 class MeasurementTracker;
00037 class GeometricSearchTracker;
00038 class DirectTrackerNavigation;
00039 class TrajectoryStateTransform;
00040 class SimTrack;
00041 class TrackerGeometry;
00042 
00043 class FastTSGFromPropagation : public TrackerSeedGenerator {
00044 
00045 public:
00047   FastTSGFromPropagation(const edm::ParameterSet &pset);
00048 
00049   FastTSGFromPropagation(const edm::ParameterSet& par, const MuonServiceProxy*);
00050 
00052   virtual ~FastTSGFromPropagation();
00053 
00055   void  trackerSeeds(const TrackCand&, const TrackingRegion&, std::vector<TrajectorySeed>&);
00056     
00058   void init(const MuonServiceProxy*);
00059 
00061   void setEvent(const edm::Event&);
00062 
00063 private:
00065     void stateOnDet(const TrajectoryStateOnSurface& ts,
00066                       unsigned int detid,
00067                       PTrajectoryStateOnDet& pts) const;
00068 
00069   TrajectoryStateOnSurface innerState(const TrackCand&) const;
00070 
00071   TrajectoryStateOnSurface outerTkState(const TrackCand&) const;
00072 
00073   const LayerMeasurements* tkLayerMeasurements() const { return theTkLayerMeasurements; } 
00074 
00075   const TrajectoryStateUpdator* updator() const {return theUpdator;}
00076 
00077   const Chi2MeasurementEstimator* estimator() const { return theEstimator; }
00078 
00079   edm::ESHandle<Propagator> propagator() const {return theService->propagator(thePropagatorName); }
00080 
00082   TrajectorySeed createSeed(const TrajectoryStateOnSurface&, const DetId&) const;
00083 
00085   TrajectorySeed createSeed(const TrajectoryStateOnSurface& tsos, const edm::OwnVector<TrackingRecHit>& container, const DetId& id) const;
00086 
00088   void validMeasurements(std::vector<TrajectoryMeasurement>&) const;
00089 
00091   std::vector<TrajectoryMeasurement> findMeasurements_new(const DetLayer*, const TrajectoryStateOnSurface&) const;
00092 
00094   std::vector<TrajectoryMeasurement> findMeasurements(const DetLayer*, const TrajectoryStateOnSurface&) const;
00095 
00097   bool passSelection(const TrajectoryStateOnSurface&) const;
00098 
00099   void getRescalingFactor(const TrackCand& staMuon);
00100 
00102   void adjust(FreeTrajectoryState &) const;
00103 
00105   void adjust(TrajectoryStateOnSurface &) const;
00106 
00107   double dxyDis(const TrajectoryStateOnSurface& tsos) const;
00108 
00109   double zDis(const TrajectoryStateOnSurface& tsos) const;
00110 
00111   struct increasingEstimate{
00112     bool operator()(const TrajectoryMeasurement& lhs,
00113                     const TrajectoryMeasurement& rhs) const{ 
00114       return lhs.estimate() < rhs.estimate();
00115     }
00116   };
00117 
00118   struct isInvalid {
00119     bool operator()(const TrajectoryMeasurement& measurement) {
00120       return ( ((measurement).recHit() == 0) || !((measurement).recHit()->isValid()) || !((measurement).updatedState().isValid()) ); 
00121     }
00122   };
00123 
00124   unsigned long long theCacheId_MT;
00125   unsigned long long theCacheId_TG;
00126 
00127   std::string theCategory;
00128 
00129   const LayerMeasurements*  theTkLayerMeasurements;
00130 
00131   edm::ESHandle<GeometricSearchTracker> theTracker;
00132 
00133   edm::ESHandle<MeasurementTracker> theMeasTracker;
00134 
00135   const DirectTrackerNavigation* theNavigation;
00136   const TrackerGeometry*  theGeometry;
00137 
00138   const MuonServiceProxy* theService;
00139 
00140   const TrajectoryStateUpdator* theUpdator;
00141 
00142   const Chi2MeasurementEstimator* theEstimator;
00143 
00144   TrajectoryStateTransform* theTSTransformer;
00145 
00146   double theMaxChi2;
00147 
00148   double theFlexErrorRescaling;
00149 
00150   double theFixedErrorRescaling;
00151 
00152   bool theUseVertexStateFlag;
00153 
00154   bool theUpdateStateFlag;
00155 
00156   edm::InputTag theSimTrackCollectionLabel;
00157   edm::InputTag theHitProducer;
00158 
00159   std::string theResetMethod; 
00160 
00161   bool theSelectStateFlag;
00162 
00163   std::string thePropagatorName;
00164 
00165   MuonErrorMatrix * theErrorMatrixAdjuster;
00166 
00167   bool theAdjustAtIp;
00168 
00169   double theSigmaZ; 
00170 
00171   edm::ParameterSet theConfig;
00172   edm::InputTag beamSpot_;
00173 
00174   edm::Handle<reco::BeamSpot> theBeamSpot;
00175   edm::Handle<edm::SimTrackContainer> theSimTracks;
00176   edm::Handle<SiTrackerGSMatchedRecHit2DCollection> theGSRecHits;
00177   edm::ESHandle<TransientTrackingRecHitBuilder> theTTRHBuilder;
00178 
00179 };
00180 
00181 #endif