Skip to content

Commit

Permalink
ClusterStorer: deal with the VectorHits case separately
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Dec 21, 2022
1 parent 19e04f4 commit 06b919b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions CommonTools/RecoAlgos/src/ClusterStorer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,30 @@ namespace helper {
(*cluRef) = OmniClusterRef(newRef);
}

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

OmniClusterRef *cluRef = nullptr;
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
assert(cluRef->key() == ref_.key()); // otherwise something went wrong
(*cluRef) = OmniClusterRef(newRef);
}

} // namespace helper
3 changes: 3 additions & 0 deletions DataFormats/TrackerRecHit2D/interface/VectorHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class VectorHit final : public BaseTrackerRecHit {
ClusterRef upperCluster() const { return theUpperCluster.cluster_phase2OT(); }
OmniClusterRef const lowerClusterRef() const { return theLowerCluster; }
OmniClusterRef const upperClusterRef() const { return theUpperCluster; }
// Non const variants needed for cluster re-keying
OmniClusterRef& lowerClusterRef() { return theLowerCluster; }
OmniClusterRef& upperClusterRef() { return theUpperCluster; }

//FIXME::to update with a proper CPE maybe...
Global3DPoint lowerGlobalPos() const;
Expand Down

0 comments on commit 06b919b

Please sign in to comment.