CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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 class TrackerTopology;
00043 
00044 class FastTSGFromPropagation : public TrackerSeedGenerator {
00045 
00046 public:
00048   FastTSGFromPropagation(const edm::ParameterSet &pset);
00049 
00050   FastTSGFromPropagation(const edm::ParameterSet& par, const MuonServiceProxy*);
00051 
00053   virtual ~FastTSGFromPropagation();
00054 
00056   void  trackerSeeds(const TrackCand&, const TrackingRegion&, 
00057                      const TrackerTopology *tTopo, std::vector<TrajectorySeed>&);
00058     
00060   void init(const MuonServiceProxy*);
00061 
00063   void setEvent(const edm::Event&);
00064 
00065 private:
00067     void stateOnDet(const TrajectoryStateOnSurface& ts,
00068                       unsigned int detid,
00069                       PTrajectoryStateOnDet& pts) const;
00070 
00071   TrajectoryStateOnSurface innerState(const TrackCand&) const;
00072 
00073   TrajectoryStateOnSurface outerTkState(const TrackCand&) const;
00074 
00075   const LayerMeasurements* tkLayerMeasurements() const { return theTkLayerMeasurements; } 
00076 
00077   const TrajectoryStateUpdator* updator() const {return theUpdator;}
00078 
00079   const Chi2MeasurementEstimator* estimator() const { return theEstimator; }
00080 
00081   edm::ESHandle<Propagator> propagator() const {return theService->propagator(thePropagatorName); }
00082 
00084   TrajectorySeed createSeed(const TrajectoryStateOnSurface&, const DetId&) const;
00085 
00087   TrajectorySeed createSeed(const TrajectoryStateOnSurface& tsos, const edm::OwnVector<TrackingRecHit>& container, const DetId& id) const;
00088 
00090   void validMeasurements(std::vector<TrajectoryMeasurement>&) const;
00091 
00093   std::vector<TrajectoryMeasurement> findMeasurements_new(const DetLayer*, const TrajectoryStateOnSurface&) const;
00094 
00096   std::vector<TrajectoryMeasurement> findMeasurements(const DetLayer*, const TrajectoryStateOnSurface&) const;
00097 
00099   bool passSelection(const TrajectoryStateOnSurface&) const;
00100 
00101   void getRescalingFactor(const TrackCand& staMuon);
00102 
00104   void adjust(FreeTrajectoryState &) const;
00105 
00107   void adjust(TrajectoryStateOnSurface &) const;
00108 
00109   double dxyDis(const TrajectoryStateOnSurface& tsos) const;
00110 
00111   double zDis(const TrajectoryStateOnSurface& tsos) const;
00112 
00113   struct increasingEstimate{
00114     bool operator()(const TrajectoryMeasurement& lhs,
00115                     const TrajectoryMeasurement& rhs) const{ 
00116       return lhs.estimate() < rhs.estimate();
00117     }
00118   };
00119 
00120   struct isInvalid {
00121     bool operator()(const TrajectoryMeasurement& measurement) {
00122       return ( ((measurement).recHit() == 0) || !((measurement).recHit()->isValid()) || !((measurement).updatedState().isValid()) ); 
00123     }
00124   };
00125 
00126   unsigned long long theCacheId_MT;
00127   unsigned long long theCacheId_TG;
00128 
00129   std::string theCategory;
00130 
00131   const LayerMeasurements*  theTkLayerMeasurements;
00132 
00133   edm::ESHandle<GeometricSearchTracker> theTracker;
00134 
00135   edm::ESHandle<MeasurementTracker> theMeasTracker;
00136 
00137   const DirectTrackerNavigation* theNavigation;
00138   const TrackerGeometry*  theGeometry;
00139 
00140   const MuonServiceProxy* theService;
00141 
00142   const TrajectoryStateUpdator* theUpdator;
00143 
00144   const Chi2MeasurementEstimator* theEstimator;
00145 
00146   TrajectoryStateTransform* theTSTransformer;
00147 
00148   double theMaxChi2;
00149 
00150   double theFlexErrorRescaling;
00151 
00152   double theFixedErrorRescaling;
00153 
00154   bool theUseVertexStateFlag;
00155 
00156   bool theUpdateStateFlag;
00157 
00158   edm::InputTag theSimTrackCollectionLabel;
00159   edm::InputTag theHitProducer;
00160 
00161   std::string theResetMethod; 
00162 
00163   bool theSelectStateFlag;
00164 
00165   std::string thePropagatorName;
00166 
00167   MuonErrorMatrix * theErrorMatrixAdjuster;
00168 
00169   bool theAdjustAtIp;
00170 
00171   double theSigmaZ; 
00172 
00173   edm::ParameterSet theConfig;
00174   edm::InputTag beamSpot_;
00175 
00176   edm::Handle<reco::BeamSpot> theBeamSpot;
00177   edm::Handle<edm::SimTrackContainer> theSimTracks;
00178   edm::Handle<SiTrackerGSMatchedRecHit2DCollection> theGSRecHits;
00179   edm::ESHandle<TransientTrackingRecHitBuilder> theTTRHBuilder;
00180 
00181 };
00182 
00183 #endif