Skip to content

Commit

Permalink
Merge pull request #40559 from mmusich/fixClusterSorterForVectorHits_…
Browse files Browse the repository at this point in the history
…take2_12_5_X

[12.5.X] fix `ClusterStorer::ClusterHitRecord<T>::rekey` for `Phase2TrackerRecHit1D`
  • Loading branch information
cmsbuild authored Jan 21, 2023
2 parents 0aafec6 + 2c515df commit ce51745
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions CommonTools/RecoAlgos/src/ClusterStorer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,22 @@ namespace helper {
}

// -------------------------------------------------------------
// Specific rekey for class template ClusterRefType = VectorHit::ClusterRef,
// RecHitType is not used.
// Specific rekey for class template ClusterRefType = Phase2TrackerRecHit1D::ClusterRef
template <>
template <typename RecHitType> // or template<> to specialise also here?
void ClusterStorer::ClusterHitRecord<VectorHit::ClusterRef>::rekey(const VectorHit::ClusterRef &newRef) {
template <typename RecHitType>
void ClusterStorer::ClusterHitRecord<Phase2TrackerRecHit1D::ClusterRef>::rekey(
const Phase2TrackerRecHit1D::ClusterRef &newRef) {
TrackingRecHit &genericHit = (*hits_)[index_];
const std::type_info &hit_type = typeid(genericHit);

OmniClusterRef *cluRef = nullptr;
if (typeid(VectorHit) == hit_type) {
if (typeid(Phase2TrackerRecHit1D) == hit_type) {
cluRef = &static_cast<Phase2TrackerRecHit1D &>(genericHit).omniCluster();
} else if (typeid(VectorHit) == hit_type) {
VectorHit &vHit = static_cast<VectorHit &>(genericHit);
// FIXME: this essentially uses a hack
// https://github.com/cms-sw/cmssw/blob/master/DataFormats/TrackerCommon/interface/TrackerTopology.h#L291
cluRef = (SiStripDetId(detid_).stereo() ? &vHit.upperClusterRef() : &vHit.lowerClusterRef());
} else {
return;
}

assert(cluRef != nullptr); // to catch missing RecHit types
Expand Down

0 comments on commit ce51745

Please sign in to comment.