Go to the documentation of this file.00001 #ifndef QuickTrackAssociatorByHits_h
00002 #define QuickTrackAssociatorByHits_h
00003
00004 #include "SimTracker/TrackAssociation/interface/TrackAssociatorBase.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
00007
00008 #include "SimTracker/TrackerHitAssociation/interface/ClusterTPAssociationProducer.h"
00009
00010
00011
00012
00013 class TrackerHitAssociator;
00014
00059 class QuickTrackAssociatorByHits : public TrackAssociatorBase
00060 {
00061 public:
00062 QuickTrackAssociatorByHits( const edm::ParameterSet& config );
00063 ~QuickTrackAssociatorByHits();
00064 QuickTrackAssociatorByHits( const QuickTrackAssociatorByHits& otherAssociator );
00065 QuickTrackAssociatorByHits& operator=( const QuickTrackAssociatorByHits& otherAssociator );
00066 reco::RecoToSimCollection associateRecoToSim( edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
00067 edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle,
00068 const edm::Event* pEvent=0,
00069 const edm::EventSetup* pSetup=0 ) const;
00070 reco::SimToRecoCollection associateSimToReco( edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
00071 edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle,
00072 const edm::Event* pEvent=0,
00073 const edm::EventSetup* pSetup=0 ) const;
00074 reco::RecoToSimCollection associateRecoToSim( const edm::RefToBaseVector<reco::Track>& trackCollection,
00075 const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection,
00076 const edm::Event* pEvent=0,
00077 const edm::EventSetup* pSetup=0 ) const;
00078 reco::SimToRecoCollection associateSimToReco( const edm::RefToBaseVector<reco::Track>& trackCollection,
00079 const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection,
00080 const edm::Event* pEvent=0,
00081 const edm::EventSetup* pSetup=0 ) const;
00082
00083
00084 reco::RecoToSimCollectionSeed associateRecoToSim(edm::Handle<edm::View<TrajectorySeed> >&,
00085 edm::Handle<TrackingParticleCollection>&,
00086 const edm::Event * event ,
00087 const edm::EventSetup * setup ) const;
00088
00089 reco::SimToRecoCollectionSeed associateSimToReco(edm::Handle<edm::View<TrajectorySeed> >&,
00090 edm::Handle<TrackingParticleCollection>&,
00091 const edm::Event * event ,
00092 const edm::EventSetup * setup ) const;
00093
00094 void prepareCluster2TPMap(const edm::Event* pEvent) const;
00095
00096 private:
00097 typedef std::pair<uint32_t,EncodedEventId> SimTrackIdentifiers;
00098 enum SimToRecoDenomType {denomnone,denomsim,denomreco};
00099
00100
00101 typedef std::vector<std::pair<OmniClusterRef, TrackingParticleRef> > ClusterTPAssociationList;
00102 static bool clusterTPAssociationListGreater(std::pair<OmniClusterRef, TrackingParticleRef> i,std::pair<OmniClusterRef, TrackingParticleRef> j) { return (i.first.rawIndex()>j.first.rawIndex()); }
00103 static bool tpIntPairGreater(std::pair<edm::Ref<TrackingParticleCollection>,size_t> i, std::pair<edm::Ref<TrackingParticleCollection>,size_t> j) { return (i.first.key()>j.first.key()); }
00104
00107 reco::RecoToSimCollection associateRecoToSimImplementation() const;
00108
00111 reco::SimToRecoCollection associateSimToRecoImplementation() const;
00112
00118 template<typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,size_t> > associateTrack( iter begin, iter end ) const;
00119 template<typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,size_t> > associateTrackByCluster( iter begin, iter end ) const;
00120
00121
00123 bool trackingParticleContainsIdentifier( const TrackingParticle* pTrackingParticle, const SimTrackIdentifiers& identifier ) const;
00124
00126 template<typename iter> int getDoubleCount( iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
00127
00134 template<typename iter> std::vector< std::pair<SimTrackIdentifiers,size_t> > getAllSimTrackIdentifiers( iter begin, iter end ) const;
00135
00136
00137 template<typename iter> std::vector< OmniClusterRef> getMatchedClusters( iter begin, iter end ) const;
00138
00139 const TrackingRecHit* getHitFromIter(trackingRecHit_iterator iter) const {
00140 return &(**iter);
00141 }
00142
00143 const TrackingRecHit* getHitFromIter(TrackingRecHitCollection::const_iterator iter) const {
00144 return &(*iter);
00145 }
00146
00147
00148
00149
00150
00151 mutable TrackerHitAssociator* pHitAssociator_;
00152 const mutable edm::Event* pEventForWhichAssociatorIsValid_;
00153 void initialiseHitAssociator( const edm::Event* event ) const;
00154
00155 edm::ParameterSet hitAssociatorParameters_;
00156
00157 bool absoluteNumberOfHits_;
00158 double qualitySimToReco_;
00159 double puritySimToReco_;
00160 double cutRecoToSim_;
00161 bool threeHitTracksAreSpecial_;
00162 SimToRecoDenomType simToRecoDenominator_;
00163
00172 mutable edm::Handle<edm::View<reco::Track> >* pTrackCollectionHandle_;
00173
00179 mutable const edm::RefToBaseVector<reco::Track>* pTrackCollection_;
00180
00186 mutable edm::Handle<TrackingParticleCollection>* pTrackingParticleCollectionHandle_;
00187
00193 mutable const edm::RefVector<TrackingParticleCollection>* pTrackingParticleCollection_;
00194
00195
00196 mutable bool useClusterTPAssociation_;
00197 edm::InputTag cluster2TPSrc_;
00198 mutable ClusterTPAssociationList pCluster2TPList_;
00199 };
00200
00201 #endif // end of ifndef QuickTrackAssociatorByHits_h