Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:31:27

0001 #ifndef TrackAssociatorByPositionImpl_h
0002 #define TrackAssociatorByPositionImpl_h
0003 
0004 /** \class TrackAssociatorByPositionImpl
0005  *  Class that performs the association of reco::Tracks and TrackingParticles based on position in muon detector
0006  *
0007  *  \author vlimant
0008  */
0009 
0010 #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociatorBaseImpl.h"
0011 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017 
0018 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0019 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0020 
0021 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0022 
0023 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0024 #include "DataFormats/Common/interface/EDProductGetter.h"
0025 
0026 #include <map>
0027 
0028 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
0029 //the track with the lowest association chi2 will be the first in the output map.
0030 
0031 class TrackAssociatorByPositionImpl : public reco::TrackToTrackingParticleAssociatorBaseImpl {
0032 public:
0033   typedef std::pair<TrackingParticleRef, TrackPSimHitRef> SimHitTPPair;
0034   typedef std::vector<SimHitTPPair> SimHitTPAssociationList;
0035   enum class Method { chi2, dist, momdr, posdr };
0036 
0037   TrackAssociatorByPositionImpl(edm::EDProductGetter const& productGetter,
0038                                 const TrackingGeometry* geo,
0039                                 const Propagator* prop,
0040                                 const SimHitTPAssociationList* assocList,
0041                                 double qMinCut,
0042                                 double qCut,
0043                                 double positionMinimumDistance,
0044                                 Method method,
0045                                 bool minIfNoMatch,
0046                                 bool considerAllSimHits)
0047       : productGetter_(&productGetter),
0048         theGeometry(geo),
0049         thePropagator(prop),
0050         theSimHitsTPAssoc(assocList),
0051         theQminCut(qMinCut),
0052         theQCut(qCut),
0053         thePositionMinimumDistance(positionMinimumDistance),
0054         theMethod(method),
0055         theMinIfNoMatch(minIfNoMatch),
0056         theConsiderAllSimHits(considerAllSimHits) {}
0057 
0058   /// compare reco to sim the handle of reco::Track and TrackingParticle collections
0059 
0060   reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track>&,
0061                                                const edm::RefVector<TrackingParticleCollection>&) const override;
0062 
0063   /// compare reco to sim the handle of reco::Track and TrackingParticle collections
0064 
0065   reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track>&,
0066                                                const edm::RefVector<TrackingParticleCollection>&) const override;
0067 
0068 private:
0069   double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface&) const;
0070 
0071   edm::EDProductGetter const* productGetter_;
0072   const TrackingGeometry* theGeometry;
0073   const Propagator* thePropagator;
0074   const SimHitTPAssociationList* theSimHitsTPAssoc;
0075   double theQminCut;
0076   double theQCut;
0077   double thePositionMinimumDistance;
0078   Method theMethod;
0079   bool theMinIfNoMatch;
0080   bool theConsiderAllSimHits;
0081 
0082   FreeTrajectoryState getState(const reco::Track&) const;
0083   TrajectoryStateOnSurface getState(const TrackingParticleRef&, const SimHitTPAssociationList& simHitsTPAssoc) const;
0084   //edm::InputTag _simHitTpMapTag;
0085 };
0086 
0087 #endif