Skip to content

Commit 511f952

Browse files
authored
Merge pull request #41815 from Ksavva1021/RAW_Prime_2804
Adding filter flag to SiStripApproximateClusters
2 parents 538e072 + a185ded commit 511f952

File tree

16 files changed

+384
-102
lines changed

16 files changed

+384
-102
lines changed

Configuration/StandardSequences/python/DigiToRaw_Repack_cff.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,17 @@
7272
cms.InputTag('siStripZeroSuppressionHLT','ScopeMode')),
7373
)
7474

75-
from RecoLocalTracker.SiStripClusterizer.SiStripClusters2ApproxClusters_cff import hltSiStripClusters2ApproxClusters
75+
from RecoLocalTracker.SiStripClusterizer.SiStripClusters2ApproxClusters_cff import *
7676

7777
from EventFilter.Utilities.EvFFEDExcluder_cfi import EvFFEDExcluder as _EvFFEDExcluder
7878
rawPrimeDataRepacker = _EvFFEDExcluder.clone(
7979
src = 'rawDataCollector',
8080
fedsToExclude = [foo for foo in range(50, 490)]
8181
)
8282

83-
DigiToApproxClusterRawTask = cms.Task(siStripDigisHLT,siStripZeroSuppressionHLT,siStripClustersHLT,hltSiStripClusters2ApproxClusters,rawPrimeDataRepacker)
83+
hltScalersRawToDigi = cms.EDProducer( "ScalersRawToDigi",
84+
scalersInputTag = cms.InputTag( "rawDataRepacker" )
85+
)
86+
87+
DigiToApproxClusterRawTask = cms.Task(siStripDigisHLT,siStripZeroSuppressionHLT,hltScalersRawToDigi,hltBeamSpotProducer,siStripClustersHLT,hltSiStripClusters2ApproxClusters,rawPrimeDataRepacker)
8488
DigiToApproxClusterRaw = cms.Sequence(DigiToApproxClusterRawTask)

DataFormats/SiStripCluster/interface/SiStripApproximateCluster.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,38 @@ class SiStripApproximateCluster {
88
public:
99
SiStripApproximateCluster() {}
1010

11-
explicit SiStripApproximateCluster(cms_uint16_t barycenter,
12-
cms_uint8_t width,
13-
cms_uint8_t avgCharge,
14-
bool isSaturated) {
11+
explicit SiStripApproximateCluster(
12+
cms_uint16_t barycenter, cms_uint8_t width, cms_uint8_t avgCharge, bool filter, bool isSaturated) {
1513
barycenter_ = barycenter;
1614
width_ = width;
1715
avgCharge_ = avgCharge;
16+
filter_ = filter;
1817
isSaturated_ = isSaturated;
1918
}
2019

21-
explicit SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat);
20+
explicit SiStripApproximateCluster(const SiStripCluster& cluster,
21+
unsigned int maxNSat,
22+
float hitPredPos,
23+
bool peakFilter);
2224

2325
cms_uint16_t barycenter() const { return barycenter_; }
2426
cms_uint8_t width() const { return width_; }
2527
cms_uint8_t avgCharge() const { return avgCharge_; }
28+
bool filter() const { return filter_; }
2629
bool isSaturated() const { return isSaturated_; }
30+
bool peakFilter() const { return peakFilter_; }
2731

2832
private:
2933
cms_uint16_t barycenter_ = 0;
3034
cms_uint8_t width_ = 0;
3135
cms_uint8_t avgCharge_ = 0;
36+
bool filter_ = false;
3237
bool isSaturated_ = false;
38+
bool peakFilter_ = false;
39+
static constexpr double trimMaxADC_ = 30.;
40+
static constexpr double trimMaxFracTotal_ = .15;
41+
static constexpr double trimMaxFracNeigh_ = .25;
42+
static constexpr double maxTrimmedSizeDiffNeg_ = .7;
43+
static constexpr double maxTrimmedSizeDiffPos_ = 1.;
3344
};
3445
#endif // DataFormats_SiStripCluster_SiStripApproximateCluster_h

