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:
68  enum SimToRecoDenomType { denomnone, denomsim, denomreco };
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 
81  reco::RecoToSimCollection associateRecoToSim(
82  const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
83  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
84  reco::SimToRecoCollection associateSimToReco(
85  const edm::Handle<edm::View<reco::Track> >& trackCollectionHandle,
86  const edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle) const override;
87  reco::RecoToSimCollection associateRecoToSim(
90 
91  reco::SimToRecoCollection associateSimToReco(
92  const edm::RefToBaseVector<reco::Track>& trackCollection,
93  const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection) const override;
94 
95  //seed
97  const edm::Handle<TrackingParticleCollection>&) const override;
98 
100  const edm::Handle<TrackingParticleCollection>&) const override;
101 
102 private:
103  typedef std::pair<uint32_t, EncodedEventId>
105 
107 
108  // - added by S. Sarkar
110  std::pair<edm::Ref<TrackingParticleCollection>, size_t> j) {
111  return (i.first.key() > j.first.key());
112  }
113 
120  template <class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
121  reco::RecoToSimCollection associateRecoToSimImplementation(
122  const T_TrackCollection& trackCollection,
123  const T_TrackingParticleCollection& trackingParticleCollection,
124  const TrackingParticleRefKeySet* trackingParticleKeys,
125  T_hitOrClusterAssociator hitOrClusterAssociator) const;
126 
133  template <class T_TrackCollection, class T_TrackingParticleCollection, class T_hitOrClusterAssociator>
134  reco::SimToRecoCollection associateSimToRecoImplementation(
135  const T_TrackCollection& trackCollection,
136  const T_TrackingParticleCollection& trackingParticleCollection,
137  const TrackingParticleRefKeySet* trackingParticleKeys,
138  T_hitOrClusterAssociator hitOrClusterAssociator) const;
139 
145  template <typename T_TPCollection, typename iter>
146  std::vector<std::pair<edm::Ref<TrackingParticleCollection>, double> > associateTrack(
148  const T_TPCollection& trackingParticles,
149  const TrackingParticleRefKeySet* trackingParticleKeys,
150  iter begin,
151  iter end) const;
159  template <typename T_TPCollection, typename iter>
160  std::vector<std::pair<edm::Ref<TrackingParticleCollection>, double> > associateTrack(
161  const ClusterTPAssociation& clusterToTPMap,
162  const T_TPCollection& trackingParticles,
163  const TrackingParticleRefKeySet* trackingParticleKeys,
164  iter begin,
165  iter end) const;
166 
168  bool trackingParticleContainsIdentifier(const TrackingParticle* pTrackingParticle,
169  const SimTrackIdentifiers& identifier) const;
170 
175  template <typename iter>
176  double getDoubleCount(const TrackerHitAssociator& hitAssociator,
177  iter begin,
178  iter end,
179  TrackingParticleRef associatedTrackingParticle) const;
182  template <typename iter>
183  double getDoubleCount(const ClusterTPAssociation& clusterToTPList,
184  iter begin,
185  iter end,
186  TrackingParticleRef associatedTrackingParticle) const;
187 
194  template <typename iter>
195  std::vector<std::pair<SimTrackIdentifiers, double> > getAllSimTrackIdentifiers(
196  const TrackerHitAssociator& hitAssociator, iter begin, iter end) const;
197 
198  // The last parameter is used to decide whether we cound hits or clusters
199  double weightedNumberOfTrackClusters(const reco::Track& track, const TrackerHitAssociator&) const;
200  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const TrackerHitAssociator&) const;
201  double weightedNumberOfTrackClusters(const reco::Track& track, const ClusterTPAssociation&) const;
202  double weightedNumberOfTrackClusters(const TrajectorySeed& seed, const ClusterTPAssociation&) const;
203 
204  // called only by weightedNumberOfTrackClusters(..., ClusterTPAssociation)
205  template <typename iter>
206  double weightedNumberOfTrackClusters(iter begin, iter end) const;
207 
221  //void prepareEitherHitAssociatorOrClusterToTPMap( const edm::Event* pEvent, std::unique_ptr<ClusterTPAssociation>& pClusterToTPMap, std::unique_ptr<TrackerHitAssociator>& pHitAssociator ) const;
222 
224  std::unique_ptr<const TrackerHitAssociator> hitAssociator_;
226 
234 
235  // Added by S. Sarkar
236  //bool useClusterTPAssociation_;
237 }; // end of the QuickTrackAssociatorByHitsImpl class
238 
239 #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.
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
#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_