Skip to content

Commit 42fba83

Browse files
authored
add NumCollsInRof column and upcMode flag for BC tables
1 parent 4abc96e commit 42fba83

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎Common/DataModel/EventSelection.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ enum BcOccupancyFlags { // bits of occupancyFlags
103103
kNoCollInTimeRangeStandard, // no other collisions in specified time range with per-collision multiplicity above threshold
104104
kNoCollInRofStrict, // no other collisions in this ITS Readout Frame
105105
kNoCollInRofStandard, // no other collisions in this ITS Readout Frame with per-collision multiplicity above threshold (no veto on collisions with close vZ)
106-
kNoHighMultCollInPrevRof // FT0C amplitude in previous ITS ROF is below threshold
106+
kNoHighMultCollInPrevRof, // FT0C amplitude in previous ITS ROF is below threshold
107+
kUpcMode // ITS ROF of this BC is in UPC mode: no collisions in the ROF, or collisions reconstructed in the UPC mode (set for all BCs, also without calculated occupancy)
107108
};
108109
DECLARE_SOA_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, int); //! Occupancy in specified time interval by a number of tracks from nearby collisions (-1 if not available) // o2-linter: disable=name/o2-column
109110
DECLARE_SOA_COLUMN(SumAmpFT0CInTimeRange, ft0cOccupancyInTimeRange, float); //! Occupancy in specified time interval by a sum of FT0C amplitudes from nearby collisions (-1 if not available) // o2-linter: disable=name/o2-column
110111
DECLARE_SOA_COLUMN(OccupancyMedianTime, occupancyMedianTime, float); //! Median time for the occupancy in specified time interval (the delta-time wrt to the BC at which occupancy crosses 1/2 of its full value)
111112
DECLARE_SOA_BITMAP_COLUMN(OccupancyFlags, occupancyFlags, 8); //! Bitmask of occupancy flags (see BcOccupancyFlags), check with occupancyFlags_bit(bit)
112113
DECLARE_SOA_COLUMN(NumCollsInBC, numCollsInBC, int16_t); //! Number of collisions found in this BC (excluded from the occupancy)
114+
DECLARE_SOA_COLUMN(NumCollsInRof, numCollsInRof, int16_t); //! Number of collisions found in the ITS ROF of this BC (within the TF), including the collisions in this BC (-1 if the ROF parameters are not available)
113115
} // namespace bcocc
114116

115117
// bc-joinable occupancy
@@ -118,7 +120,8 @@ DECLARE_SOA_TABLE(BcOccs, "AOD", "BCOCC", //!
118120
bcocc::SumAmpFT0CInTimeRange,
119121
bcocc::OccupancyMedianTime,
120122
bcocc::OccupancyFlags,
121-
bcocc::NumCollsInBC);
123+
bcocc::NumCollsInBC,
124+
bcocc::NumCollsInRof);
122125
using BcOcc = BcOccs::iterator;
123126

124127
// occupancy wrt every BC of the TFs present in the DF (not joinable): for each TF (in increasing order) all its BCs, in increasing order of global BC
@@ -129,7 +132,8 @@ DECLARE_SOA_TABLE(BcOccsAll, "AOD", "BCOCCALL", //!
129132
bcocc::SumAmpFT0CInTimeRange,
130133
bcocc::OccupancyMedianTime,
131134
bcocc::OccupancyFlags,
132-
bcocc::NumCollsInBC);
135+
bcocc::NumCollsInBC,
136+
bcocc::NumCollsInRof);
133137
using BcOccAll = BcOccsAll::iterator;
134138

135139
namespace bcocc
@@ -146,10 +150,12 @@ class BcOccAllIndex
146150
explicit BcOccAllIndex(TBcOccsAll const& bcOccsAll) : mTable(&bcOccsAll)
147151
{
148152
const int64_t nRows = static_cast<int64_t>(bcOccsAll.size());
153+
// offset globalBC - row: constant along consecutive BCs, changes only where TFs are missing in the DF
149154
auto offsetAt = [&bcOccsAll](int64_t row) { return static_cast<int64_t>(bcOccsAll.iteratorAt(row).globalBC()) - row; };
150155
for (int64_t first = 0, end = 0; first < nRows; first = end) {
151156
// the offset is non-decreasing (global BCs are strictly increasing): the segment ends at the first row with a larger offset
152157
const int64_t offset = offsetAt(first);
158+
// binary search over the rows [first, nRows) for the end of the segment: the first row with a different offset
153159
end = *std::ranges::partition_point(std::views::iota(first, nRows), [&](int64_t row) { return offsetAt(row) == offset; });
154160
mSegments.push_back({offset + first, offset + end, offset});
155161
}

0 commit comments

Comments
 (0)