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  virtual
83  reco::RecoToSimCollection associateRecoToSim( const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
84  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
85  virtual
86  reco::SimToRecoCollection associateSimToReco( const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
87  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
88  virtual
91 
92  virtual
93  reco::SimToRecoCollection associateSimToReco( const edm::RefToBaseVector<reco::Track>& trackCollection,
94  const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection) const override;
95 
96  //seed
97  virtual
99  const edm::Handle<TrackingParticleCollection>&) const override;
100 
101  virtual
103  const edm::Handle<TrackingParticleCollection>&) const override;
104 
105 
106  private:
107  typedef std::pair<uint32_t,EncodedEventId> SimTrackIdentifiers;
108 
110 
111  // - added by S. Sarkar
112  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()); }
113 
120  template<class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
121  reco::RecoToSimCollection associateRecoToSimImplementation( const T_TrackCollection& trackCollection, const T_TrackingParticleCollection& trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator ) const;
122 
129  template<class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
130  reco::SimToRecoCollection associateSimToRecoImplementation( const T_TrackCollection& trackCollection, const T_TrackingParticleCollection& trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator ) const;
131 
132 
138  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;
146  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;
147 
148 
150  bool trackingParticleContainsIdentifier( const TrackingParticle* pTrackingParticle, const SimTrackIdentifiers& identifier ) const;
151 
156  template<typename iter> double getDoubleCount( const TrackerHitAssociator& hitAssociator, iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
159  template<typename iter> double getDoubleCount( const ClusterTPAssociation& clusterToTPList, iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
160 
167  template<typename iter> std::vector< std::pair<SimTrackIdentifiers,double> > getAllSimTrackIdentifiers( const TrackerHitAssociator& hitAssociator, iter begin, iter end ) const;
168 
169  // Added by S. Sarkar
170  template<typename iter> std::vector< OmniClusterRef> getMatchedClusters( iter begin, iter end ) const;
171 
173  return &(**iter);
174  }
175 
176  const TrackingRecHit* getHitFromIter(TrackingRecHitCollection::const_iterator iter) const {
177  return &(*iter);
178  }
179 
180  double weightedNumberOfTrackHits(const reco::Track& track) const;
181  double weightedNumberOfTrackHits(const TrajectorySeed& seed) 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_