TrackToTrackingParticleAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHitsImpl class. More...
#include <QuickTrackAssociatorByHitsImpl.h>
Public Types | |
enum | SimToRecoDenomType { denomnone, denomsim, denomreco } |
Private Types | |
typedef std::pair< uint32_t, EncodedEventId > | SimTrackIdentifiers |
This is enough information to uniquely identify a sim track. More... | |
typedef edm::IndexSet | TrackingParticleRefKeySet |
Set for TrackingParticleRef keys. More... | |
Private Member Functions | |
template<class T_TrackCollection , class T_TrackingParticleCollection , class T_hitOrClusterAssociator > | |
reco::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. More... | |
template<class T_TrackCollection , class T_TrackingParticleCollection , class T_hitOrClusterAssociator > | |
reco::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. More... | |
template<typename T_TPCollection , typename iter > | |
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. More... | |
template<typename T_TPCollection , typename iter > | |
std::vector< std::pair< edm::Ref< TrackingParticleCollection >, double > > | associateTrack (const ClusterTPAssociation &clusterToTPMap, 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. More... | |
template<typename iter > | |
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 number of hits that came from that sim track. More... | |
template<typename iter > | |
double | 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 > | |
double | getDoubleCount (const ClusterTPAssociation &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 |
bool | trackingParticleContainsIdentifier (const TrackingParticle *pTrackingParticle, const SimTrackIdentifiers &identifier) const |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers. More... | |
double | weightedNumberOfTrackClusters (const reco::Track &track, const TrackerHitAssociator &) const |
double | weightedNumberOfTrackClusters (const TrajectorySeed &seed, const TrackerHitAssociator &) const |
double | weightedNumberOfTrackClusters (const reco::Track &track, const ClusterTPAssociation &) const |
double | weightedNumberOfTrackClusters (const TrajectorySeed &seed, const ClusterTPAssociation &) const |
template<typename iter > | |
double | weightedNumberOfTrackClusters (iter begin, iter end) const |
Static Private Member Functions | |
static bool | tpIntPairGreater (std::pair< edm::Ref< TrackingParticleCollection >, size_t > i, std::pair< edm::Ref< TrackingParticleCollection >, size_t > j) |
Private Attributes | |
bool | absoluteNumberOfHits_ |
const ClusterTPAssociation * | clusterToTPMap_ |
double | cutRecoToSim_ |
std::unique_ptr< const TrackerHitAssociator > | hitAssociator_ |
double | pixelHitWeight_ |
edm::EDProductGetter const * | productGetter_ |
creates either a ClusterTPAssociation OR a TrackerHitAssociator and stores it in the provided unique_ptr. The other will be null. More... | |
double | puritySimToReco_ |
double | qualitySimToReco_ |
SimToRecoDenomType | simToRecoDenominator_ |
bool | threeHitTracksAreSpecial_ |
TrackToTrackingParticleAssociator that associates by hits a bit quicker than the normal TrackAssociatorByHitsImpl 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 TrackAssociatorByHitsImpl, but faster. I've tested it a fair bit and can't find any differences between the results of this and the standard TrackAssociatorByHitsImpl.
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 TrackAssociatorByHitsImpl 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 TrackAssociatorByHitsImpl parameters UseGrouped and UseSplitting are not used.
Definition at line 66 of file QuickTrackAssociatorByHitsImpl.h.
|
private |
This is enough information to uniquely identify a sim track.
Definition at line 101 of file QuickTrackAssociatorByHitsImpl.h.
Set for TrackingParticleRef keys.
Definition at line 103 of file QuickTrackAssociatorByHitsImpl.h.
Enumerator | |
---|---|
denomnone | |
denomsim | |
denomreco |
Definition at line 69 of file QuickTrackAssociatorByHitsImpl.h.
QuickTrackAssociatorByHitsImpl::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 | ||
) |
Definition at line 104 of file QuickTrackAssociatorByHitsImpl.cc.
|
overridevirtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 128 of file QuickTrackAssociatorByHitsImpl.cc.
References associateRecoToSimImplementation(), clusterToTPMap_, and hitAssociator_.
|
overridevirtual |
Association Reco To Sim with Collections.
Implements reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 144 of file QuickTrackAssociatorByHitsImpl.cc.
References associateRecoToSimImplementation(), clusterToTPMap_, and hitAssociator_.
|
overridevirtual |
Reimplemented from reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 608 of file QuickTrackAssociatorByHitsImpl.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), clusterToTPMap_, cutRecoToSim_, getDoubleCount(), hitAssociator_, mps_fire::i, edm::AssociationMap< Tag >::insert(), LogTrace, TrajectorySeed::nHits(), edm::AssociationMap< Tag >::post_insert(), productGetter_, btvTracks_cfi::quality, TrajectorySeed::recHits(), edm::AssociationMap< Tag >::size(), threeHitTracksAreSpecial_, and weightedNumberOfTrackClusters().
|
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 170 of file QuickTrackAssociatorByHitsImpl.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), cutRecoToSim_, getDoubleCount(), mps_fire::i, edm::AssociationMap< Tag >::insert(), reco::TrackBase::numberOfValidHits(), edm::AssociationMap< Tag >::post_insert(), productGetter_, btvTracks_cfi::quality, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), threeHitTracksAreSpecial_, and weightedNumberOfTrackClusters().
Referenced by associateRecoToSim().
|
overridevirtual |
compare reco to sim the handle of reco::Track and TrackingParticle collections
Reimplemented from reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 136 of file QuickTrackAssociatorByHitsImpl.cc.
References associateSimToRecoImplementation(), clusterToTPMap_, and hitAssociator_.
|
overridevirtual |
Association Sim To Reco with Collections.
Implements reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 156 of file QuickTrackAssociatorByHitsImpl.cc.
References associateSimToRecoImplementation(), clusterToTPMap_, and hitAssociator_.
|
overridevirtual |
Reimplemented from reco::TrackToTrackingParticleAssociatorBaseImpl.
Definition at line 661 of file QuickTrackAssociatorByHitsImpl.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), clusterToTPMap_, denomreco, denomsim, getDoubleCount(), hitAssociator_, mps_fire::i, edm::AssociationMap< Tag >::insert(), LogTrace, edm::AssociationMap< Tag >::post_insert(), productGetter_, puritySimToReco_, btvTracks_cfi::quality, qualitySimToReco_, TrajectorySeed::recHits(), simToRecoDenominator_, edm::AssociationMap< Tag >::size(), threeHitTracksAreSpecial_, and weightedNumberOfTrackClusters().
|
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 220 of file QuickTrackAssociatorByHitsImpl.cc.
References funct::abs(), absoluteNumberOfHits_, associateTrack(), denomreco, denomsim, getDoubleCount(), mps_fire::i, edm::AssociationMap< Tag >::insert(), edm::AssociationMap< Tag >::post_insert(), productGetter_, puritySimToReco_, btvTracks_cfi::quality, qualitySimToReco_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), simToRecoDenominator_, threeHitTracksAreSpecial_, and weightedNumberOfTrackClusters().
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 282 of file QuickTrackAssociatorByHitsImpl.cc.
References getAllSimTrackIdentifiers(), mps_fire::i, 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 323 of file QuickTrackAssociatorByHitsImpl.cc.
References ClusterTPAssociation::empty(), ClusterTPAssociation::equal_range(), getMatchedClusters(), edm::IndexSet::has(), edm::Ref< C, T, F >::key(), and pixelHitWeight_.
|
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 453 of file QuickTrackAssociatorByHitsImpl.cc.
References TrackerHitAssociator::associateHitId(), end, TrackingRecHit::geographicalId(), getHitFromIter(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHitWeight_, DetId::subdetId(), and mps_merge::weight.
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 514 of file QuickTrackAssociatorByHitsImpl.cc.
References TrackerHitAssociator::associateHitId(), spr::find(), TrackingRecHit::geographicalId(), getHitFromIter(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHitWeight_, and DetId::subdetId().
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Overload for when using cluster to TrackingParticle association list.
Definition at line 556 of file QuickTrackAssociatorByHitsImpl.cc.
References ClusterTPAssociation::equal_range(), TrackingRecHit::geographicalId(), getHitFromIter(), getMatchedClusters(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHitWeight_, and DetId::subdetId().
|
inlineprivate |
Definition at line 166 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by getAllSimTrackIdentifiers(), getDoubleCount(), getMatchedClusters(), and weightedNumberOfTrackClusters().
|
inlineprivate |
Definition at line 170 of file QuickTrackAssociatorByHitsImpl.h.
References SurveyInfoScenario_cff::seed, and HiIsolationCommonParameters_cff::track.
|
private |
Definition at line 397 of file QuickTrackAssociatorByHitsImpl.cc.
References SiStripRecHit1D::cluster(), Phase2TrackerRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), end, TrackingRecHit::geographicalId(), getHitFromIter(), edm::Ref< C, T, F >::isNonnull(), TrackingRecHit::isValid(), 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(), getDoubleCount(), and weightedNumberOfTrackClusters().
|
inlinestaticprivate |
Definition at line 106 of file QuickTrackAssociatorByHitsImpl.h.
References begin, end, TrackQuality_cff::hitAssociator, mps_fire::i, and trackingTruthProducer_cfi::trackingParticles.
|
private |
Returns true if the supplied TrackingParticle has the supplied g4 track identifiers.
Definition at line 496 of file QuickTrackAssociatorByHitsImpl.cc.
References TrackingParticle::g4Track_begin(), and TrackingParticle::g4Track_end().
Referenced by associateTrack().
|
private |
Definition at line 734 of file QuickTrackAssociatorByHitsImpl.cc.
References reco::TrackBase::hitPattern(), reco::HitPattern::numberOfValidHits(), reco::HitPattern::numberOfValidPixelHits(), AlCaHLTBitMon_ParallelJobs::p, NuclearInteractionSecond_cff::pixelHits, and pixelHitWeight_.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), associateSimToRecoImplementation(), and weightedNumberOfTrackClusters().
|
private |
Definition at line 741 of file QuickTrackAssociatorByHitsImpl.cc.
References TrackingRecHit::geographicalId(), getHitFromIter(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHitWeight_, TrajectorySeed::recHits(), DetId::subdetId(), and mps_merge::weight.
|
private |
Definition at line 752 of file QuickTrackAssociatorByHitsImpl.cc.
References reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), and weightedNumberOfTrackClusters().
|
private |
Definition at line 755 of file QuickTrackAssociatorByHitsImpl.cc.
References TrajectorySeed::recHits(), and weightedNumberOfTrackClusters().
|
private |
Definition at line 760 of file QuickTrackAssociatorByHitsImpl.cc.
References end, TrackingRecHit::geographicalId(), getHitFromIter(), getMatchedClusters(), LogTrace, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelHitWeight_, DetId::rawId(), DetId::subdetId(), and mps_merge::weight.
|
private |
Definition at line 208 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 200 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), and associateSimToReco().
|
private |
Definition at line 205 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), and associateRecoToSimImplementation().
|
private |
Definition at line 199 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), and associateSimToReco().
|
private |
Definition at line 204 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateTrack(), getAllSimTrackIdentifiers(), getDoubleCount(), and weightedNumberOfTrackClusters().
|
private |
creates either a ClusterTPAssociation OR a TrackerHitAssociator and stores it in the provided unique_ptr. The other will be null.
A decision is made whether to create a ClusterTPAssociation or a TrackerHitAssociator depending on how this track associator was configured. If the ClusterTPAssociation 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 198 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 203 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 202 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 206 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateSimToReco(), and associateSimToRecoImplementation().
|
private |
Definition at line 207 of file QuickTrackAssociatorByHitsImpl.h.
Referenced by associateRecoToSim(), associateRecoToSimImplementation(), associateSimToReco(), and associateSimToRecoImplementation().