From 060d15883ada6d4b74e1d30cb31f339e527a18ad Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 19 Dec 2022 16:17:44 +0100 Subject: [PATCH 1/3] ClusterStorer: deal with the VectorHits case separately --- CommonTools/RecoAlgos/src/ClusterStorer.cc | 26 +++++++++++++++++++ .../TrackerRecHit2D/interface/VectorHit.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/CommonTools/RecoAlgos/src/ClusterStorer.cc b/CommonTools/RecoAlgos/src/ClusterStorer.cc index f23df0ace7ae6..af1ae6b4ca19a 100644 --- a/CommonTools/RecoAlgos/src/ClusterStorer.cc +++ b/CommonTools/RecoAlgos/src/ClusterStorer.cc @@ -182,4 +182,30 @@ namespace helper { (*cluRef) = OmniClusterRef(newRef); } + // ------------------------------------------------------------- + // Specific rekey for class template ClusterRefType = VectorHit::ClusterRef, + // RecHitType is not used. + template <> + template // or template<> to specialise also here? + void ClusterStorer::ClusterHitRecord:: + // rekey(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(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 diff --git a/DataFormats/TrackerRecHit2D/interface/VectorHit.h b/DataFormats/TrackerRecHit2D/interface/VectorHit.h index df0a771f686d8..2f54b77117c96 100644 --- a/DataFormats/TrackerRecHit2D/interface/VectorHit.h +++ b/DataFormats/TrackerRecHit2D/interface/VectorHit.h @@ -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; From fe0f8861dcb9c83db52cb2e760c0aa20136df852 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 19 Dec 2022 16:41:43 +0100 Subject: [PATCH 2/3] add SingleMuPt10Extended for VectorHit workflows --- .../PyReleaseValidation/python/upgradeWorkflowComponents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 4f3046fbdf09a..b012fd5f21a19 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -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', From 8195ef2e3cf0a1a75ac2486ea373222c9fdc1628 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 20 Dec 2022 10:44:13 +0100 Subject: [PATCH 3/3] make rekey non-const as per PR review --- CommonTools/RecoAlgos/interface/ClusterStorer.h | 2 +- CommonTools/RecoAlgos/src/ClusterStorer.cc | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CommonTools/RecoAlgos/interface/ClusterStorer.h b/CommonTools/RecoAlgos/interface/ClusterStorer.h index af9ff64161193..6066bbb1c4e1a 100644 --- a/CommonTools/RecoAlgos/interface/ClusterStorer.h +++ b/CommonTools/RecoAlgos/interface/ClusterStorer.h @@ -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 - void rekey(const ClusterRefType &newRef) const; + void rekey(const ClusterRefType &newRef); private: ClusterHitRecord() {} /// private => unusable diff --git a/CommonTools/RecoAlgos/src/ClusterStorer.cc b/CommonTools/RecoAlgos/src/ClusterStorer.cc index af1ae6b4ca19a..24db306e50b0f 100644 --- a/CommonTools/RecoAlgos/src/ClusterStorer.cc +++ b/CommonTools/RecoAlgos/src/ClusterStorer.cc @@ -105,7 +105,7 @@ namespace helper { edmNew::DetSetVector &dsvToFill, edm::RefProd > &refprod) { std::sort(clusterRecords.begin(), clusterRecords.end()); // this sorts them by detid - typedef typename std::vector >::const_iterator RIT; + typedef typename std::vector >::iterator RIT; RIT it = clusterRecords.begin(), end = clusterRecords.end(); size_t clusters = 0; while (it != end) { @@ -143,7 +143,7 @@ namespace helper { // generic rekey (in practise for pixel only...) template // template for class template // template for member function - void ClusterStorer::ClusterHitRecord::rekey(const ClusterRefType &newRef) const { + void ClusterStorer::ClusterHitRecord::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 @@ -159,9 +159,7 @@ namespace helper { // RecHitType is not used. template <> template // or template<> to specialise also here? - void ClusterStorer::ClusterHitRecord:: - // rekey(const SiStripRecHit2D::ClusterRef &newRef) const - rekey(const SiStripRecHit2D::ClusterRef &newRef) const { + void ClusterStorer::ClusterHitRecord::rekey(const SiStripRecHit2D::ClusterRef &newRef) { TrackingRecHit &genericHit = (*hits_)[index_]; const std::type_info &hit_type = typeid(genericHit); @@ -187,9 +185,7 @@ namespace helper { // RecHitType is not used. template <> template // or template<> to specialise also here? - void ClusterStorer::ClusterHitRecord:: - // rekey(const VectorHit::ClusterRef &newRef) const - rekey(const VectorHit::ClusterRef &newRef) const { + void ClusterStorer::ClusterHitRecord::rekey(const VectorHit::ClusterRef &newRef) { TrackingRecHit &genericHit = (*hits_)[index_]; const std::type_info &hit_type = typeid(genericHit);