TrackAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHits class. More...
#include <QuickTrackAssociatorByHits.h>
Private Types | |
typedef std::vector< std::pair < OmniClusterRef, TrackingParticleRef > > | ClusterTPAssociationList |
enum | SimToRecoDenomType { denomnone, denomsim, denomreco } |
typedef std::pair< uint32_t, EncodedEventId > | SimTrackIdentifiers |
This is enough information to uniquely identify a sim track. More... | |
Private Member Functions | |
template<class T_TrackCollection , class T_TrackingParticleCollection , class T_hitOrClusterAssociator > | |
reco::RecoToSimCollection | associateRecoToSimImplementation (T_TrackCollection trackCollection, T_TrackingParticleCollection trackingParticleCollection, T_hitOrClusterAssociator hitOrClusterAssociator) const |
The method that does the work for both overloads of associateRecoToSim. More... | |
template<class T_TrackCollection , class T_TrackingParticleCollection , class T_hitOrClusterAssociator > | |
reco::SimToRecoCollection | associateSimToRecoImplementation (T_TrackCollection trackCollection, T_TrackingParticleCollection trackingParticleCollection, T_hitOrClusterAssociator hitOrClusterAssociator) const |
The method that does the work for both overloads of associateSimToReco. More... | |
template<typename T_TPCollection , typename iter > | |
std::vector< std::pair < edm::Ref < TrackingParticleCollection > , size_t > > | associateTrack (const TrackerHitAssociator &hitAssociator, T_TPCollection trackingParticles, iter begin, iter end) const |
Returns the TrackingParticle that has the most associated hits to the given track. More... | |
template<typename T_TPCollection , typename iter > | |
std::vector< std::pair < edm::Ref < TrackingParticleCollection > , size_t > > | associateTrack (const ClusterTPAssociationList &clusterToTPMap, T_TPCollection trackingParticles, iter begin, iter end) const |
Returns the TrackingParticle that has the most associated hits to the given track. More... | |
template<typename iter > | |
std::vector< std::pair < SimTrackIdentifiers, size_t > > | 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 number of hits that came from that sim track. More... | |
template<typename iter > | |
int | getDoubleCount (const TrackerHitAssociator &hitAssociator, iter begin, iter end, TrackingParticleRef associatedTrackingParticle) const |
This method was copied almost verbatim from the standard TrackAssociatorByHits. More... | |
template<typename iter > | |
int | getDoubleCount (const ClusterTPAssociationList &clusterToTPList, iter begin, iter end, TrackingParticleRef associatedTrackingParticle) const |
Overload for when using cluster to TrackingParticle association list. More... | |
const TrackingRecHit * | getHitFromIter (trackingRecHit_iterator iter) const |
const TrackingRecHit * | getHitFromIter (TrackingRecHitCollection::const_iterator iter) const |
template<typename iter > | |
std::vector< OmniClusterRef > | getMatchedClusters (iter begin, iter end) const |
void | prepareEitherHitAssociatorOrClusterToTPMap (const edm::Event *pEvent, std::unique_ptr< ClusterTPAssociationList > &pClusterToTPMap, std::unique_ptr< TrackerHitAssociator > &pHitAssociator) const |
creates either a ClusterTPAssociationList OR a TrackerHitAssociator and stores it in the provided unique_ptr. The other will be null. More... | |
bool | trackingParticleContainsIdentifier (const TrackingParticle *pTrackingParticle, const SimTrackIdentifiers &identifier) const |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers. More... | |
Static Private Member Functions | |
static bool | clusterTPAssociationListGreater (std::pair< OmniClusterRef, TrackingParticleRef > i, std::pair< OmniClusterRef, TrackingParticleRef > j) |
static bool | tpIntPairGreater (std::pair< edm::Ref< TrackingParticleCollection >, size_t > i, std::pair< edm::Ref< TrackingParticleCollection >, size_t > j) |
Private Attributes | |
bool | absoluteNumberOfHits_ |
edm::InputTag | cluster2TPSrc_ |
double | cutRecoToSim_ |
edm::ParameterSet | hitAssociatorParameters_ |
double | puritySimToReco_ |
double | qualitySimToReco_ |
SimToRecoDenomType | simToRecoDenominator_ |
bool | threeHitTracksAreSpecial_ |
bool | useClusterTPAssociation_ |
TrackAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHits class.
NOTE - Doesn't implement the 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.
requireStoredHits - bool - Whether or not to insist all TrackingParticles have at least one PSimHit. The PSimHits are not required for the association, but the old TrackAssociatorByHits still had this requirement. Storing PSimHits in the TrackingParticle is now optional (see TrackingTruthAccumulator which replaces TrackingTruthProducer). Having requireStoredHits set to true will mean no TrackingParticles will be associated if you have chosen not to store the hits. The flag is only kept in order to retain the old behaviour which can give very slightly different results.
Note that the TrackAssociatorByHits parameters UseGrouped and UseSplitting are not used.
Definition at line 62 of file QuickTrackAssociatorByHits.h.
|
private |
Definition at line 107 of file QuickTrackAssociatorByHits.h.
|
private |
This is enough information to uniquely identify a sim track.
Definition at line 103 of file QuickTrackAssociatorByHits.h.
|
private |
Enumerator | |
---|---|
denomnone | |
denomsim | |
denomreco |
Definition at line 104 of file QuickTrackAssociatorByHits.h.
QuickTrackAssociatorByHits::QuickTrackAssociatorByHits | ( | const edm::ParameterSet & | config | ) |
Definition at line 89 of file QuickTrackAssociatorByHits.cc.
References edm::ParameterSet::addParameter(), denomreco, denomsim, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), hitAssociatorParameters_, simToRecoDenominator_, and AlCaHLTBitMon_QueryRunRegistry::string.
QuickTrackAssociatorByHits::~QuickTrackAssociatorByHits | ( | ) |
Definition at line 136 of file QuickTrackAssociatorByHits.cc.
|
overridevirtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 141 of file QuickTrackAssociatorByHits.cc.
References associateRecoToSimImplementation(), and prepareEitherHitAssociatorOrClusterToTPMap().
|
overridevirtual |
Association Reco To Sim with Collections.
Implements TrackAssociatorBase.
Definition at line 167 of file QuickTrackAssociatorByHits.cc.
References associateRecoToSimImplementation(), and prepareEitherHitAssociatorOrClusterToTPMap().
|
overridevirtual |
Reimplemented from TrackAssociatorBase.
Definition at line 601 of file QuickTrackAssociatorByHits.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), cutRecoToSim_, getDoubleCount(), i, edm::AssociationMap< Tag >::insert(), LogTrace, edm::AssociationMap< Tag >::post_insert(), prepareEitherHitAssociatorOrClusterToTPMap(), TrajectorySeed::recHits(), edm::AssociationMap< Tag >::size(), and threeHitTracksAreSpecial_.
|
private |
The method that does the work for both overloads of associateRecoToSim.
Parts that actually rely on the type of the collections are delegated out to overloaded functions in the unnamed namespace of the .cc file. Parts that rely on the type of T_hitOrClusterAssociator are delegated out to overloaded methods.
Definition at line 195 of file QuickTrackAssociatorByHits.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), cutRecoToSim_, reco::Track::found(), getDoubleCount(), i, edm::AssociationMap< Tag >::insert(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), and threeHitTracksAreSpecial_.
Referenced by associateRecoToSim().
|
overridevirtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from TrackAssociatorBase.
Definition at line 154 of file QuickTrackAssociatorByHits.cc.
References associateSimToRecoImplementation(), and prepareEitherHitAssociatorOrClusterToTPMap().
|
overridevirtual |
Association Sim To Reco with Collections.
Implements TrackAssociatorBase.
Definition at line 180 of file QuickTrackAssociatorByHits.cc.
References associateSimToRecoImplementation(), and prepareEitherHitAssociatorOrClusterToTPMap().
|
overridevirtual |
Reimplemented from TrackAssociatorBase.
Definition at line 669 of file QuickTrackAssociatorByHits.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), denomreco, denomsim, getDoubleCount(), i, edm::AssociationMap< Tag >::insert(), LogTrace, edm::AssociationMap< Tag >::post_insert(), prepareEitherHitAssociatorOrClusterToTPMap(), puritySimToReco_, qualitySimToReco_, TrajectorySeed::recHits(), simToRecoDenominator_, edm::AssociationMap< Tag >::size(), and threeHitTracksAreSpecial_.
|
private |
The method that does the work for both overloads of associateSimToReco.
Parts that actually rely on the type of the collections are delegated out to overloaded functions in the unnamed namespace of the .cc file. Parts that rely on the type of T_hitOrClusterAssociator are delegated out to overloaded methods.
Definition at line 244 of file QuickTrackAssociatorByHits.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), denomreco, denomsim, reco::Track::found(), getDoubleCount(), i, edm::AssociationMap< Tag >::insert(), puritySimToReco_, qualitySimToReco_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), simToRecoDenominator_, and threeHitTracksAreSpecial_.
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 302 of file QuickTrackAssociatorByHits.cc.
References getAllSimTrackIdentifiers(), i, TrackingParticle::numberOfHits(), and trackingParticleContainsIdentifier().
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Returns the TrackingParticle that has the most associated hits to the given track.
See the notes for the other overload for the return type.
Note that the trackingParticles parameter is not actually required since all the information is in clusterToTPMap, but the method signature has to match the other overload because it is called from a templated method.
Definition at line 371 of file QuickTrackAssociatorByHits.cc.
References clusterTPAssociationListGreater(), and getMatchedClusters().
|
inlinestaticprivate |
Definition at line 108 of file QuickTrackAssociatorByHits.h.
Referenced by associateTrack(), getDoubleCount(), and prepareEitherHitAssociatorOrClusterToTPMap().
|
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 476 of file QuickTrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), end, getHitFromIter(), and getDQMSummary::iter.
Referenced by associateTrack().
|
private |
This method was copied almost verbatim from the standard TrackAssociatorByHits.
Modified 01/May/2014 to take the TrackerHitAssociator as a parameter rather than using a member.
Definition at line 533 of file QuickTrackAssociatorByHits.cc.
References TrackerHitAssociator::associateHitId(), spr::find(), getHitFromIter(), and getDQMSummary::iter.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Overload for when using cluster to TrackingParticle association list.
Definition at line 565 of file QuickTrackAssociatorByHits.cc.
References clusterTPAssociationListGreater(), getMatchedClusters(), and getDQMSummary::iter.
|
inlineprivate |
Definition at line 169 of file QuickTrackAssociatorByHits.h.
Referenced by getAllSimTrackIdentifiers(), getDoubleCount(), and getMatchedClusters().
|
inlineprivate |
Definition at line 173 of file QuickTrackAssociatorByHits.h.
|
private |
Definition at line 430 of file QuickTrackAssociatorByHits.cc.
References SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), end, TrackingRecHit::geographicalId(), getHitFromIter(), edm::Ref< C, T, F >::isNonnull(), TrackingRecHit::isValid(), getDQMSummary::iter, SiStripMatchedRecHit2D::monoClusterRef(), SiStripMatchedRecHit2D::monoHit(), TrackerSingleRecHit::omniClusterRef(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiStripMatchedRecHit2D::stereoClusterRef(), SiStripMatchedRecHit2D::stereoHit(), DetId::subdetId(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.
Referenced by associateTrack(), and getDoubleCount().
|
private |
creates either a ClusterTPAssociationList OR a TrackerHitAssociator and stores it in the provided unique_ptr. The other will be null.
A decision is made whether to create a ClusterTPAssociationList or a TrackerHitAssociator depending on how this track associator was configured. If the ClusterTPAssociationList couldn't be fetched from the event then it falls back to creating a TrackerHitAssociator.
Only one type will be created, never both. The other unique_ptr reference will be null so check for that and decide which to use.
N.B. The value of useClusterTPAssociation_ should not be used to decide which of the two pointers to use. If the cluster to TrackingParticle couldn't be retrieved from the event then pClusterToTPMap will be null but useClusterTPAssociation_ is no longer changed to false.
Definition at line 339 of file QuickTrackAssociatorByHits.cc.
References cluster2TPSrc_, clusterTPAssociationListGreater(), edm::Event::getByLabel(), hitAssociatorParameters_, edm::HandleBase::isValid(), edm::Handle< T >::product(), python.multivaluedict::sort(), and useClusterTPAssociation_.
Referenced by associateRecoToSim(), and associateSimToReco().
|
inlinestaticprivate |
Definition at line 109 of file QuickTrackAssociatorByHits.h.
|
private |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers.
Definition at line 515 of file QuickTrackAssociatorByHits.cc.
References TrackingParticle::g4Track_begin(), and TrackingParticle::g4Track_end().
Referenced by associateTrack().
|
private |
Definition at line 194 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 203 of file QuickTrackAssociatorByHits.h.
Referenced by prepareEitherHitAssociatorOrClusterToTPMap().
|
private |
Definition at line 197 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), and associateRecoToSimImplementation().
|
private |
Definition at line 192 of file QuickTrackAssociatorByHits.h.
Referenced by prepareEitherHitAssociatorOrClusterToTPMap(), and QuickTrackAssociatorByHits().
|
private |
Definition at line 196 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 195 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 199 of file QuickTrackAssociatorByHits.h.
Referenced by associateSimToReco(), associateSimToRecoImplementation(), and QuickTrackAssociatorByHits().
|
private |
Definition at line 198 of file QuickTrackAssociatorByHits.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 202 of file QuickTrackAssociatorByHits.h.
Referenced by prepareEitherHitAssociatorOrClusterToTPMap().