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 public:
69 
71  std::unique_ptr<const TrackerHitAssociator> hitAssoc,
72  const ClusterTPAssociation* clusterToTPMap,
73  bool absoluteNumberOfHits,
74  double qualitySimToReco,
75  double puritySimToReco,
76  double cutRecoToSim,
77  double pixelHitWeight,
78  bool threeHitTracksAreSpecial,
79  SimToRecoDenomType simToRecoDenominator);
80 
82  const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
83  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
85  const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
86  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
90 
94 
95  //seed
97  const edm::Handle<TrackingParticleCollection>&) const override;
98 
100  const edm::Handle<TrackingParticleCollection>&) const override;
101 
102  //candidate
105 
108 
109 private:
110  typedef std::pair<uint32_t, EncodedEventId>
112 
114 
115  // - added by S. Sarkar
117  std::pair<edm::Ref<TrackingParticleCollection>, size_t> j) {
118  return (i.first.key() > j.first.key());
119  }
120 
127  template <class T_RecoToSimCollection,
128  class T_TrackCollection,
129  class T_TrackingParticleCollection,
130  class T_hitOrClusterAssociator>
131  T_RecoToSimCollection associateRecoToSimImplementation(const T_TrackCollection& trackCollection,
132  const T_TrackingParticleCollection& trackingParticleCollection,
133  const TrackingParticleRefKeySet* trackingParticleKeys,
134  T_hitOrClusterAssociator hitOrClusterAssociator) const;
135 
142  template <class T_SimToRecoCollection,
143  class T_TrackCollection,
144  class T_TrackingParticleCollection,
145  class T_hitOrClusterAssociator>
146  T_SimToRecoCollection associateSimToRecoImplementation(const T_TrackCollection& trackCollection,
147  const T_TrackingParticleCollection& trackingParticleCollection,
148  const TrackingParticleRefKeySet* trackingParticleKeys,
149  T_hitOrClusterAssociator hitOrClusterAssociator) const;
150 
156  template <typename T_TPCollection, typename iter>
157  std::vector<std::pair<edm::Ref<TrackingParticleCollection>, double> > associateTrack(
159  const T_TPCollection& trackingParticles,
160  const TrackingParticleRefKeySet* trackingParticleKeys,
161  iter begin,
162  iter end) const;
170  template <typename T_TPCollection, typename iter>
171  std::vector<std::pair<edm::Ref<TrackingParticleCollection>, double> > associateTrack(
172  const ClusterTPAssociation& clusterToTPMap,
173  const T_TPCollection& trackingParticles,
174  const TrackingParticleRefKeySet* trackingParticleKeys,
175  iter begin,
176  iter end) const;
177 
179  bool trackingParticleContainsIdentifier(const TrackingParticle* pTrackingParticle,
180  const SimTrackIdentifiers& identifier) const;
181 
186  template <typename iter>
188  iter begin,
189  iter end,
190  TrackingParticleRef associatedTrackingParticle) const;
193  template <typename iter>
194  double getDoubleCount(const ClusterTPAssociation& clusterToTPList,
195  iter begin,
196  iter end,
197  TrackingParticleRef associatedTrackingParticle) const;
198 
205  template <typename iter>
206  std::vector<std::pair<SimTrackIdentifiers, double> > getAllSimTrackIdentifiers(
207  const TrackerHitAssociator& hitAssociator, iter begin, iter end) const;
208 
209  // The last parameter is used to decide whether we cound hits or clusters
210  template <typename T_Track>
211  double weightedNumberOfTrackClusters(const T_Track& track, const TrackerHitAssociator&) const;
212  template <typename T_Track>
213  double weightedNumberOfTrackClusters(const T_Track& track, const ClusterTPAssociation&) const;
214 
215  // called only by weightedNumberOfTrackClusters(..., ClusterTPAssociation)
216  template <typename iter>
217  double weightedNumberOfTrackClusters(iter begin, iter end) const;
218 
232  //void prepareEitherHitAssociatorOrClusterToTPMap( const edm::Event* pEvent, std::unique_ptr<ClusterTPAssociation>& pClusterToTPMap, std::unique_ptr<TrackerHitAssociator>& pHitAssociator ) const;
233 
235  std::unique_ptr<const TrackerHitAssociator> hitAssociator_;
237 
245 
246  // Added by S. Sarkar
247  //bool useClusterTPAssociation_;
248 }; // end of the QuickTrackAssociatorByHitsImpl class
249 
250 #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)
std::pair< uint32_t, EncodedEventId > SimTrackIdentifiers
This is enough information to uniquely identify a sim track.
double weightedNumberOfTrackClusters(const T_Track &track, const TrackerHitAssociator &) const
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &trackCollectionHandle, const edm::Handle< TrackingParticleCollection > &trackingParticleCollectionHandle) const override
edm::EDProductGetter const * productGetter_
creates either a ClusterTPAssociation OR a TrackerHitAssociator and stores it in the provided unique_...
const ClusterTPAssociation * clusterToTPMap_
QuickTrackAssociatorByHitsImpl(edm::EDProductGetter const &productGetter, std::unique_ptr< const TrackerHitAssociator > hitAssoc, const ClusterTPAssociation *clusterToTPMap, bool absoluteNumberOfHits, double qualitySimToReco, double puritySimToReco, double cutRecoToSim, double pixelHitWeight, bool threeHitTracksAreSpecial, SimToRecoDenomType simToRecoDenominator)
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &trackCollectionHandle, const edm::Handle< TrackingParticleCollection > &trackingParticleCollectionHandle) const override
std::vector< std::pair< edm::Ref< TrackingParticleCollection >, double > > associateTrack(const TrackerHitAssociator &hitAssociator, const T_TPCollection &trackingParticles, const TrackingParticleRefKeySet *trackingParticleKeys, iter begin, iter end) const
Returns the TrackingParticle that has the most associated hits to the given track.
T_RecoToSimCollection associateRecoToSimImplementation(const T_TrackCollection &trackCollection, const T_TrackingParticleCollection &trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator) const
The method that does the work for both overloads of associateRecoToSim.
HLT enums.
edm::IndexSet TrackingParticleRefKeySet
Set for TrackingParticleRef keys.
std::vector< std::pair< SimTrackIdentifiers, double > > getAllSimTrackIdentifiers(const TrackerHitAssociator &hitAssociator, iter begin, iter end) const
Returns a vector of pairs where first is a SimTrackIdentifiers (see typedef above) and second is the ...
Monte Carlo truth information used for tracking validation.
EDProductGetter const * productGetter(std::atomic< void const *> const &iCache)
TrackToTrackingParticleAssociator that associates by hits a bit quicker than the normal TrackAssociat...
T_SimToRecoCollection associateSimToRecoImplementation(const T_TrackCollection &trackCollection, const T_TrackingParticleCollection &trackingParticleCollection, const TrackingParticleRefKeySet *trackingParticleKeys, T_hitOrClusterAssociator hitOrClusterAssociator) const
The method that does the work for both overloads of associateSimToReco.
double getDoubleCount(const TrackerHitAssociator &hitAssociator, iter begin, iter end, TrackingParticleRef associatedTrackingParticle) const
This method was copied almost verbatim from the standard TrackAssociatorByHits.
std::unique_ptr< const TrackerHitAssociator > hitAssociator_
bool trackingParticleContainsIdentifier(const TrackingParticle *pTrackingParticle, const SimTrackIdentifiers &identifier) const
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers.