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

Fix ClusterStorer for VectorHits #40363

Merged
merged 3 commits into from
Dec 21, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CommonTools/RecoAlgos/interface/ClusterStorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace helper {
/// Set the reference of the hit of this record to 'newRef',
/// will not modify the ref stored in this object.
template <typename RecHitType>
void rekey(const ClusterRefType &newRef) const;
void rekey(const ClusterRefType &newRef);

private:
ClusterHitRecord() {} /// private => unusable
Expand Down
32 changes: 27 additions & 5 deletions CommonTools/RecoAlgos/src/ClusterStorer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace helper {
edmNew::DetSetVector<ClusterType> &dsvToFill,
edm::RefProd<edmNew::DetSetVector<ClusterType> > &refprod) {
std::sort(clusterRecords.begin(), clusterRecords.end()); // this sorts them by detid
typedef typename std::vector<ClusterHitRecord<typename HitType::ClusterRef> >::const_iterator RIT;
typedef typename std::vector<ClusterHitRecord<typename HitType::ClusterRef> >::iterator RIT;
RIT it = clusterRecords.begin(), end = clusterRecords.end();
size_t clusters = 0;
while (it != end) {
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace helper {
// generic rekey (in practise for pixel only...)
template <typename ClusterRefType> // template for class
template <typename RecHitType> // template for member function
void ClusterStorer::ClusterHitRecord<ClusterRefType>::rekey(const ClusterRefType &newRef) const {
void ClusterStorer::ClusterHitRecord<ClusterRefType>::rekey(const ClusterRefType &newRef) {
TrackingRecHit &genericHit = (*hits_)[index_];
RecHitType *hit = nullptr;
if (genericHit.geographicalId().rawId() == detid_) { // a hit on this det, so it's simple
Expand All @@ -159,9 +159,7 @@ namespace helper {
// RecHitType is not used.
template <>
template <typename RecHitType> // or template<> to specialise also here?
void ClusterStorer::ClusterHitRecord<SiStripRecHit2D::ClusterRef>::
// rekey<SiStripRecHit2D>(const SiStripRecHit2D::ClusterRef &newRef) const
rekey(const SiStripRecHit2D::ClusterRef &newRef) const {
void ClusterStorer::ClusterHitRecord<SiStripRecHit2D::ClusterRef>::rekey(const SiStripRecHit2D::ClusterRef &newRef) {
TrackingRecHit &genericHit = (*hits_)[index_];
const std::type_info &hit_type = typeid(genericHit);

Expand All @@ -182,4 +180,28 @@ 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(const VectorHit::ClusterRef &newRef) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
stepDict[stepName][k] = merge([{'--procModifiers': 'vectorHits'}, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return fragment=="TTbar_14TeV" and '2026' in key
return (fragment=="TTbar_14TeV" or fragment=="SingleMuPt10Extended") and '2026' in key
upgradeWFs['vectorHits'] = UpgradeWorkflow_vectorHits(
steps = [
'RecoGlobal',
Expand Down
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