Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove check on TrackingParticle::numberOfHits()==0 from QuickTrackAssociatorByHits #17338

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -296,8 +296,12 @@ template<typename T_TPCollection,typename iter> std::vector<std::pair<edm::Ref<T
{
const TrackingParticle* pTrackingParticle=getTrackingParticleAt( trackingParticles, i );

// Ignore TrackingParticles with no hits
if( pTrackingParticle->numberOfHits()==0 ) continue;
// Historically there was a requirement that pTrackingParticle->numberOfHits() > 0
// However, in TrackingTruthAccumulator, the numberOfHits is calculated from a subset
// of the SimHits of the SimTracks of a TrackingParticle (essentially limiting the
// processType and particleType to those of the "first" hit, and particleType to the pdgId of the SimTrack).
// But, here the association between tracks and TrackingParticles is done with *all* the hits of
// TrackingParticle, so we should not rely on the numberOfHits() calculated with a subset of SimHits.

double numberOfAssociatedHits=0;
// Loop over all of the sim track identifiers and see if any of them are part of this TrackingParticle. If they are, add
Expand Down Expand Up @@ -356,8 +360,12 @@ template<typename T_TPCollection,typename iter> std::vector< std::pair<edm::Ref<
if(trackingParticleKeys && trackingParticleKeys->find(trackingParticle.key()) == trackingParticleKeys->end())
continue;

// Ignore TrackingParticles with no hits
if( trackingParticle->numberOfHits() == 0 ) continue;
// Historically there was a requirement that pTrackingParticle->numberOfHits() > 0
// However, in TrackingTruthAccumulator, the numberOfHits is calculated from a subset
// of the SimHits of the SimTracks of a TrackingParticle (essentially limiting the
// processType and particleType to those of the "first" hit, and particleType to the pdgId of the SimTrack).
// But, here the association between tracks and TrackingParticles is done with *all* the hits of
// TrackingParticle, so we should not rely on the numberOfHits() calculated with a subset of SimHits.

/* Alternative implementation to avoid the use of lmap... memory slightly improved but slightly slower...
std::pair<edm::Ref<TrackingParticleCollection>,size_t> tpIntPair(trackingParticle, 1);
Expand Down
1 change: 0 additions & 1 deletion Validation/RecoTrack/plugins/TrackingNtuple.cc
Expand Up @@ -1422,7 +1422,6 @@ TrackingNtuple::SimHitData TrackingNtuple::matchCluster(const OmniClusterRef& cl
auto tpIndex = tpKeyToIndex.find(trackingParticle.key());
if( tpIndex == tpKeyToIndex.end())
continue;
if( trackingParticle->numberOfHits() == 0 ) continue;

//now get the corresponding sim hit
std::pair<TrackingParticleRef, TrackPSimHitRef> simHitTPpairWithDummyTP(trackingParticle,TrackPSimHitRef());
Expand Down