CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QuickTrackAssociatorByHits.h
Go to the documentation of this file.
1 #ifndef QuickTrackAssociatorByHits_h
2 #define QuickTrackAssociatorByHits_h
3 
7 
9 //#include "SimTracker/TrackerHitAssociation/plugins/Cluster2TPMapProducer.h"
10 //#include "SimTracker/TrackerHitAssociation/plugins/TP2ClusterMapProducer.h"
11 
12 // Forward declarations
14 
60 {
61 public:
66  virtual
68  edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle,
69  const edm::Event* pEvent=0,
70  const edm::EventSetup* pSetup=0 ) const override;
71  virtual
73  edm::Handle<TrackingParticleCollection>& trackingParticleCollectionHandle,
74  const edm::Event* pEvent=0,
75  const edm::EventSetup* pSetup=0 ) const override;
76  virtual
78  const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection,
79  const edm::Event* pEvent=0,
80  const edm::EventSetup* pSetup=0 ) const override;
81  virtual
83  const edm::RefVector<TrackingParticleCollection>& trackingParticleCollection,
84  const edm::Event* pEvent=0,
85  const edm::EventSetup* pSetup=0 ) const override;
86 
87  //seed
88  virtual
91  const edm::Event * event ,
92  const edm::EventSetup * setup ) const override;
93 
94  virtual
97  const edm::Event * event ,
98  const edm::EventSetup * setup ) const override;
99 
100  void prepareCluster2TPMap(const edm::Event* pEvent) const;
101 
102 private:
103  typedef std::pair<uint32_t,EncodedEventId> SimTrackIdentifiers;
105 
106  // - added by S. Sarkar
107  typedef std::vector<std::pair<OmniClusterRef, TrackingParticleRef> > ClusterTPAssociationList;
108  static bool clusterTPAssociationListGreater(std::pair<OmniClusterRef, TrackingParticleRef> i,std::pair<OmniClusterRef, TrackingParticleRef> j) { return (i.first.rawIndex()>j.first.rawIndex()); }
109  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()); }
110 
114 
118 
124  template<typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,size_t> > associateTrack( iter begin, iter end ) const;
125  template<typename iter> std::vector< std::pair<edm::Ref<TrackingParticleCollection>,size_t> > associateTrackByCluster( iter begin, iter end ) const;
126 
127 
129  bool trackingParticleContainsIdentifier( const TrackingParticle* pTrackingParticle, const SimTrackIdentifiers& identifier ) const;
130 
132  template<typename iter> int getDoubleCount( iter begin, iter end, TrackingParticleRef associatedTrackingParticle ) const;
133 
140  template<typename iter> std::vector< std::pair<SimTrackIdentifiers,size_t> > getAllSimTrackIdentifiers( iter begin, iter end ) const;
141 
142  // Added by S. Sarkar
143  template<typename iter> std::vector< OmniClusterRef> getMatchedClusters( iter begin, iter end ) const;
144 
146  return &(**iter);
147  }
148 
149  const TrackingRecHit* getHitFromIter(TrackingRecHitCollection::const_iterator iter) const {
150  return &(*iter);
151  }
152 
153  //
154  // Members. Note that there are custom copy constructor and assignment operators, so if any members are added
155  // those methods will need to be updated.
156  //
159  void initialiseHitAssociator( const edm::Event* event ) const;
160 
162 
169 
179 
186 
193 
200 
201  // Added by S. Sarkar
205 }; // end of the QuickTrackAssociatorByHits class
206 
207 #endif // end of ifndef QuickTrackAssociatorByHits_h
const TrackingRecHit * getHitFromIter(trackingRecHit_iterator iter) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::pair< edm::Ref< TrackingParticleCollection >, size_t > > associateTrack(iter begin, iter end) const
Returns the TrackingParticle that has the most associated hits to the given track.
TrackAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHits class...
static bool clusterTPAssociationListGreater(std::pair< OmniClusterRef, TrackingParticleRef > i, std::pair< OmniClusterRef, TrackingParticleRef > j)
const TrackingRecHit * getHitFromIter(TrackingRecHitCollection::const_iterator iter) const
const edm::Event * pEventForWhichAssociatorIsValid_
bool trackingParticleContainsIdentifier(const TrackingParticle *pTrackingParticle, const SimTrackIdentifiers &identifier) const
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers.
ClusterTPAssociationList pCluster2TPList_
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &trackCollectionHandle, edm::Handle< TrackingParticleCollection > &trackingParticleCollectionHandle, const edm::Event *pEvent=0, const edm::EventSetup *pSetup=0) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< std::pair< edm::Ref< TrackingParticleCollection >, size_t > > associateTrackByCluster(iter begin, iter end) const
QuickTrackAssociatorByHits & operator=(const QuickTrackAssociatorByHits &otherAssociator)
QuickTrackAssociatorByHits(const edm::ParameterSet &config)
static bool tpIntPairGreater(std::pair< edm::Ref< TrackingParticleCollection >, size_t > i, std::pair< edm::Ref< TrackingParticleCollection >, size_t > j)
const edm::RefVector< TrackingParticleCollection > * pTrackingParticleCollection_
Pointer to the TrackingParticle collection handle.
std::pair< uint32_t, EncodedEventId > SimTrackIdentifiers
int getDoubleCount(iter begin, iter end, TrackingParticleRef associatedTrackingParticle) const
This method was copied almost verbatim from the standard TrackAssociatorByHits.
reco::RecoToSimCollection associateRecoToSimImplementation() const
The method that does the work for both overloads of associateRecoToSim.
std::vector< std::pair< SimTrackIdentifiers, size_t > > getAllSimTrackIdentifiers(iter begin, iter end) const
Returns a vector of pairs where first is a SimTrackIdentifiers (see typedef above) and second is the ...
std::vector< std::pair< OmniClusterRef, TrackingParticleRef > > ClusterTPAssociationList
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &trackCollectionHandle, edm::Handle< TrackingParticleCollection > &trackingParticleCollectionHandle, const edm::Event *pEvent=0, const edm::EventSetup *pSetup=0) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
int j
Definition: DBlmapReader.cc:9
#define end
Definition: vmac.h:37
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
reco::SimToRecoCollection associateSimToRecoImplementation() const
The method that does the work for both overloads of associateSimToReco.
edm::Handle< TrackingParticleCollection > * pTrackingParticleCollectionHandle_
Pointer to the TrackingParticle collection handle.
const edm::RefToBaseVector< reco::Track > * pTrackCollection_
Pointer to the track collection.
#define begin
Definition: vmac.h:30
std::vector< OmniClusterRef > getMatchedClusters(iter begin, iter end) const
Monte Carlo truth information used for tracking validation.
void initialiseHitAssociator(const edm::Event *event) const
edm::Handle< edm::View< reco::Track > > * pTrackCollectionHandle_
Pointer to the handle to the track collection.
void prepareCluster2TPMap(const edm::Event *pEvent) const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
TrackerHitAssociator * pHitAssociator_