Skip to content

Commit 92b135a

Browse files
shahor02sawenzel
authored andcommitted
Remove beam period notion, orbit is 32bit long
Since in Run3 the orbit will be 32 bits long (can cover ~100h) and will be reset in the beginning of every fill, we do not need notion of the period in the BC identification (orbit never wraps)
1 parent 7fdb992 commit 92b135a

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

Common/Constants/include/CommonConstants/LHCConstants.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ static constexpr double LHCBunchSpacingNS = 10 * 1.e9 / LHCRFFreq; // bunch
2929
static constexpr double LHCOrbitNS = LHCMaxBunches * LHCBunchSpacingNS; // orbit duration in ns
3030
static constexpr double LHCRevFreq = 1.e9 / LHCOrbitNS; // revolution frequency
3131

32-
// ALICE conventions
33-
static constexpr int MaxNOrbits = 0x1 << 24; // above this (~24min) period is incremented
34-
static constexpr int OrbitMask = MaxNOrbits - 1;
35-
static constexpr int MaxNPeriods = 0x1 << 28;
36-
static constexpr int PreioidMask = MaxNPeriods - 1;
37-
static constexpr double PeriodDurationNS = MaxNOrbits * LHCOrbitNS;
32+
static constexpr unsigned int MaxNOrbits = 0xffffffff;
3833
}
3934
}
4035
}

DataFormats/common/include/CommonDataFormat/InteractionRecord.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
namespace o2
2222
{
2323
struct InteractionRecord {
24-
double timeNS = 0.; ///< time in NANOSECONDS from start of run (period=0, orbit=0)
24+
double timeNS = 0.; ///< time in NANOSECONDS from start of run (orbit=0)
2525
int bc = 0; ///< bunch crossing ID of interaction
26-
int orbit = 0; ///< LHC orbit
27-
int period = 0; ///< LHC period since beginning of run (if >0 -> time precision loss)
26+
unsigned int orbit = 0; ///< LHC orbit
2827

2928
InteractionRecord() = default;
3029

@@ -33,37 +32,32 @@ struct InteractionRecord {
3332
setFromNS(tNS);
3433
}
3534

36-
InteractionRecord(int b, int orb, int per = 0) : bc(b), orbit(orb), period(per)
35+
InteractionRecord(int b, unsigned int orb) : bc(b), orbit(orb)
3736
{
38-
timeNS = bc2ns(bc, orbit, period);
37+
timeNS = bc2ns(bc, orbit);
3938
}
4039

4140
void setFromNS(double ns)
4241
{
4342
timeNS = ns;
44-
bc = ns2bc(ns, orbit, period);
43+
bc = ns2bc(ns, orbit);
4544
}
4645

47-
static double bc2ns(int bc, int orbit, int period)
46+
static double bc2ns(int bc, unsigned int orbit)
4847
{
49-
double t = bc * o2::constants::lhc::LHCBunchSpacingNS + orbit * o2::constants::lhc::LHCOrbitNS;
50-
return period ? t + o2::constants::lhc::PeriodDurationNS : t;
48+
return bc * o2::constants::lhc::LHCBunchSpacingNS + orbit * o2::constants::lhc::LHCOrbitNS;
5149
}
5250

53-
static int ns2bc(double ns, int& orb, int& per)
51+
static int ns2bc(double ns, unsigned int& orb)
5452
{
55-
per = ns / o2::constants::lhc::PeriodDurationNS;
56-
if (per) {
57-
ns -= per * o2::constants::lhc::PeriodDurationNS;
58-
}
59-
orb = ns / o2::constants::lhc::LHCOrbitNS;
53+
orb = ns > 0 ? ns / o2::constants::lhc::LHCOrbitNS : 0;
6054
ns -= orb * o2::constants::lhc::LHCOrbitNS;
6155
return std::round(ns / o2::constants::lhc::LHCBunchSpacingNS);
6256
}
6357

6458
void print() const;
6559

66-
ClassDefNV(InteractionRecord, 1);
60+
ClassDefNV(InteractionRecord, 2);
6761
};
6862
}
6963

DataFormats/common/src/InteractionRecord.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace o2
1414
{
1515
void InteractionRecord::print() const
1616
{
17-
std::cout << "BCid: " << bc << " Orbit: " << orbit << " Period: " << period << " T(ns): " << timeNS << std::endl;
17+
std::cout << "BCid: " << bc << " Orbit: " << orbit << " T(ns): " << timeNS << std::endl;
1818
}
1919

2020
} // namespace o2

0 commit comments

Comments
 (0)