From de2e3def9d51d99758b3f28479f11709dfa434b8 Mon Sep 17 00:00:00 2001 From: Vinaya Date: Mon, 17 Feb 2025 13:18:37 +0100 Subject: [PATCH 1/6] update on strip approximate cluster --- .../python/Era_Run2024_approxSiStripCluster.py | 7 +++++++ .../interface/SiStripApproximateCluster.h | 14 ++++++++++---- .../src/SiStripApproximateCluster.cc | 7 +++++-- DataFormats/SiStripCluster/src/SiStripCluster.cc | 2 +- DataFormats/SiStripCluster/src/classes_def.xml | 5 ++++- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py mode change 100755 => 100644 DataFormats/SiStripCluster/src/classes_def.xml diff --git a/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py b/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py new file mode 100644 index 0000000000000..8bff5f0da3b0d --- /dev/null +++ b/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +from Configuration.ProcessModifiers.approxSiStripClusters_cff import approxSiStripClusters +from Configuration.ProcessModifiers.trackingNoLoopers_cff import trackingNoLoopers + +Run3_pp_on_PbPb_approxSiStripClusters_2024 = cms.ModifierChain(Run3_2024.copyAndExclude([trackingNoLoopers]), approxSiStripClusters) diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h index 15c932e1fcd44..bf0f60ce6a8de 100644 --- a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h @@ -2,19 +2,20 @@ #define DataFormats_SiStripCluster_SiStripApproximateCluster_h #include "FWCore/Utilities/interface/typedefs.h" +#include "assert.h" class SiStripCluster; class SiStripApproximateCluster { public: SiStripApproximateCluster() {} - explicit SiStripApproximateCluster(cms_uint16_t barycenter, + explicit SiStripApproximateCluster(cms_uint16_t compBarycenter, cms_uint8_t width, cms_uint8_t avgCharge, bool filter, bool isSaturated, bool peakFilter = false) - : barycenter_(barycenter), + : compBarycenter_(compBarycenter), width_(width), avgCharge_(avgCharge), filter_(filter), @@ -26,7 +27,10 @@ class SiStripApproximateCluster { float hitPredPos, bool peakFilter); - cms_uint16_t barycenter() const { return barycenter_; } + float barycenter() const { + float _barycenter = compBarycenter_ * maxBarycenter_/maxRange_; + assert(_barycenter <= maxBarycenter_ && "Returning barycenter > maxBarycenter"); + return _barycenter; } cms_uint8_t width() const { return width_; } cms_uint8_t avgCharge() const { return avgCharge_; } bool filter() const { return filter_; } @@ -34,12 +38,14 @@ class SiStripApproximateCluster { bool peakFilter() const { return peakFilter_; } private: - cms_uint16_t barycenter_ = 0; + cms_uint16_t compBarycenter_ = 0; cms_uint8_t width_ = 0; cms_uint8_t avgCharge_ = 0; bool filter_ = false; bool isSaturated_ = false; bool peakFilter_ = false; + static constexpr double maxRange_ = 65535.; //16 bit + static constexpr double maxBarycenter_ = 770.; static constexpr double trimMaxADC_ = 30.; static constexpr double trimMaxFracTotal_ = .15; static constexpr double trimMaxFracNeigh_ = .25; diff --git a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc index 01b30963a083a..d2c172486e8ec 100644 --- a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc +++ b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc @@ -2,14 +2,17 @@ #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include #include +#include SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat, float hitPredPos, bool peakFilter) { - barycenter_ = std::round(cluster.barycenter() * 10); + compBarycenter_ = std::round(cluster.barycenter() * maxRange_/maxBarycenter_); + assert(cluster.barycenter() <= maxBarycenter_ && "Got a barycenter > maxBarycenter"); + assert(compBarycenter_ <= maxRange_ && "Filling compBarycenter > maxRange"); width_ = cluster.size(); - avgCharge_ = cluster.charge() / cluster.size(); + avgCharge_ = (cluster.charge() + cluster.size()/2) / cluster.size(); filter_ = false; isSaturated_ = false; peakFilter_ = peakFilter; diff --git a/DataFormats/SiStripCluster/src/SiStripCluster.cc b/DataFormats/SiStripCluster/src/SiStripCluster.cc index 9deb73b4c4a22..09ad870307874 100644 --- a/DataFormats/SiStripCluster/src/SiStripCluster.cc +++ b/DataFormats/SiStripCluster/src/SiStripCluster.cc @@ -23,7 +23,7 @@ SiStripCluster::SiStripCluster(const SiStripDigiRange& range) : firstStrip_(rang } SiStripCluster::SiStripCluster(const SiStripApproximateCluster cluster, const uint16_t maxStrips) : error_x(-99999.9) { - barycenter_ = cluster.barycenter() / 10.0; + barycenter_ = cluster.barycenter(); charge_ = cluster.width() * cluster.avgCharge(); amplitudes_.resize(cluster.width(), cluster.avgCharge()); filter_ = cluster.filter(); diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml old mode 100755 new mode 100644 index fa475a9e1ae50..cc906b8cc4062 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -1,6 +1,7 @@ + @@ -25,7 +26,8 @@ - + + @@ -53,6 +55,7 @@ + From 3196799122caa4b77a7ac4b5895d68ded14de9f8 Mon Sep 17 00:00:00 2001 From: Vinaya Date: Mon, 17 Feb 2025 14:35:52 +0100 Subject: [PATCH 2/6] fix on classes_def.xml --- DataFormats/SiStripCluster/src/classes_def.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml index cc906b8cc4062..3e88aa2ca7870 100644 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -1,7 +1,6 @@ - @@ -55,7 +54,6 @@ - From 2bf3498e83b753d2cdc7e02f663e5bfd89dccc17 Mon Sep 17 00:00:00 2001 From: Vinaya Date: Mon, 17 Feb 2025 14:39:21 +0100 Subject: [PATCH 3/6] fix on code-check and code-format --- .../SiStripCluster/interface/SiStripApproximateCluster.h | 7 ++++--- .../SiStripCluster/src/SiStripApproximateCluster.cc | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h index bf0f60ce6a8de..e4b34b11c85c2 100644 --- a/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h +++ b/DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h @@ -28,9 +28,10 @@ class SiStripApproximateCluster { bool peakFilter); float barycenter() const { - float _barycenter = compBarycenter_ * maxBarycenter_/maxRange_; + float _barycenter = compBarycenter_ * maxBarycenter_ / maxRange_; assert(_barycenter <= maxBarycenter_ && "Returning barycenter > maxBarycenter"); - return _barycenter; } + return _barycenter; + } cms_uint8_t width() const { return width_; } cms_uint8_t avgCharge() const { return avgCharge_; } bool filter() const { return filter_; } @@ -44,7 +45,7 @@ class SiStripApproximateCluster { bool filter_ = false; bool isSaturated_ = false; bool peakFilter_ = false; - static constexpr double maxRange_ = 65535.; //16 bit + static constexpr double maxRange_ = 65535.; //16 bit static constexpr double maxBarycenter_ = 770.; static constexpr double trimMaxADC_ = 30.; static constexpr double trimMaxFracTotal_ = .15; diff --git a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc index d2c172486e8ec..cc483151e91f2 100644 --- a/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc +++ b/DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc @@ -1,18 +1,18 @@ #include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include +#include #include -#include SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat, float hitPredPos, bool peakFilter) { - compBarycenter_ = std::round(cluster.barycenter() * maxRange_/maxBarycenter_); + compBarycenter_ = std::round(cluster.barycenter() * maxRange_ / maxBarycenter_); assert(cluster.barycenter() <= maxBarycenter_ && "Got a barycenter > maxBarycenter"); assert(compBarycenter_ <= maxRange_ && "Filling compBarycenter > maxRange"); width_ = cluster.size(); - avgCharge_ = (cluster.charge() + cluster.size()/2) / cluster.size(); + avgCharge_ = (cluster.charge() + cluster.size() / 2) / cluster.size(); filter_ = false; isSaturated_ = false; peakFilter_ = peakFilter; From bec516a41f1665d2693725299198a1b9236eff68 Mon Sep 17 00:00:00 2001 From: Vinaya Date: Tue, 18 Feb 2025 10:54:32 +0100 Subject: [PATCH 4/6] renamed the config file --- Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py b/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py index 8bff5f0da3b0d..b56d057adff3d 100644 --- a/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py +++ b/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py @@ -4,4 +4,4 @@ from Configuration.ProcessModifiers.approxSiStripClusters_cff import approxSiStripClusters from Configuration.ProcessModifiers.trackingNoLoopers_cff import trackingNoLoopers -Run3_pp_on_PbPb_approxSiStripClusters_2024 = cms.ModifierChain(Run3_2024.copyAndExclude([trackingNoLoopers]), approxSiStripClusters) +Run3_2024_approxSiStripClusters = cms.ModifierChain(Run3_2024.copyAndExclude([trackingNoLoopers]), approxSiStripClusters) From 830a7c5e1f6d3ab839937769f475f34111002abc Mon Sep 17 00:00:00 2001 From: Vinaya Date: Tue, 18 Feb 2025 11:42:57 +0100 Subject: [PATCH 5/6] approx. cluster config updated --- .../Eras/python/Era_Run2024_approxSiStripCluster.py | 7 ------- .../Eras/python/Era_Run3_2024_approxSiStripClusters_cff.py | 6 ++++++ Configuration/StandardSequences/python/Eras.py | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py create mode 100644 Configuration/Eras/python/Era_Run3_2024_approxSiStripClusters_cff.py diff --git a/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py b/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py deleted file mode 100644 index b56d057adff3d..0000000000000 --- a/Configuration/Eras/python/Era_Run2024_approxSiStripCluster.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 -from Configuration.ProcessModifiers.approxSiStripClusters_cff import approxSiStripClusters -from Configuration.ProcessModifiers.trackingNoLoopers_cff import trackingNoLoopers - -Run3_2024_approxSiStripClusters = cms.ModifierChain(Run3_2024.copyAndExclude([trackingNoLoopers]), approxSiStripClusters) diff --git a/Configuration/Eras/python/Era_Run3_2024_approxSiStripClusters_cff.py b/Configuration/Eras/python/Era_Run3_2024_approxSiStripClusters_cff.py new file mode 100644 index 0000000000000..bc713d924a51d --- /dev/null +++ b/Configuration/Eras/python/Era_Run3_2024_approxSiStripClusters_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +from Configuration.ProcessModifiers.approxSiStripClusters_cff import approxSiStripClusters + +Run3_2024_approxSiStripClusters = cms.ModifierChain(Run3_2024, approxSiStripClusters) diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 32d766e0ab9bc..be248609c8510 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -44,6 +44,7 @@ def __init__(self): 'Run3_pp_on_PbPb_approxSiStripClusters_2023', 'Run3_pp_on_PbPb_2024', 'Run3_pp_on_PbPb_approxSiStripClusters_2024', + 'Run3_2024_approxSiStripClusters', 'Run3_dd4hep', 'Run3_DDD', 'Run3_FastSim', From c4e8c0c3b319754916b59e41cdf4dd98944c1b7d Mon Sep 17 00:00:00 2001 From: Vinaya Date: Tue, 18 Feb 2025 16:35:32 +0100 Subject: [PATCH 6/6] call the expected barycenter value --- .../test/TestReadSiStripApproximateClusterCollection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/SiStripCluster/test/TestReadSiStripApproximateClusterCollection.cc b/DataFormats/SiStripCluster/test/TestReadSiStripApproximateClusterCollection.cc index b85bf4c96b2ec..2d401eeabd649 100644 --- a/DataFormats/SiStripCluster/test/TestReadSiStripApproximateClusterCollection.cc +++ b/DataFormats/SiStripCluster/test/TestReadSiStripApproximateClusterCollection.cc @@ -77,7 +77,7 @@ namespace edmtest { unsigned int j = 0; for (const auto& cluster : detClusters) { unsigned int iOffset = j + iEvent.id().event(); - if (cluster.barycenter() != expectedIntegralValues_[1] + iOffset) { + if (std::round(cluster.barycenter() * 65535.0 / 770.0) != expectedIntegralValues_[1] + iOffset) { throwWithMessage("barycenter does not have expected value"); } if (cluster.width() != expectedIntegralValues_[2] + iOffset) {