CMS 3D CMS Logo

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