Skip to content

Commit 0d55348

Browse files
committed
DigiContext: Bugfix for start of history effect
Under certain circumstances, we got a wrong interactions included for the timeframe history effect. This was essentially due to wrong variable initialization and is now fixed.
1 parent e1a32f7 commit 0d55348

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

DataFormats/simulation/src/DigitizationContext.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,18 +452,18 @@ std::vector<std::tuple<int, int, int>> getTimeFrameBoundaries(std::vector<o2::In
452452
// in this range search the smallest index which precedes
453453
// timeframe ti by not more than "orbitsEarly" orbits
454454
// (could probably use binary search, in case optimization becomes necessary)
455-
int earlyOrbitIndex = prev_tf_range.second;
455+
int earlyOrbitIndex = -1; // init to start of this timeframe ... there may not be early orbits
456456

457457
// this is the orbit of the ti-th timeframe start
458458
auto orbit_timeframe_start = startOrbit + ti * orbitsPerTF;
459459

460-
auto orbit_timeframe_early_fractional = orbit_timeframe_start - orbitsEarly;
461-
auto orbit_timeframe_early_integral = (uint32_t)(orbit_timeframe_early_fractional);
460+
auto orbit_timeframe_early_fractional = 1. * orbit_timeframe_start - orbitsEarly;
461+
auto orbit_timeframe_early_integral = static_cast<long>(std::floor(orbit_timeframe_early_fractional));
462462

463463
auto bc_early = (uint32_t)((orbit_timeframe_early_fractional - orbit_timeframe_early_integral) * o2::constants::lhc::LHCMaxBunches);
464464

465465
// this is the interaction record of the ti-th timeframe start
466-
o2::InteractionRecord timeframe_start_record(0, orbit_timeframe_early_integral);
466+
o2::InteractionRecord timeframe_start_record(0, orbit_timeframe_start);
467467
// this is the interaction record in some previous timeframe after which interactions could still
468468
// influence the ti-th timeframe according to orbitsEarly
469469
o2::InteractionRecord timeframe_early_record(bc_early, orbit_timeframe_early_integral);

0 commit comments

Comments
 (0)