Skip to content

Commit 64e26f3

Browse files
committed
fix bug with vresetd assignment to thresholds
1 parent 00076c8 commit 64e26f3

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/ThresholdCalibratorSpec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ class ITSThresholdCalibrator : public Task
235235
short int mRunTypeRUCopy[N_RU] = {0};
236236
short int mCdwCntRU[N_RU][N_ROW] = {{0}};
237237
short int mLoopVal[N_RU][N_ROW] = {{0}};
238-
short int mRowRU[N_RU] = {0};
239238
bool mActiveLinks[N_RU][3] = {{false}};
240239
std::set<short int> mRuSet;
241240
// Either "T" for threshold, "V" for VCASN, or "I" for ITHR

Detectors/ITSMFT/ITS/workflow/src/ThresholdCalibratorSpec.cxx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,10 +1309,12 @@ void ITSThresholdCalibrator::run(ProcessingContext& pc)
13091309
short int row = -1;
13101310
short int cwcnt = -1;
13111311
bool isAllZero = true;
1312+
short int ruIndex = -1;
13121313
for (short int iRU = 0; iRU < this->N_RU; iRU++) {
13131314
const auto& calib = calibs[iROF * this->N_RU + iRU];
13141315
if (calib.calibUserField != 0) {
13151316
mRuSet.insert(iRU);
1317+
ruIndex = iRU;
13161318
isAllZero = false;
13171319

13181320
if (loopval >= 0) {
@@ -1363,7 +1365,6 @@ void ITSThresholdCalibrator::run(ProcessingContext& pc)
13631365
short int checkVal = (mScanType == 'I') ? mMin : mMax;
13641366
if ((mScanType != 'r' && loopval == checkVal) || (mScanType == 'r' && realcharge == mMax2)) {
13651367
mCdwCntRU[iRU][row]++;
1366-
mRowRU[iRU] = row; // keep the row
13671368
mLoopVal[iRU][row] = loopval; // keep loop val (relevant for VRESET2D scan only)
13681369
}
13691370
if (this->mVerboseOutput) {
@@ -1466,29 +1467,31 @@ void ITSThresholdCalibrator::run(ProcessingContext& pc)
14661467
}
14671468
}
14681469
} // if (charge)
1469-
} // for (ROFs)
14701470

1471-
// Prepare the ChipDone object for QC + extract data if the row is completed
1472-
for (auto& iRU : mRuSet) {
1471+
////
1472+
// Prepare the ChipDone object for QC + extract data if the row is completed
1473+
if (ruIndex < 0) {
1474+
continue;
1475+
}
14731476
short int nL = 0;
14741477
for (int iL = 0; iL < 3; iL++) {
1475-
if (mActiveLinks[iRU][iL]) {
1478+
if (mActiveLinks[ruIndex][iL]) {
14761479
nL++; // count active links
14771480
}
14781481
}
1479-
std::vector<short int> chipEnabled = getChipListFromRu(iRU, mActiveLinks[iRU]); // chip boundaries
1482+
std::vector<short int> chipEnabled = getChipListFromRu(ruIndex, mActiveLinks[ruIndex]); // chip boundaries
14801483
// Fill the chipDone info string
1481-
if (mRunTypeRUCopy[iRU] == nInjScaled * nL) {
1484+
if (mRunTypeRUCopy[ruIndex] == nInjScaled * nL) {
14821485
for (short int iChip = 0; iChip < chipEnabled.size(); iChip++) {
14831486
if ((chipEnabled[iChip] % mChipModBase) != mChipModSel) {
14841487
continue;
14851488
}
14861489
addDatabaseEntry(chipEnabled[iChip], "", std::vector<float>(), true);
14871490
}
1488-
mRunTypeRUCopy[iRU] = 0; // reset here is safer (the other counter is reset in finalize)
1491+
mRunTypeRUCopy[ruIndex] = 0; // reset here is safer (the other counter is reset in finalize)
14891492
}
14901493
// Check if scan of a row is finished: only for specific scans!
1491-
bool passCondition = (mCdwCntRU[iRU][mRowRU[iRU]] >= nInjScaled * nL);
1494+
bool passCondition = (mCdwCntRU[ruIndex][row] >= nInjScaled * nL);
14921495
if (mScanType != 'D' && mScanType != 'A' && mScanType != 'P' && mScanType != 'p' && mScanType != 'R' && passCondition) {
14931496
// extract data from the row
14941497
for (short int iChip = 0; iChip < chipEnabled.size(); iChip++) {
@@ -1498,17 +1501,19 @@ void ITSThresholdCalibrator::run(ProcessingContext& pc)
14981501
}
14991502
if (!isDumpS || (std::find(chipDumpList.begin(), chipDumpList.end(), chipID) != chipDumpList.end() || !chipDumpList.size())) { // to dump s-curves as histograms
15001503
if (mPixelHits.count(chipID)) {
1501-
if (mPixelHits[chipID].count(mRowRU[iRU])) { // make sure the row exists
1502-
extractAndUpdate(chipID, mRowRU[iRU]);
1503-
mPixelHits[chipID].erase(mRowRU[iRU]);
1504-
mForbiddenRows[chipID].push_back(mRowRU[iRU]);
1504+
if (mPixelHits[chipID].count(row)) { // make sure the row exists
1505+
extractAndUpdate(chipID, row);
1506+
if (mScanType != 'r' || (mScanType == 'r' && mLoopVal[ruIndex][row] == mMax)) {
1507+
mPixelHits[chipID].erase(row);
1508+
}
1509+
mForbiddenRows[chipID].push_back(row);
15051510
}
15061511
}
15071512
}
15081513
}
1509-
mCdwCntRU[iRU][mRowRU[iRU]] = 0; // reset
1514+
mCdwCntRU[ruIndex][row] = 0; // reset
15101515
}
1511-
} // end loop on RuSet
1516+
} // for (ROFs)
15121517

15131518
if (!(this->mRunTypeUp)) {
15141519
finalize();

0 commit comments

Comments
 (0)