Skip to content

Commit 95766dd

Browse files
authored
Merge pull request #44813 from mroguljic/qbin_fix_master
fix skipping qBin when reading template info
2 parents 8ba8ffe + 84f6a43 commit 95766dd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

RecoLocalTracker/SiPixelRecHits/src/PixelCPEFastParamsHost.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,20 @@ void PixelCPEFastParamsHost<TrackerTraits>::fillParamsForDevice() {
220220
// sample x by charge
221221
int qbin = pixelCPEforDevice::kGenErrorQBins; // low charge
222222
int k = 0;
223-
for (int qclus = 1000; qclus < 200000; qclus += 1000) {
223+
int qClusIncrement = 100;
224+
for (int qclus = 1000; k < pixelCPEforDevice::kGenErrorQBins;
225+
qclus += qClusIncrement) { //increase charge until we cover all qBin categories
224226
errorFromTemplates(p, cp, qclus);
225227
if (cp.qBin_ == qbin)
226228
continue;
227229
qbin = cp.qBin_;
230+
//There are two qBin categories with low charge. Their qBins are 5 and 4 (pixelCPEforDevice::kGenErrorQBins, pixelCPEforDevice::kGenErrorQBins-1)
231+
//We increment charge until qBin gets switched from 5 and then we start writing detParams as we are not interested in cases with qBin=5
232+
//The problem is that with a too large qClusIncrement, we may go directly from 5 to 3, breaking the logic of the for loop
233+
//Therefore, we start with lower increment (100) until we get to qBin=4
234+
if (qbin < pixelCPEforDevice::kGenErrorQBins) {
235+
qClusIncrement = 1000;
236+
}
228237
g.xfact[k] = cp.sigmax;
229238
g.yfact[k] = cp.sigmay;
230239
g.minCh[k++] = qclus;

0 commit comments

Comments
 (0)