Skip to content

Commit dffee58

Browse files
authored
Refine calculations for rise time and ToT (#14039)
1 parent 46445fa commit dffee58

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,8 @@ void ITSThresholdCalibrator::setRunType(const short int& runtype)
10011001
this->mFitType = NO_FIT;
10021002
this->mMin = 0;
10031003
this->mMax = 400; // strobe delay goes from 0 to 400 (included) in steps of 4
1004-
this->mStep = 4;
1005-
this->mStrobeWindow = 5; // it's 4 but it corresponds to 4+1 (as from alpide manual)
1004+
this->mStep = 1;
1005+
this->mStrobeWindow = 1; // it's 0 but it corresponds to 0+1 (as from alpide manual)
10061006
this->N_RANGE = (mMax - mMin) / mStep + 1;
10071007
this->mCheckExactRow = true;
10081008
} else if (runtype == TOT_CALIBRATION_1_ROW) {
@@ -1013,7 +1013,7 @@ void ITSThresholdCalibrator::setRunType(const short int& runtype)
10131013
this->mMin = 0;
10141014
this->mMax = 2000; // strobe delay goes from 0 to 2000 in steps of 10
10151015
this->mStep = 10;
1016-
this->mStrobeWindow = 2; // it's 1 but it corresponds to 1+1 (as from alpide manual)
1016+
this->mStrobeWindow = 10; // it's 9 but it corresponds to 9+1 (as from alpide manual)
10171017
this->N_RANGE = (mMax - mMin) / mStep + 1;
10181018
this->mMin2 = 0; // charge min
10191019
this->mMax2 = 170; // charge max
@@ -1028,7 +1028,7 @@ void ITSThresholdCalibrator::setRunType(const short int& runtype)
10281028
this->mMin = 300;
10291029
this->mMax = 1100; // strobe delay goes from 300 to 1100 (included) in steps of 10
10301030
this->mStep = 10;
1031-
this->mStrobeWindow = 2; // it's 1 but it corresponds to 1+1 (as from alpide manual)
1031+
this->mStrobeWindow = 10; // it's 9 but it corresponds to 9+1 (as from alpide manual)
10321032
this->N_RANGE = (mMax - mMin) / mStep + 1;
10331033
this->mMin2 = 30; // charge min
10341034
this->mMax2 = 60; // charge max
@@ -1116,39 +1116,39 @@ std::vector<float> ITSThresholdCalibrator::calculatePulseParams(const short int&
11161116

11171117
for (auto itrow = mPixelHits[chipID].begin(); itrow != mPixelHits[chipID].end(); itrow++) { // loop over the chip rows
11181118
short int row = itrow->first;
1119-
for (short int col_i = 0; col_i < this->N_COL; col_i++) { // loop over the pixels on the row
1120-
for (short int sdel_i = 0; sdel_i < this->N_RANGE; sdel_i++) { // loop over the strobe delays
1121-
if (mPixelHits[chipID][row][col_i][0][sdel_i] > 0 && mPixelHits[chipID][row][col_i][0][sdel_i] < nInj && rt_mindel < 0) { // from left, the last bin with 0 hits or the first with some hits
1122-
rt_mindel = sdel_i > 0 ? ((sdel_i - 1) * mStep) + 1 : (sdel_i * mStep) + 1; // + 1 because if delay = n, we get n+1 in reality (ALPIDE feature)
1119+
for (short int col_i = 0; col_i < this->N_COL; col_i++) { // loop over the pixels on the row
1120+
for (short int sdel_i = 0; sdel_i < this->N_RANGE; sdel_i++) { // loop over the strobe delays
1121+
if (mPixelHits[chipID][row][col_i][0][sdel_i] > 0.1 * nInj && mPixelHits[chipID][row][col_i][0][sdel_i] < nInj && rt_mindel < 0) { // from left, first bin with 10% hits and 90% hits
1122+
rt_mindel = (sdel_i * mStep) + 1; // + 1 because if delay = n, we get n+1 in reality (ALPIDE feature)
11231123
}
1124-
if (mPixelHits[chipID][row][col_i][0][sdel_i] == nInj) {
1124+
if (mPixelHits[chipID][row][col_i][0][sdel_i] >= 0.9 * nInj) { // for Rt max take the 90% point
11251125
rt_maxdel = (sdel_i * mStep) + 1;
1126+
break;
1127+
}
1128+
}
1129+
for (short int sdel_i = 0; sdel_i < N_RANGE; sdel_i++) {
1130+
if (mPixelHits[chipID][row][col_i][0][sdel_i] >= 0.5 * nInj) { // for ToT take the 50% point
11261131
tot_mindel = (sdel_i * mStep) + 1;
11271132
break;
11281133
}
11291134
}
11301135

1131-
for (short int sdel_i = N_RANGE - 1; sdel_i >= 0; sdel_i--) { // from right, the first bin with nInj hits
1132-
if (mPixelHits[chipID][row][col_i][0][sdel_i] == nInj) {
1136+
for (short int sdel_i = N_RANGE - 1; sdel_i >= 0; sdel_i--) { // from right, the first bin with 50% nInj hits
1137+
if (mPixelHits[chipID][row][col_i][0][sdel_i] >= 0.5 * nInj) {
11331138
tot_maxdel = (sdel_i * mStep) + 1;
11341139
break;
11351140
}
11361141
}
11371142

11381143
if (tot_maxdel > tot_mindel && tot_mindel >= 0 && tot_maxdel >= 0) {
1139-
sumTot += tot_maxdel - tot_mindel - (int)(mStrobeWindow / 2);
1140-
sumSqTot += (tot_maxdel - tot_mindel - (int)(mStrobeWindow / 2)) * (tot_maxdel - tot_mindel - (int)(mStrobeWindow / 2));
1144+
sumTot += tot_maxdel - tot_mindel - mStrobeWindow;
1145+
sumSqTot += (tot_maxdel - tot_mindel - mStrobeWindow) * (tot_maxdel - tot_mindel - mStrobeWindow);
11411146
countTot++;
11421147
}
11431148

1144-
if (rt_maxdel > rt_mindel && rt_maxdel > 0) {
1145-
if (rt_mindel < 0) {
1146-
sumRt += mStep + (int)(mStrobeWindow / 2); // resolution -> in case the rise is "instantaneous"
1147-
sumSqRt += (mStep + (int)(mStrobeWindow / 2)) * (mStep + (int)(mStrobeWindow / 2));
1148-
} else {
1149-
sumRt += rt_maxdel - rt_mindel + (int)(mStrobeWindow / 2);
1150-
sumSqRt += (rt_maxdel - rt_mindel + (int)(mStrobeWindow / 2)) * (rt_maxdel - rt_mindel + (int)(mStrobeWindow / 2));
1151-
}
1149+
if (rt_maxdel > rt_mindel && rt_maxdel > 0 && rt_mindel > 0) {
1150+
sumRt += rt_maxdel - rt_mindel + mStrobeWindow;
1151+
sumSqRt += (rt_maxdel - rt_mindel + mStrobeWindow) * (rt_maxdel - rt_mindel + mStrobeWindow);
11521152
countRt++;
11531153
}
11541154

@@ -1232,8 +1232,8 @@ std::vector<float> ITSThresholdCalibrator::calculatePulseParams2D(const short in
12321232
}
12331233

12341234
if (maxPl > tot_mindel && tot_mindel < 1e7 && maxPl >= 0) { // ToT
1235-
sumTot += maxPl - tot_mindel - (int)(mStrobeWindow / 2);
1236-
sumSqTot += (maxPl - tot_mindel - (int)(mStrobeWindow / 2)) * (maxPl - tot_mindel - (int)(mStrobeWindow / 2));
1235+
sumTot += maxPl - tot_mindel - mStrobeWindow;
1236+
sumSqTot += (maxPl - tot_mindel - mStrobeWindow) * (maxPl - tot_mindel - mStrobeWindow);
12371237
countTot++;
12381238
}
12391239

0 commit comments

Comments
 (0)