TrackAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHits class. More...
#include <QuickTrackAssociatorByHits.h>
Private Types | |
enum | SimToRecoDenomType { denomnone, denomsim, denomreco } |
typedef std::pair< uint32_t, EncodedEventId > | SimTrackIdentifiers |
Private Member Functions | |
reco::RecoToSimCollection | associateRecoToSimImplementation () const |
The method that does the work for both overloads of associateRecoToSim. More... | |
reco::SimToRecoCollection | associateSimToRecoImplementation () const |
The method that does the work for both overloads of associateSimToReco. More... | |
std::vector< std::pair < edm::Ref < TrackingParticleCollection > , size_t > > | associateTrack (const reco::Track *pTrack) const |
Returns the TrackingParticle that has the most associated hits to the given track. More... | |
std::vector< std::pair < SimTrackIdentifiers, size_t > > | getAllSimTrackIdentifiers (const reco::Track *pTrack) const |
Returns a vector of pairs where first is a SimTrackIdentifiers (see typedef above) and second is the number of hits that came from that sim track. More... | |
int | getDoubleCount (trackingRecHit_iterator begin, trackingRecHit_iterator end, const TrackingParticle &associatedTrackingParticle) const |
This method was copied almost verbatim from the standard TrackAssociatorByHits. More... | |
void | initialiseHitAssociator (const edm::Event *event) const |
bool | trackingParticleContainsIdentifier (const TrackingParticle *pTrackingParticle, const SimTrackIdentifiers &identifier) const |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers. More... | |
Private Attributes | |
bool | absoluteNumberOfHits_ |
double | cutRecoToSim_ |
edm::ParameterSet | hitAssociatorParameters_ |
const edm::Event * | pEventForWhichAssociatorIsValid_ |
TrackerHitAssociator * | pHitAssociator_ |
const edm::RefToBaseVector < reco::Track > * | pTrackCollection_ |
Pointer to the track collection. More... | |
edm::Handle< edm::View < reco::Track > > * | pTrackCollectionHandle_ |
Pointer to the handle to the track collection. More... | |
const edm::RefVector < TrackingParticleCollection > * | pTrackingParticleCollection_ |
Pointer to the TrackingParticle collection handle. More... | |
edm::Handle < TrackingParticleCollection > * | pTrackingParticleCollectionHandle_ |
Pointer to the TrackingParticle collection handle. More... | |
double | puritySimToReco_ |
double | qualitySimToReco_ |
SimToRecoDenomType | simToRecoDenominator_ |
bool | threeHitTracksAreSpecial_ |
TrackAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHits class.
NOTE - Doesn't implement the TrajectorySeed or TrackCandidate association methods (from TrackAssociatorBase) so will always return empty associations for those.
This track associator (mostly) does the same as TrackAssociatorByHits, but faster. I've tested it a fair bit and can't find any differences between the results of this and the standard TrackAssociatorByHits.
Configuration parameters:
AbsoluteNumberOfHits - bool - if true, Quality_SimToReco and Cut_RecoToSim are the absolute number of shared hits required for association, not the percentage.
Quality_SimToReco - double - The minimum amount of shared hits required, as a percentage of either the reconstructed hits or simulated hits (see SimToRecoDenominator), for the track to be considered associated during a call to associateSimToReco. See also AbsoluteNumberOfHits.
Purity_SimToReco - double - The minimum amount of shared hits required, as a percentage of the reconstructed hits, for the track to be considered associated during a call to associateSimToReco. Has no effect if AbsoluteNumberOfHits is true.
Cut_RecoToSim - double - The minimum amount of shared hits required, as a percentage of the reconstructed hits, for the track to be considered associated during a call to associateRecoToSim. See also AbsoluteNumberOfHits.
ThreeHitTracksAreSpecial - bool - If true, tracks with 3 hits must have all their hits associated.
SimToRecoDenominator - string - Must be either "sim" or "reco". If "sim" Quality_SimToReco is the percentage of simulated hits that need to be shared. If "reco" then it's the percentage of reconstructed hits (i.e. same as Purity_SimToReco).
associatePixel - bool - Passed on to the hit associator.
associateStrip - bool - Passed on to the hit associator.
Note that the TrackAssociatorByHits parameters UseGrouped and UseSplitting are not used.
Definition at line 49 of file QuickTrackAssociatorByHits.h.
|
private |
Definition at line 73 of file QuickTrackAssociatorByHits.h.
|
private |
Enumerator | |
---|---|
denomnone | |
denomsim | |
denomreco |
Definition at line 74 of file QuickTrackAssociatorByHits.h.
QuickTrackAssociatorByHits::QuickTrackAssociatorByHits | ( | const edm::ParameterSet & | config | ) |
Definition at line 6 of file QuickTrackAssociatorByHits.cc.
References edm::ParameterSet::addParameter(), denomreco, denomsim, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), hitAssociatorParameters_, and simToRecoDenominator_.
QuickTrackAssociatorByHits::~QuickTrackAssociatorByHits | ( | ) |
Definition at line 52 of file QuickTrackAssociatorByHits.cc.
References pHitAssociator_.
QuickTrackAssociatorByHits::QuickTrackAssociatorByHits | ( | const QuickTrackAssociatorByHits & | otherAssociator | ) |
Definition at line 57 of file QuickTrackAssociatorByHits.cc.
References NULL, and pHitAssociator_.
|
virtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 110 of file QuickTrackAssociatorByHits.cc.
References associateRecoToSimImplementation(), initialiseHitAssociator(), NULL, pTrackCollection_, pTrackCollectionHandle_, pTrackingParticleCollection_, and pTrackingParticleCollectionHandle_.
|
virtual |
Association Reco To Sim with Collections.
Implements TrackAssociatorBase.
Definition at line 141 of file QuickTrackAssociatorByHits.cc.
References associateRecoToSimImplementation(), initialiseHitAssociator(), NULL, pTrackCollection_, pTrackCollectionHandle_, pTrackingParticleCollection_, and pTrackingParticleCollectionHandle_.
|
private |
The method that does the work for both overloads of associateRecoToSim.
Definition at line 171 of file QuickTrackAssociatorByHits.cc.
References abs, absoluteNumberOfHits_, associateTrack(), cutRecoToSim_, reco::Track::found(), getDoubleCount(), i, edm::AssociationMap< Tag >::insert(), edm::Handle< T >::product(), pTrackCollection_, pTrackCollectionHandle_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), edm::RefToBaseVector< T >::size(), and threeHitTracksAreSpecial_.
Referenced by associateRecoToSim().
|
virtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 125 of file QuickTrackAssociatorByHits.cc.
References associateSimToRecoImplementation(), initialiseHitAssociator(), NULL, pTrackCollection_, pTrackCollectionHandle_, pTrackingParticleCollection_, and pTrackingParticleCollectionHandle_.
|
virtual |
Association Sim To Reco with Collections.
Implements TrackAssociatorBase.
Definition at line 156 of file QuickTrackAssociatorByHits.cc.
References associateSimToRecoImplementation(), initialiseHitAssociator(), NULL, pTrackCollection_, pTrackCollectionHandle_, pTrackingParticleCollection_, and pTrackingParticleCollectionHandle_.
|
private |
The method that does the work for both overloads of associateSimToReco.
Definition at line 218 of file QuickTrackAssociatorByHits.cc.
References absoluteNumberOfHits_, associateTrack(), denomreco, denomsim, reco::Track::found(), i, edm::AssociationMap< Tag >::insert(), edm::Handle< T >::product(), pTrackCollection_, pTrackCollectionHandle_, puritySimToReco_, qualitySimToReco_, simToRecoDenominator_, edm::RefToBaseVector< T >::size(), threeHitTracksAreSpecial_, and DetId::Tracker.
Referenced by associateSimToReco().
|
private |
Returns the TrackingParticle that has the most associated hits to the given track.
Return value is a vector of pairs, where first is an edm::Ref to the associated TrackingParticle, and second is the number of associated hits.
Definition at line 272 of file QuickTrackAssociatorByHits.cc.
References getAllSimTrackIdentifiers(), i, edm::Handle< T >::product(), pTrackingParticleCollection_, pTrackingParticleCollectionHandle_, edm::RefVector< C, T, F >::size(), trackingParticleContainsIdentifier(), and TrackingParticle::trackPSimHit().
Referenced by associateRecoToSimImplementation(), and associateSimToRecoImplementation().
|
private |
Returns a vector of pairs where first is a SimTrackIdentifiers (see typedef above) and second is the number of hits that came from that sim track.
This is used so that the TrackingParticle collection only has to be looped over once to search for each sim track, rather than once per hit. E.g. If all the hits in the reco track come from the same sim track, then there will only be one entry with second as the number of hits in the track.
Definition at line 314 of file QuickTrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), pHitAssociator_, reco::Track::recHitsBegin(), and reco::Track::recHitsEnd().
Referenced by associateTrack().
|
private |
This method was copied almost verbatim from the standard TrackAssociatorByHits.
Definition at line 369 of file QuickTrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), spr::find(), TrackingParticle::g4Track_begin(), TrackingParticle::g4Track_end(), and pHitAssociator_.
Referenced by associateRecoToSimImplementation().
|
private |
Definition at line 401 of file QuickTrackAssociatorByHits.cc.
References hitAssociatorParameters_, pEventForWhichAssociatorIsValid_, and pHitAssociator_.
Referenced by associateRecoToSim(), and associateSimToReco().
QuickTrackAssociatorByHits & QuickTrackAssociatorByHits::operator= | ( | const QuickTrackAssociatorByHits & | otherAssociator | ) |
Definition at line 83 of file QuickTrackAssociatorByHits.cc.
References absoluteNumberOfHits_, cutRecoToSim_, hitAssociatorParameters_, NULL, pEventForWhichAssociatorIsValid_, pHitAssociator_, pTrackCollection_, pTrackCollectionHandle_, pTrackingParticleCollection_, pTrackingParticleCollectionHandle_, puritySimToReco_, qualitySimToReco_, simToRecoDenominator_, and threeHitTracksAreSpecial_.
|
private |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers.
Definition at line 352 of file QuickTrackAssociatorByHits.cc.
References TrackingParticle::g4Track_begin(), and TrackingParticle::g4Track_end().
Referenced by associateTrack().
|
private |
Definition at line 115 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSimImplementation(), associateSimToRecoImplementation(), and operator=().
|
private |
Definition at line 118 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSimImplementation(), and operator=().
|
private |
Definition at line 113 of file QuickTrackAssociatorByHits.h.
Referenced by initialiseHitAssociator(), operator=(), and QuickTrackAssociatorByHits().
|
mutableprivate |
Definition at line 110 of file QuickTrackAssociatorByHits.h.
Referenced by initialiseHitAssociator(), and operator=().
|
mutableprivate |
Definition at line 109 of file QuickTrackAssociatorByHits.h.
Referenced by getAllSimTrackIdentifiers(), getDoubleCount(), initialiseHitAssociator(), operator=(), QuickTrackAssociatorByHits(), and ~QuickTrackAssociatorByHits().
|
mutableprivate |
Pointer to the track collection.
Either this or pTrackCollectionHandle_ will be set, the other will be Null. See the comment on pTrackCollectionHandle_ for reasons why.
Definition at line 137 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), associateSimToRecoImplementation(), and operator=().
|
mutableprivate |
Pointer to the handle to the track collection.
Only one of pTrackCollectionHandle_ or pTrackCollection_ will ever be non Null. This is so that both flavours of the associateRecoToSim (one takes a Handle, the other a RefToBaseVector) can use the same associateRecoToSimImplementation method and keep the logic for both in one place. The old implementation for the handle flavour copied everything into a new RefToBaseVector, wasting memory. I tried to do something clever with templates but couldn't get it to work, so the associateRecoToSimImplementation method checks which is non Null and uses that to get the tracks.
Definition at line 130 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), associateSimToRecoImplementation(), and operator=().
|
mutableprivate |
Pointer to the TrackingParticle collection handle.
Either this or pTrackingParticleCollectionHandle_ will be set, the other will be Null. See the comment on pTrackCollectionHandle_ for reasons why.
Definition at line 151 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateSimToReco(), associateTrack(), and operator=().
|
mutableprivate |
Pointer to the TrackingParticle collection handle.
Either this or pTrackingParticleCollection_ will be set, the other will be Null. See the comment on pTrackCollectionHandle_ for reasons why.
Definition at line 144 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateSimToReco(), associateTrack(), and operator=().
|
private |
Definition at line 117 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToRecoImplementation(), and operator=().
|
private |
Definition at line 116 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToRecoImplementation(), and operator=().
|
private |
Definition at line 120 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToRecoImplementation(), operator=(), and QuickTrackAssociatorByHits().
|
private |
Definition at line 119 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSimImplementation(), associateSimToRecoImplementation(), and operator=().