00001 #ifndef TrackAssociatorByPosition_h 00002 #define TrackAssociatorByPosition_h 00003 00012 #include "SimTracker/TrackAssociation/interface/TrackAssociatorBase.h" 00013 #include "SimDataFormats/Track/interface/SimTrackContainer.h" 00014 #include "FWCore/Framework/interface/ESHandle.h" 00015 #include "FWCore/Framework/interface/EventSetup.h" 00016 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" 00017 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00018 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00019 00020 #include "TrackingTools/GeomPropagators/interface/Propagator.h" 00021 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" 00022 00023 #include <TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h> 00024 00025 #include<map> 00026 00027 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater: 00028 //the track with the lowest association chi2 will be the first in the output map. 00029 00030 class TrackAssociatorByPosition : public TrackAssociatorBase { 00031 00032 public: 00033 00035 TrackAssociatorByPosition(const edm::ParameterSet& iConfig, 00036 const TrackingGeometry * geo, 00037 const Propagator * prop){ 00038 theGeometry = geo; 00039 thePropagator = prop; 00040 theMinIfNoMatch = iConfig.getParameter<bool>("MinIfNoMatch"); 00041 theQminCut = iConfig.getParameter<double>("QminCut"); 00042 theQCut = iConfig.getParameter<double>("QCut"); 00043 thePositionMinimumDistance = iConfig.getParameter<double>("positionMinimumDistance"); 00044 std::string meth= iConfig.getParameter<std::string>("method"); 00045 if (meth=="chi2"){ theMethod =0; } 00046 else if (meth=="dist"){theMethod =1;} 00047 else if (meth=="momdr"){theMethod = 2;} 00048 else if (meth=="posdr"){theMethod = 3;} 00049 else{ 00050 edm::LogError("TrackAssociatorByPosition")<<meth<<" mothed not recognized. Use dr or chi2."; } 00051 00052 theConsiderAllSimHits = iConfig.getParameter<bool>("ConsiderAllSimHits"); 00053 }; 00054 00055 00057 ~TrackAssociatorByPosition(){ 00058 }; 00059 00060 00062 reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track>&, 00063 const edm::RefVector<TrackingParticleCollection>&, 00064 const edm::Event * event = 0, 00065 const edm::EventSetup * setup = 0 ) const ; 00066 00068 reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track>&, 00069 const edm::RefVector<TrackingParticleCollection>&, 00070 const edm::Event * event = 0, 00071 const edm::EventSetup * setup = 0 ) const ; 00072 00073 double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface &)const; 00074 00075 private: 00076 00077 const TrackingGeometry * theGeometry; 00078 const Propagator * thePropagator; 00079 unsigned int theMethod; 00080 double theQminCut; 00081 double theQCut; 00082 bool theMinIfNoMatch; 00083 double thePositionMinimumDistance; 00084 bool theConsiderAllSimHits; 00085 00086 FreeTrajectoryState getState(const reco::Track &) const; 00087 TrajectoryStateOnSurface getState(const TrackingParticle &)const; 00088 00089 }; 00090 00091 #endif