Skip to content

Commit

Permalink
fix ClusterStorer::ClusterHitRecord<T>::rekey for Phase2TrackerRecHit1D
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Jan 17, 2023
1 parent a5ca8f8 commit b0f316a
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 b0f316a

Please sign in to comment.