Skip to content

Commit e253759

Browse files
shahor02davidrohr
authored andcommitted
MID mc->raw fix: avoid IR preceding 1st sampled TF
1 parent 5435ca1 commit e253759

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Detectors/MUON/MID/Raw/src/Encoder.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ void Encoder::finalize(bool closeFile)
133133
{
134134
/// Writes remaining data and closes the file
135135
if (mLastIR.isDummy()) {
136-
mLastIR.bc = 0;
137-
mLastIR.orbit = mRawWriter.getHBFUtils().orbitFirst;
136+
mLastIR = mRawWriter.getHBFUtils().getFirstSampledTFIR();
138137
}
139138
auto ir = getOrbitIR(mLastIR.orbit);
140139
auto nextIr = getOrbitIR(mLastIR.orbit + 1);
@@ -157,9 +156,11 @@ void Encoder::process(gsl::span<const ColumnData> data, InteractionRecord ir, Ev
157156
/// Encodes data
158157

159158
// The CTP trigger arrives to the electronics with a delay
160-
applyElectronicsDelay(ir.orbit, ir.bc, -mElectronicsDelay.localToBC);
159+
if (ir.differenceInBC(mRawWriter.getHBFUtils().getFirstSampledTFIR()) > mElectronicsDelay.localToBC) { // RS: not sure this is correct.
160+
applyElectronicsDelay(ir.orbit, ir.bc, -mElectronicsDelay.localToBC);
161+
}
161162

162-
if (ir.orbit != mLastIR.orbit) {
163+
if (ir.orbit != mLastIR.orbit && !mLastIR.isDummy()) {
163164
onOrbitChange(mLastIR.orbit);
164165
}
165166

0 commit comments

Comments
 (0)