DataFormats/SiStripCluster/interface/SiStripCluster.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class SiStripCluster {
8282
*/
8383
int charge() const;
8484

85+
bool filter() const;
86+
87+
bool isFromApprox() const;
88+
8589
/** Test (set) the merged status of the cluster
8690
*
8791
*/
@@ -99,6 +103,7 @@ class SiStripCluster {
99103
//these are used if amplitude information is not available (using approximate cluster constructor)
100104
float barycenter_ = 0;
101105
int charge_ = 0;
106+
bool filter_ = false;
102107

103108
// [email protected], 01/05/12
104109
// Add cluster errors to be used by rechits from split clusters.

DataFormats/SiStripCluster/src/SiStripApproximateCluster.cc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
#include <algorithm>
44
#include <cmath>
55

6-
SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster, unsigned int maxNSat) {
6+
SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& cluster,
7+
unsigned int maxNSat,
8+
float hitPredPos,
9+
bool peakFilter) {
710
barycenter_ = std::round(cluster.barycenter() * 10);
811
width_ = cluster.size();
912
avgCharge_ = cluster.charge() / cluster.size();
13+
filter_ = false;
1014
isSaturated_ = false;
15+
peakFilter_ = peakFilter;
1116

1217
//mimicing the algorithm used in StripSubClusterShapeTrajectoryFilter...
1318
//Looks for 3 adjacent saturated strips (ADC>=254)
@@ -25,6 +30,28 @@ SiStripApproximateCluster::SiStripApproximateCluster(const SiStripCluster& clust
2530
maxSat = std::max<int>(maxSat, thisSat);
2631
}
2732
if (maxSat >= maxNSat) {
33+
filter_ = true;
2834
isSaturated_ = true;
2935
}
36+
37+
unsigned int hitStripsTrim = ampls.size();
38+
int sum = std::accumulate(ampls.begin(), ampls.end(), 0);
39+
uint8_t trimCut = std::min<uint8_t>(trimMaxADC_, std::floor(trimMaxFracTotal_ * sum));
40+
auto begin = ampls.begin();
41+
auto last = ampls.end() - 1;
42+
while (hitStripsTrim > 1 && (*begin < std::max<uint8_t>(trimCut, trimMaxFracNeigh_ * (*(begin + 1))))) {
43+
hitStripsTrim--;
44+
++begin;
45+
}
46+
while (hitStripsTrim > 1 && (*last < std::max<uint8_t>(trimCut, trimMaxFracNeigh_ * (*(last - 1))))) {
47+
hitStripsTrim--;
48+
--last;
49+
}
50+
if (hitStripsTrim < std::floor(std::abs(hitPredPos) - maxTrimmedSizeDiffNeg_)) {
51+
filter_ = false;
52+
} else if (hitStripsTrim <= std::ceil(std::abs(hitPredPos) + maxTrimmedSizeDiffPos_)) {
53+
filter_ = true;
54+
} else {
55+
filter_ = peakFilter_;
56+
}
3057
}

DataFormats/SiStripCluster/src/SiStripCluster.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ SiStripCluster::SiStripCluster(const SiStripApproximateCluster cluster, const ui
2626
barycenter_ = cluster.barycenter() / 10.0;
2727
charge_ = cluster.width() * cluster.avgCharge();
2828
amplitudes_.resize(cluster.width(), cluster.avgCharge());
29+
filter_ = cluster.filter();
2930

3031
float halfwidth_ = 0.5f * float(cluster.width());
3132

@@ -60,3 +61,10 @@ float SiStripCluster::barycenter() const {
6061
// Need to mask off the high bit of firstStrip_, which contains the merged status.
6162
return float((firstStrip_ & stripIndexMask)) + float(sumx) / float(suma) + 0.5f;
6263
}
64+
bool SiStripCluster::filter() const {
65+
if (barycenter_ > 0)
66+
return filter_;
67+
return false;
68+
}
69+
70+
bool SiStripCluster::isFromApprox() const { return (barycenter_ > 0); }

DataFormats/SiStripCluster/src/classes_def.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<lcgdict>
22

3-
<class name="SiStripCluster" ClassVersion="12">
3+
<class name="SiStripCluster" ClassVersion="13">
4+
<version ClassVersion="13" checksum="1374720584"/>
45
<version ClassVersion="12" checksum="2984011925"/>
56
<version ClassVersion="11" checksum="3702468681"/>
67
<version ClassVersion="10" checksum="3791198690"/>
@@ -24,7 +25,8 @@
2425
<class name="edm::Wrapper<edmNew::DetSetVector<edm::Ref<edmNew::DetSetVector<SiStripCluster>,SiStripCluster,edmNew::DetSetVector<SiStripCluster>::FindForDetSetVector> > >" />
2526

2627

27-
<class name="SiStripApproximateCluster" ClassVersion="5">
28+
<class name="SiStripApproximateCluster" ClassVersion="6">
29+
<version ClassVersion="6" checksum="132211472"/>
2830
<version ClassVersion="5" checksum="3495825183"/>
2931
<version ClassVersion="4" checksum="2854791577"/>
3032
<version ClassVersion="3" checksum="2041370183"/>

DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace sistrip {
4444
static const uint16_t STRIPS_PER_FEDCH = STRIPS_PER_APV * APVS_PER_FEDCH;
4545
static const uint16_t STRIPS_PER_FEUNIT = STRIPS_PER_FEDCH * FEDCH_PER_FEUNIT; // 3072
4646
static const uint16_t STRIPS_PER_FED = STRIPS_PER_FEUNIT * FEUNITS_PER_FED; // 24576
47+
static constexpr float MeVperADCStrip = 9.5665E-4;
4748

4849
// -------------------- FED buffers --------------------
4950

HLTrigger/Configuration/python/customizeHLTforCMSSW.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ def customizeHLTfor41495(process):
226226

227227
return process
228228

229+
def customizeHLTfor41815(process):
230+
# use hlt online BeamSpot for SiStripClusters2ApproxClusters
231+
for producer in producers_by_type(process, 'SiStripClusters2ApproxClusters'):
232+
producer.beamSpot = cms.InputTag('hltOnlineBeamSpot')
233+
234+
if hasattr(process, 'HLT_HIRandom_v4'):
235+
getattr(process,'HLT_HIRandom_v4').insert(2,process.HLTBeamSpot)
236+
237+
return process
238+
229239
# CMSSW version specific customizations
230240
def customizeHLTforCMSSW(process, menuType="GRun"):
231241

@@ -236,5 +246,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
236246

237247
process = customizeHLTfor41058(process)
238248
process = customizeHLTfor41495(process)
249+
process = customizeHLTfor41815(process)
239250

240251
return process

RecoLocalTracker/SiStripClusterizer/plugins/BuildFile.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
<use name="HeterogeneousCore/CUDAUtilities"/>
77
<use name="CUDADataFormats/SiStripCluster"/>
88
<use name="cuda"/>
9+
<use name="RecoTracker/PixelLowPtUtilities"/>
10+
<use name="CalibFormats/SiStripObjects"/>
11+
<use name="CalibTracker/SiStripCommon"/>
912
<flags EDM_PLUGIN="1"/>
1013
</library>

RecoLocalTracker/SiStripClusterizer/plugins/SiStripApprox2ApproxClusters.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co
5959
float barycenter = cluster.barycenter();
6060
uint8_t width = cluster.width();
6161
float avgCharge = cluster.avgCharge();
62+
bool filter = cluster.filter();
6263
bool isSaturated = cluster.isSaturated();
6364

6465
switch (approxVersion) {
@@ -86,7 +87,7 @@ void SiStripApprox2ApproxClusters::produce(edm::Event& event, edm::EventSetup co
8687
break;
8788
}
8889

89-
ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge, isSaturated));
90+
ff.push_back(SiStripApproximateCluster(barycenter, width, avgCharge, filter, isSaturated));
9091
}
9192
}
9293

0 commit comments

Comments
 (0)