Skip to content

Commit 3441a18

Browse files
authored
Merge pull request #47185 from slava77/CMSSW_14_1_0_pre7/stripConvertReserve
speedup SiStripRecHitConverterAlgorithm by reserving the output size
2 parents 4ac2671 + c0f6383 commit 3441a18

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

RecoLocalTracker/SiStripRecHitConverter/src/SiStripRecHitConverterAlgorithm.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,29 @@ void SiStripRecHitConverterAlgorithm::run(edm::Handle<edmNew::DetSetVector<SiStr
6060
products& output,
6161
LocalVector trackdirection) {
6262
auto const inputID = inputhandle.id();
63+
unsigned int nIDs[2]{};
64+
unsigned int nCs[2]{};
65+
for (auto const& DS : *inputhandle) {
66+
auto id = DS.id();
67+
if (!useModule(id))
68+
continue;
69+
70+
unsigned int iStereo = StripSubdetector(id).stereo();
71+
nIDs[iStereo]++;
72+
73+
bool bad128StripBlocks[6];
74+
fillBad128StripBlocks(id, bad128StripBlocks);
75+
76+
for (auto const& cluster : DS) {
77+
if (isMasked(cluster, bad128StripBlocks))
78+
continue;
79+
80+
nCs[iStereo]++;
81+
}
82+
}
83+
output.rphi->reserve(nIDs[0], nCs[0]);
84+
output.stereo->reserve(nIDs[1], nCs[1]);
85+
6386
for (auto const& DS : *inputhandle) {
6487
auto id = DS.id();
6588
if (!useModule(id))

0 commit comments

Comments
 (0)