Skip to content

Commit 6ac7a7a

Browse files
authored
Properly discard ITS hits preceding readout start (#15601)
* Properly discard ITS hits preceding readout start * Properly discard ITS3 hits preceding RO start
1 parent 7d9a516 commit 6ac7a7a

4 files changed

Lines changed: 9 additions & 13 deletions

File tree

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/Digitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Digitizer : public TObject
127127
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
128128
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
129129
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
130-
bool mIsBeforeFirstRO = false;
130+
int mROFsWrtFirstRO = 0;
131131

132132
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
133133
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)

Detectors/ITSMFT/common/simulation/src/Digitizer.cxx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,13 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt, int layer)
164164

165165
// we might get interactions to digitize from before
166166
// the first sampled IR
167+
mROFsWrtFirstRO = std::floor(float(nbc) / mParams.getROFrameLengthInBC(layer));
167168
if (nbc < 0) {
168-
mNewROFrame = 0;
169-
// this event is before the first RO
170-
mIsBeforeFirstRO = true;
169+
mNewROFrame = 0; // this event is before the first RO
171170
} else {
172171
mNewROFrame = nbc / mParams.getROFrameLengthInBC(layer);
173-
mIsBeforeFirstRO = false;
174172
}
175-
LOG(debug) << " NewROFrame " << mNewROFrame << " nbc " << nbc;
173+
LOG(debug) << " NewROFrame " << mNewROFrame << " nbc " << nbc << " ROFsWrtFirstRO " << mROFsWrtFirstRO;
176174

177175
// in continuous mode depends on starts of periodic readout frame
178176
mCollisionTimeWrtROF += (nbc % mParams.getROFrameLengthInBC(layer)) * o2::constants::lhc::LHCBunchSpacingNS;
@@ -279,7 +277,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
279277
if (isContinuous()) {
280278
timeInROF += mCollisionTimeWrtROF;
281279
}
282-
if (mIsBeforeFirstRO && timeInROF < 0) {
280+
if (mROFsWrtFirstRO < -1 || (mROFsWrtFirstRO == -1 && timeInROF < 0)) {
283281
// disregard this hit because it comes from an event before readout starts and it does not effect this RO
284282
return;
285283
}

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Digitizer : public TObject
111111
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
112112
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
113113
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
114-
bool mIsBeforeFirstRO = false;
114+
int mROFsWrtFirstRO = 0;
115115

116116
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
117117
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,13 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt, int layer)
128128
}
129129
// we might get interactions to digitize from before
130130
// the first sampled IR
131+
mROFsWrtFirstRO = std::floor(float(nbc) / mParams.getROFrameLengthInBC(layer));
131132
if (nbc < 0) {
132133
mNewROFrame = 0;
133-
// this event is before the first RO
134-
mIsBeforeFirstRO = true;
135134
} else {
136135
mNewROFrame = nbc / mParams.getROFrameLengthInBC(layer);
137-
mIsBeforeFirstRO = false;
138136
}
139-
LOG(debug) << " NewROFrame " << mNewROFrame << " nbc " << nbc;
137+
LOG(debug) << " NewROFrame " << mNewROFrame << " nbc " << nbc << " ROFsWrtFirstRO " << mROFsWrtFirstRO;
140138

141139
// in continuous mode depends on starts of periodic readout frame
142140
mCollisionTimeWrtROF += (nbc % mParams.getROFrameLengthInBC(layer)) * o2::constants::lhc::LHCBunchSpacingNS;
@@ -240,7 +238,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
240238
if (isContinuous()) {
241239
timeInROF += mCollisionTimeWrtROF;
242240
}
243-
if (mIsBeforeFirstRO && timeInROF < 0) {
241+
if (mROFsWrtFirstRO < -1 || (mROFsWrtFirstRO == -1 && timeInROF < 0)) {
244242
// disregard this hit because it comes from an event before readout starts and it does not effect this RO
245243
return;
246244
}

0 commit comments

Comments
 (0)