Skip to content

Commit

Permalink
MID mc->raw fix: avoid IR preceding 1st sampled TF
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 authored and davidrohr committed Apr 16, 2022
1 parent 5435ca1 commit e253759
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Detectors/MUON/MID/Raw/src/Encoder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ void Encoder::finalize(bool closeFile)
{
/// Writes remaining data and closes the file
if (mLastIR.isDummy()) {
mLastIR.bc = 0;
mLastIR.orbit = mRawWriter.getHBFUtils().orbitFirst;
mLastIR = mRawWriter.getHBFUtils().getFirstSampledTFIR();
}
auto ir = getOrbitIR(mLastIR.orbit);
auto nextIr = getOrbitIR(mLastIR.orbit + 1);
Expand All @@ -157,9 +156,11 @@ void Encoder::process(gsl::span<const ColumnData> data, InteractionRecord ir, Ev
/// Encodes data

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

if (ir.orbit != mLastIR.orbit) {
if (ir.orbit != mLastIR.orbit && !mLastIR.isDummy()) {
onOrbitChange(mLastIR.orbit);
}

Expand Down

0 comments on commit e253759

Please sign in to comment.