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 00053 00055 ~TrackAssociatorByPosition(){ 00056 }; 00057 00058 00060 reco::RecoToSimCollection associateRecoToSim(edm::RefToBaseVector<reco::Track>&, 00061 edm::RefVector<TrackingParticleCollection>&, 00062 const edm::Event * event = 0 ) const ; 00063 00065 reco::SimToRecoCollection associateSimToReco(edm::RefToBaseVector<reco::Track>&, 00066 edm::RefVector<TrackingParticleCollection>&, 00067 const edm::Event * event = 0 ) const ; 00068 00069 double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface &)const; 00070 00071 private: 00072 00073 const TrackingGeometry * theGeometry; 00074 const Propagator * thePropagator; 00075 uint theMethod; 00076 double theQminCut; 00077 double theQCut; 00078 bool theMinIfNoMatch; 00079 double thePositionMinimumDistance; 00080 00081 FreeTrajectoryState getState(const reco::Track &) const; 00082 TrajectoryStateOnSurface getState(const TrackingParticle &)const; 00083 00084 }; 00085 00086 #endif