Skip to content

Commit 0d557c0

Browse files
committed
From rise time to time of arrival
1 parent 436c0b0 commit 0d557c0

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

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

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,24 +1111,18 @@ void ITSThresholdCalibrator::setRunType(const short int& runtype)
11111111
std::vector<float> ITSThresholdCalibrator::calculatePulseParams(const short int& chipID)
11121112
{
11131113

1114-
int rt_mindel = -1, rt_maxdel = -1, tot_mindel = -1, tot_maxdel = -1;
1115-
int sumRt = 0, sumSqRt = 0, countRt = 0, sumTot = 0, sumSqTot = 0, countTot = 0;
1114+
int tot_mindel = -1, tot_maxdel = -1;
1115+
float sumToA = 0., sumSqToA = 0., countToA = 0., sumTot = 0., sumSqTot = 0., countTot = 0.;
1116+
float toa = -1.;
11161117

11171118
for (auto itrow = mPixelHits[chipID].begin(); itrow != mPixelHits[chipID].end(); itrow++) { // loop over the chip rows
11181119
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.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)
1123-
}
1124-
if (mPixelHits[chipID][row][col_i][0][sdel_i] >= 0.9 * nInj) { // for Rt max take the 90% point
1125-
rt_maxdel = (sdel_i * mStep) + 1;
1126-
break;
1127-
}
1128-
}
1120+
for (short int col_i = 0; col_i < this->N_COL; col_i++) { // loop over the pixels on the row
1121+
11291122
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
1131-
tot_mindel = (sdel_i * mStep) + 1;
1123+
if (mPixelHits[chipID][row][col_i][0][sdel_i] >= 0.5 * nInj) { // for ToT and ToA take the 50% point
1124+
tot_mindel = (sdel_i * mStep) + 1; // +1 is for n --> n+1 (alpide manual)
1125+
toa = (sdel_i * mStep) + 1;
11321126
break;
11331127
}
11341128
}
@@ -1146,24 +1140,23 @@ std::vector<float> ITSThresholdCalibrator::calculatePulseParams(const short int&
11461140
countTot++;
11471141
}
11481142

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);
1152-
countRt++;
1143+
if (toa > 0) {
1144+
sumToA += toa + float(mStrobeWindow) / 2.;
1145+
sumSqToA += (toa + float(mStrobeWindow) / 2.) * (toa + float(mStrobeWindow) / 2.);
1146+
countToA++;
11531147
}
11541148

1155-
rt_mindel = -1;
1156-
rt_maxdel = -1;
1149+
toa = -1.;
11571150
tot_maxdel = -1;
11581151
tot_mindel = -1;
11591152
} // end loop over col_i
11601153
} // end loop over chip rows
11611154

1162-
std::vector<float> output; // {avgRt, rmsRt, avgTot, rmsTot}
1155+
std::vector<float> output; // {avgToA, rmsToA, avgTot, rmsTot}
11631156
// Avg Rt
1164-
output.push_back(!countRt ? 0. : (float)sumRt / (float)countRt);
1157+
output.push_back(!countToA ? 0. : (float)sumToA / (float)countToA);
11651158
// Rms Rt
1166-
output.push_back(!countRt ? 0. : (std::sqrt((float)sumSqRt / (float)countRt - output[0] * output[0])) * 25.);
1159+
output.push_back(!countToA ? 0. : (std::sqrt((float)sumSqToA / (float)countToA - output[0] * output[0])) * 25.);
11671160
output[0] *= 25.;
11681161
// Avg ToT
11691162
output.push_back(!countTot ? 0. : (float)sumTot / (float)countTot);
@@ -1728,8 +1721,8 @@ void ITSThresholdCalibrator::addDatabaseEntry(
17281721
o2::dcs::addConfigItem(this->mTuning, "ChipDbID", std::to_string(confDBid));
17291722
o2::dcs::addConfigItem(this->mTuning, "Tot", std::to_string(data[2])); // time over threshold
17301723
o2::dcs::addConfigItem(this->mTuning, "TotRms", std::to_string(data[3])); // time over threshold rms
1731-
o2::dcs::addConfigItem(this->mTuning, "Rt", std::to_string(data[0])); // rise time
1732-
o2::dcs::addConfigItem(this->mTuning, "RtRms", std::to_string(data[1])); // rise time rms
1724+
o2::dcs::addConfigItem(this->mTuning, "ToA", std::to_string(data[0])); // rise time
1725+
o2::dcs::addConfigItem(this->mTuning, "ToARms", std::to_string(data[1])); // rise time rms
17331726
}
17341727

17351728
//- Pulse shape 2D: avgToT, rmsToT, MTC, rmsMTC, avgMTCD, rmsMTCD, avgMPL, rmsMPL, avgMPLC, rmsMPLC

0 commit comments

Comments
 (0)