Project
Loading...
Searching...
No Matches
SampaBunchCrossingCounter.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#include "
MCHRawCommon/SampaBunchCrossingCounter.h
"
13
#include "
CommonConstants/LHCConstants.h
"
14
#include "
NofBits.h
"
15
#include "
MCHRawCommon/CoDecParam.h
"
16
17
using namespace
o2::constants::lhc
;
18
19
namespace
o2::mch::raw
20
{
21
22
constexpr
int
BCINORBIT
= o2::constants::lhc::LHCMaxBunches;
23
24
uint20_t
sampaBunchCrossingCounter
(uint32_t
orbit
, uint16_t
bc
,
25
uint32_t firstOrbit)
26
{
27
orbit
-= firstOrbit;
28
auto
bunchCrossingCounter = (
orbit
* LHCMaxBunches +
bc
) % ((1 << 20) - 1);
29
impl::assertNofBits
(
"bunchCrossingCounter"
, bunchCrossingCounter, 20);
30
return
bunchCrossingCounter;
31
}
32
33
std::tuple<uint32_t, uint16_t>
orbitBC
(
uint20_t
bunchCrossingCounter,
34
uint32_t firstOrbit)
35
{
36
impl::assertNofBits
(
"bunchCrossingCounter"
, bunchCrossingCounter, 20);
37
uint32_t
orbit
= bunchCrossingCounter / LHCMaxBunches + firstOrbit;
38
int32_t
bc
= bunchCrossingCounter % LHCMaxBunches;
39
return
{
orbit
,
bc
};
40
}
41
42
}
// namespace o2::mch::raw
CoDecParam.h
orbit
uint64_t orbit
Definition
RawEventData.h:6
bc
uint64_t bc
Definition
RawEventData.h:5
LHCConstants.h
Header to collect LHC related constants.
NofBits.h
SampaBunchCrossingCounter.h
o2::constants::lhc
Definition
LHCConstants.h:26
o2::mch::raw::impl::assertNofBits
void assertNofBits(std::string_view msg, T value, int n)
Definition
NofBits.h:29
o2::mch::raw
Definition
pedestal-decoding-workflow.cxx:58
o2::mch::raw::sampaBunchCrossingCounter
uint20_t sampaBunchCrossingCounter(uint32_t orbit, uint16_t bc, uint32_t firstOrbit)
Definition
SampaBunchCrossingCounter.cxx:24
o2::mch::raw::orbitBC
std::tuple< uint32_t, uint16_t > orbitBC(uint20_t bunchCrossing, uint32_t firstOrbit)
Definition
SampaBunchCrossingCounter.cxx:33
o2::mch::raw::uint20_t
uint32_t uint20_t
Definition
DataFormats.h:68
o2::mch::raw::BCINORBIT
constexpr int BCINORBIT
Definition
SampaBunchCrossingCounter.cxx:22
Detectors
MUON
MCH
Raw
Common
src
SampaBunchCrossingCounter.cxx
Generated on Tue Oct 6 2026 15:49:12 for Project by
1.9.8