Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 27 additions & 31 deletions Common/Tools/EventSelectionModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,13 @@
float calcWeightForOccupancy(float dt)
{
float wOccup = 0;
if (dt >= -40 && dt < -5) // collisions in the past // o2-linter: disable=magic-number

Check failure on line 693 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
wOccup = 1. / 1225 * (dt + 40) * (dt + 40); // o2-linter: disable=magic-number
else if (dt >= -5 && dt < 15) // collisions near a given one // o2-linter: disable=magic-number

Check failure on line 695 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
wOccup = 1;
else if (dt >= 15 && dt < 40) // collisions from the future // o2-linter: disable=magic-number

Check failure on line 697 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
wOccup = -0.4 / 25 * dt + 1.24; // o2-linter: disable=magic-number
else if (dt >= 40 && dt < 100) // collisions from the distant future // o2-linter: disable=magic-number

Check failure on line 699 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
wOccup = -0.4 / 60 * dt + 0.6 + 0.8 / 3; // o2-linter: disable=magic-number
return wOccup;
}
Expand Down Expand Up @@ -774,7 +774,7 @@
LOGP(debug, "ITS ROF Offset={} ITS ROF Length={}", rofOffset, rofLength);

// special treatment of light ion runs
if (lastRun >= 564356 && lastRun <= 564472) {

Check failure on line 777 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
for (uint32_t i = 0; i < sizeof(runListLightIons) / sizeof(*runListLightIons); i++) {
if (runListLightIons[i] == lastRun) {
runLightIons = lastRun;
Expand All @@ -784,9 +784,9 @@
diffVzParMean = *parMeans;
diffVzParSigma = *parSigmas;
LOGP(info, ">>> special treatment for diffVz for light ion run {}", runLightIons);
for (int i = 0; i < 5; i++)

Check failure on line 787 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
LOGP(info, " mean par {} = {}", i, diffVzParMean[i]);
for (int i = 0; i < 5; i++)

Check failure on line 789 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
LOGP(info, " sigma par {} = {}", i, diffVzParSigma[i]);
break;
}
Expand Down Expand Up @@ -1016,7 +1016,7 @@
int32_t localBC = globalBC % nBCsPerOrbit;
int32_t bcFromPattern = bcsPattern.at(i);
int64_t bcDiff = bcFromPattern - localBC;
if (std::abs(bcDiff) <= 20) {

Check failure on line 1019 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
foundGlobalBC = (globalBC / nBCsPerOrbit) * nBCsPerOrbit + bcFromPattern;
break; // the bc in pattern is found
}
Expand Down Expand Up @@ -1239,12 +1239,6 @@
// ### for occupancy in time windows
std::vector<int> vAssocToThisCol;
std::vector<float> vCollsTimeDeltaWrtGivenColl;
// protection against the TF borders
if (!vIsFullInfoForOccupancy[colIndex]) {
vCollsInTimeWin.push_back(vAssocToThisCol);
vTimeDeltaForColls.push_back(vCollsTimeDeltaWrtGivenColl);
continue;
}
// find all collisions in time window before the current one
minColIndex = colIndex - 1;
while (minColIndex >= 0) {
Expand Down Expand Up @@ -1325,12 +1319,6 @@
vNoHighMultCollInPrevRof[colIndex] = (totalFT0amplInPrevROF < evselOpts.confFT0CamplCutVetoOnCollInROF);

// ### occupancy in time windows
// protection against TF borders
if (!vIsFullInfoForOccupancy[colIndex]) { // occupancy in undefined (too close to TF borders)
vNumTracksITS567inFullTimeWin[colIndex] = -1;
vSumAmpFT0CinFullTimeWin[colIndex] = -1;
continue;
}
std::vector<int> vAssocToThisCol = vCollsInTimeWin[colIndex];
std::vector<float> vCollsTimeDeltaWrtGivenColl = vTimeDeltaForColls[colIndex];
int nITS567tracksInFullTimeWindow = 0;
Expand All @@ -1341,41 +1329,43 @@
int colIndexFirstRejectedByTFborderCut = -1;
for (uint32_t iCol = 0; iCol < vAssocToThisCol.size(); iCol++) {
int thisColIndex = vAssocToThisCol[iCol];
// check if we are close to TF borders => N ITS tracks is not reliable, and FT0C ampl will be used for occupancy estimation (a loop below)
if (vIsCollRejectedByTFborderCut[thisColIndex]) {
if (colIndexFirstRejectedByTFborderCut == -1)
colIndexFirstRejectedByTFborderCut = thisColIndex;
continue;
}
float dt = vCollsTimeDeltaWrtGivenColl[iCol] / 1e3; // ns -> us
float wOccup = 1.;
if (evselOpts.confUseWeightsForOccupancyVariable) {
// weighted occupancy
wOccup = calcWeightForOccupancy(dt);
}

// check if we are close to ITS ROF borders => N ITS tracks is not reliable, and FT0C ampl can be used for occupancy estimation
// denominator for vAmpFT0CperColl is the approximate conversion factor b/n FT0C ampl and number of PV tracks after cuts
int nItsTracksAssocColl = !vIsCollAtROFborder[thisColIndex] ? vTracksITS567perColl[thisColIndex] : vAmpFT0CperColl[thisColIndex] / 10.;

nITS567tracksInFullTimeWindow += wOccup * nItsTracksAssocColl;
sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex];

// counting tracks from other collisions in fixed time windows
if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollNarrow)
nITS567tracksForVetoNarrow += nItsTracksAssocColl;
if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollStrict)
nITS567tracksForVetoStrict += nItsTracksAssocColl;

// standard cut on other collisions vs delta-times:
// veto on high-mult collisions nearby, where artificial structures in the dt-occupancy plots are observed
// veto on high-mult collisions nearby, where artificial structures in the dt-occupancy plots are observed
if (dt > -4.0 && dt < 2.0 && vAmpFT0CperColl[thisColIndex] > evselOpts.confFT0CamplCutVetoOnCollInTimeRange) { // dt in us // o2-linter: disable=magic-number
nCollsWithFT0CAboveVetoStandard++;
}

// check if we are close to TF borders => N ITS tracks is not reliable, and FT0C ampl will be used for occupancy estimation (a loop below)
if (vIsCollRejectedByTFborderCut[thisColIndex]) {
if (colIndexFirstRejectedByTFborderCut == -1)
colIndexFirstRejectedByTFborderCut = thisColIndex;
continue;
}

// weighted occupancy calc:
if (vIsFullInfoForOccupancy[colIndex]) {
float wOccup = 1.;
if (evselOpts.confUseWeightsForOccupancyVariable) {
// weighted occupancy
wOccup = calcWeightForOccupancy(dt);
}
nITS567tracksInFullTimeWindow += wOccup * nItsTracksAssocColl;
sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex];
}
}

