CMS 3D CMS Logo

QuickTrackAssociatorByHitsImpl.h
Go to the documentation of this file.
1 #ifndef QuickTrackAssociatorByHitsImpl_h
2 #define QuickTrackAssociatorByHitsImpl_h
3 
5 
7 
9 
11 
12 // Forward declarations
14 
15 namespace edm {
16  class EDProductGetter;
17 }
18 
67 {
68 public:
69  enum SimToRecoDenomType {denomnone,denomsim,denomreco};
70 
72  std::unique_ptr<const TrackerHitAssociator> hitAssoc,
73  const ClusterTPAssociation *clusterToTPMap,
74  bool absoluteNumberOfHits,
75  double qualitySimToReco,
76  double puritySimToReco,
77  double cutRecoToSim,
78  double pixelHitWeight,
79  bool threeHitTracksAreSpecial,
80  SimToRecoDenomType simToRecoDenominator);
81 
82  reco::RecoToSimCollection associateRecoToSim( const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
83  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
84  reco::SimToRecoCollection associateSimToReco( const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
85  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
88 
89  reco::SimToRecoCollection associateSimToReco( const edm::RefToBaseVector<reco::Track>& trackCollection,
90  const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection) const override;
91 
92  //seed
94  const edm::Handle<TrackingParticleCollection>&) const override;
95 
97  const edm::Handle<TrackingParticleCollection>&) const override;
98 
99 
100  private:
101  typedef std::pair<uint32_t,EncodedEventId> SimTrackIdentifiers;
102 
104 
105  // - added by S. Sarkar
106  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()); }
107 
114  template<class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
115  reco::RecoToSimCollection associateRecoToSimImplementation( const T_TrackCollection& trackCollection, const T_TrackingParticleCollection& trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator ) const;
116 
123  template<class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
124  reco::SimToRecoCollection associateSimToRecoImplementation( const T_TrackCollection& trackCollection, const T_TrackingParticleCollection& trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator ) const;
125 
126 
132  template<typename T_TPCollection,typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,double> > associateTrack( const TrackerHitAssociator& hitAssociator, const T_TPCollection& trackingParticles, const TrackingParticleRefKeySet *trackingParticleKeys, iter begin, iter end ) const;
140  template<typename T_TPCollection,typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,double> > associateTrack( const ClusterTPAssociation& clusterToTPMap, const T_TPCollection& trackingParticles, const TrackingParticleRefKeySet *trackingParticleKeys, iter begin, iter end ) const;
141 
142 
144  bool trackingParticleContainsIdentifier( const TrackingParticle* pTrackingParticle, const SimTrackIdentifiers& identifier ) const;
145 
150  template<typename iter> double getDoubleCount( const TrackerHitAssociator& hitAssociator, iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
153  template<typename iter> double getDoubleCount( const ClusterTPAssociation& clusterToTPList, iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
154 
161  template<typename iter> std::vector< std::pair<SimTrackIdentifiers,double> > getAllSimTrackIdentifiers( const TrackerHitAssociator& hitAssociator, iter begin, iter end ) const;
162 
163  // Added by S. Sarkar
164  template<typename iter> std::vector< OmniClusterRef> getMatchedClusters( iter begin, iter end ) const;
165 
167  return &(**iter);
168  }
169 
170  const TrackingRecHit* getHitFromIter(TrackingRecHitCollection::const_iterator iter) const {
171  return &(*iter);
172  }
173 
174  // The last parameter is used to decide whether we cound hits or clusters
175  double weightedNumberOfTrackClusters(const reco::Track& track, const TrackerHitAssociator&) const;
176  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const TrackerHitAssociator&) const;
177  double weightedNumberOfTrackClusters(const reco::Track& track, const ClusterTPAssociation&) const;
178  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const ClusterTPAssociation&) const;
179 
180  // called only by weightedNumberOfTrackClusters(..., ClusterTPAssociation)
181  template<typename iter> double weightedNumberOfTrackClusters(iter begin, iter end) const ;
182 
196  //void prepareEitherHitAssociatorOrClusterToTPMap( const edm::Event* pEvent, std::unique_ptr<ClusterTPAssociation>& pClusterToTPMap, std::unique_ptr<TrackerHitAssociator>& pHitAssociator ) const;
197 
199  std::unique_ptr<const TrackerHitAssociator> hitAssociator_;
201 
209 
210  // Added by S. Sarkar
211  //bool useClusterTPAssociation_;
212 }; // end of the QuickTrackAssociatorByHitsImpl class
213 
214 #endif // end of ifndef QuickTrackAssociatorByHitsImpl_h
static bool tpIntPairGreater(std::pair< edm::Ref< TrackingParticleCollection >, size_t > i, std::pair< edm::Ref< TrackingParticleCollection >, size_t > j)
edm::EDProductGetter const * productGetter_
creates either a ClusterTPAssociation OR a TrackerHitAssociator and stores it in the provided unique_...
const ClusterTPAssociation * clusterToTPMap_
EDProductGetter const * productGetter(std::atomic< void const * > const &iCache)
const TrackingRecHit * getHitFromIter(trackingRecHit_iterator iter) const
#define end
Definition: vmac.h:37
std::pair< uint32_t, EncodedEventId > SimTrackIdentifiers
This is enough information to uniquely identify a sim track.
#define begin
Definition: vmac.h:30
HLT enums.
edm::IndexSet TrackingParticleRefKeySet
Set for TrackingParticleRef keys.
Monte Carlo truth information used for tracking validation.
TrackToTrackingParticleAssociator that associates by hits a bit quicker than the normal TrackAssociat...
const TrackingRecHit * getHitFromIter(TrackingRecHitCollection::const_iterator iter) const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
std::unique_ptr< const TrackerHitAssociator > hitAssociator_