CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimTracker/TrackAssociation/interface/TrackAssociatorByPosition.h

Go to the documentation of this file.
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 "SimGeneral/TrackingAnalysis/interface/SimHitTPAssociationProducer.h"
00026 
00027 #include<map>
00028 
00029 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
00030 //the track with the lowest association chi2 will be the first in the output map.
00031 
00032 class TrackAssociatorByPosition : public TrackAssociatorBase {
00033 
00034  public:
00035 
00037    TrackAssociatorByPosition(const edm::ParameterSet& iConfig,
00038                              const TrackingGeometry * geo, 
00039                              const Propagator * prop){
00040      theGeometry = geo;
00041      thePropagator = prop;
00042      theMinIfNoMatch = iConfig.getParameter<bool>("MinIfNoMatch");
00043      theQminCut = iConfig.getParameter<double>("QminCut");
00044      theQCut = iConfig.getParameter<double>("QCut");
00045      thePositionMinimumDistance = iConfig.getParameter<double>("positionMinimumDistance");
00046      std::string  meth= iConfig.getParameter<std::string>("method");
00047      if (meth=="chi2"){ theMethod =0; }
00048      else if (meth=="dist"){theMethod =1;}
00049      else if (meth=="momdr"){theMethod = 2;}
00050      else if (meth=="posdr"){theMethod = 3;}
00051      else{
00052        edm::LogError("TrackAssociatorByPosition")<<meth<<" mothed not recognized. Use dr or chi2.";     }
00053 
00054      theConsiderAllSimHits = iConfig.getParameter<bool>("ConsiderAllSimHits");
00055      _simHitTpMapTag = iConfig.getParameter<edm::InputTag>("simHitTpMapTag");
00056    };
00057 
00058 
00060   ~TrackAssociatorByPosition(){
00061   };
00062 
00063 
00065   reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track>&,
00066                                                const edm::RefVector<TrackingParticleCollection>&,
00067                                                const edm::Event * event = 0,
00068                                                const edm::EventSetup * setup = 0 ) const ;
00069 
00071   reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track>&,
00072                                                const edm::RefVector<TrackingParticleCollection>&,
00073                                                const edm::Event * event = 0,
00074                                                const edm::EventSetup * setup = 0 ) const ;
00075 
00076   double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface &)const;
00077 
00078  private:
00079 
00080   const TrackingGeometry * theGeometry;
00081   const Propagator * thePropagator;
00082   unsigned int theMethod;
00083   double theQminCut;
00084   double theQCut;
00085   bool theMinIfNoMatch;
00086   double thePositionMinimumDistance;
00087   bool theConsiderAllSimHits;
00088   
00089   FreeTrajectoryState getState(const reco::Track &) const;
00090   TrajectoryStateOnSurface getState(const TrackingParticleRef)const;
00091   mutable edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> simHitsTPAssoc;
00092   edm::InputTag _simHitTpMapTag;
00093 };
00094 
00095 #endif