// if some associated collisions are close to TF border - take FT0C amplitude instead of nTracks
if (vCanHaveAssocCollsWithinLastDriftTime[colIndex] && colIndexFirstRejectedByTFborderCut >= 0) {
// if some associated collisions are close to TF border - take FT0C amplitude instead of nTracks, using BC table
if (vIsFullInfoForOccupancy[colIndex] && vCanHaveAssocCollsWithinLastDriftTime[colIndex] && colIndexFirstRejectedByTFborderCut >= 0) {
int64_t foundGlobalBC = vFoundGlobalBC[colIndex];
int64_t tfId = (foundGlobalBC - bcSOR) / nBCsPerTF;
std::map<int64_t, int32_t>::iterator it = mapGlobalBcWithTVX.find(vFoundGlobalBC[colIndexFirstRejectedByTFborderCut]);
Expand Down Expand Up @@ -1408,6 +1398,12 @@
}
}

// protection against TF borders
if (!vIsFullInfoForOccupancy[colIndex]) { // occupancy in undefined (too close to TF borders)
nITS567tracksInFullTimeWindow = -1;
sumAmpFT0CInFullTimeWindow = -1;
}

vNumTracksITS567inFullTimeWin[colIndex] = nITS567tracksInFullTimeWindow; // occupancy by a sum of number of ITS tracks (without a current collision)
vSumAmpFT0CinFullTimeWin[colIndex] = sumAmpFT0CInFullTimeWindow; // occupancy by a sum of FT0C amplitudes (without a current collision)
// occupancy flags based on nearby collisions
Expand Down Expand Up @@ -1439,10 +1435,10 @@
float T0M = multT0A + multT0C;
// calc mean at this T0 ampl.
float x = (T0M < 50 ? 50 : T0M);
double diffMean = diffVzParMean[0] + diffVzParMean[1] * pow(x, diffVzParMean[2]) + diffVzParMean[3] * pow(x, diffVzParMean[4]);

Check failure on line 1438 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
// calc sigma at this T0 ampl.
x = (T0M < 20 ? 20 : (T0M > 1.2e4 ? 1.2e4 : T0M));
double diffSigma = diffVzParSigma[0] + diffVzParSigma[1] * pow(x, diffVzParSigma[2]) + diffVzParSigma[3] * pow(x, diffVzParSigma[4]);

Check failure on line 1441 in Common/Tools/EventSelectionModule.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float nSigma = evselOpts.confLightIonsNsigmaOnVzDiff;
float margin = evselOpts.confLightIonsMarginVzDiff;
isGoodZvtxFT0vsPV = (diffVz > diffMean - nSigma * diffSigma - margin && diffVz < diffMean + nSigma * diffSigma + margin);
Expand Down
Loading