-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
update on strip approximate cluster #47367
base: master
Are you sure you want to change the base?
Changes from all commits
de2e3de
3196799
2bf3498
bec516a
830a7c5
c4e8c0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,20 +27,26 @@ 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_; } | ||
bool isSaturated() const { return isSaturated_; } | ||
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.; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why 770 and not 768? |
||
static constexpr double trimMaxADC_ = 30.; | ||
static constexpr double trimMaxFracTotal_ = .15; | ||
static constexpr double trimMaxFracNeigh_ = .25; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
#include "DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h" | ||
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" | ||
#include <algorithm> | ||
#include <cassert> | ||
#include <cmath> | ||
|
||
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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this condition always true? (maximum possible value of |
||
width_ = cluster.size(); | ||
avgCharge_ = cluster.charge() / cluster.size(); | ||
avgCharge_ = (cluster.charge() + cluster.size() / 2) / cluster.size(); | ||
filter_ = false; | ||
isSaturated_ = false; | ||
peakFilter_ = peakFilter; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the way this is intended to be fixed, but rather it should be the input file to be changed according to the the instructions @cms-sw/core-l2 FYI There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this test should ensure that both old data and new data are read out correctly. The code here should really compare the return value of The change of meaning of the |
||
throwWithMessage("barycenter does not have expected value"); | ||
} | ||
if (cluster.width() != expectedIntegralValues_[2] + iOffset) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid underscore as the first character (2.14 in https://cms-sw.github.io/cms_coding_rules.html#2--naming-rules-1)