Skip to content

Commit 0bbc1ba

Browse files
committed
Fix rounding in InteractionRecord::ns2bc
1 parent 2e6efa2 commit 0bbc1ba

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

DataFormats/common/include/CommonDataFormat/InteractionRecord.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ struct InteractionRecord {
7171

7272
static int ns2bc(double ns, unsigned int& orb)
7373
{
74-
orb = ns > 0 ? ns / o2::constants::lhc::LHCOrbitNS : 0;
75-
ns -= orb * o2::constants::lhc::LHCOrbitNS;
76-
return std::round(ns / o2::constants::lhc::LHCBunchSpacingNS);
74+
long nb = std::round(ns / o2::constants::lhc::LHCBunchSpacingNS);
75+
orb = nb / o2::constants::lhc::LHCMaxBunches;
76+
return nb % o2::constants::lhc::LHCMaxBunches;
7777
}
7878

7979
double bc2ns() const

0 commit comments

Comments
 (0)