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 
164  // The last parameter is used to decide whether we cound hits or clusters
165  double weightedNumberOfTrackClusters(const reco::Track& track, const TrackerHitAssociator&) const;
166  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const TrackerHitAssociator&) const;
167  double weightedNumberOfTrackClusters(const reco::Track& track, const ClusterTPAssociation&) const;
168  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const ClusterTPAssociation&) const;
169 
170  // called only by weightedNumberOfTrackClusters(..., ClusterTPAssociation)
171  template<typename iter> double weightedNumberOfTrackClusters(iter begin, iter end) const ;
172 
186  //void prepareEitherHitAssociatorOrClusterToTPMap( const edm::Event* pEvent, std::unique_ptr<ClusterTPAssociation>& pClusterToTPMap, std::unique_ptr<TrackerHitAssociator>& pHitAssociator ) const;
187 
189  std::unique_ptr<const TrackerHitAssociator> hitAssociator_;
191 
199 
200  // Added by S. Sarkar
201  //bool useClusterTPAssociation_;
202 }; // end of the QuickTrackAssociatorByHitsImpl class
203 
204 #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)
#define end
Definition: vmac.h:39
std::pair< uint32_t, EncodedEventId > SimTrackIdentifiers
This is enough information to uniquely identify a sim track.
#define begin
Definition: vmac.h:32
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...
std::unique_ptr< const TrackerHitAssociator > hitAssociator_