Project
Loading...
Searching...
No Matches
LHCConstants.h
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
15
16#ifndef ALICEO2_LHCCONSTANTS_H_
17#define ALICEO2_LHCCONSTANTS_H_
18
19namespace o2
20{
21namespace constants
22{
23namespace lhc
24{
25// LHC Beam1 and Beam2 definitions
26enum BeamDirection : int { BeamA, // beamA = beam 0,
27 BeamC, // beamC = beam 1
29 InteractingBC = -1 // as used in the BunchFilling class
30};
31constexpr int LHCMaxBunches = 3564; // max N bunches
32constexpr double LHCRFFreq = 400.789e6; // LHC RF frequency in Hz
33constexpr double LHCBunchSpacingNS = 10 * 1.e9 / LHCRFFreq; // bunch spacing in ns (10 RFbuckets)
34constexpr double LHCOrbitNS = LHCMaxBunches * LHCBunchSpacingNS; // orbit duration in ns
35constexpr double LHCRevFreq = 1.e9 / LHCOrbitNS; // revolution frequency
36constexpr double LHCBunchSpacingMUS = LHCBunchSpacingNS * 1e-3; // bunch spacing in \mus (10 RFbuckets)
37constexpr double LHCOrbitMUS = LHCOrbitNS * 1e-3; // orbit duration in \mus
38constexpr unsigned int MaxNOrbits = 0xffffffff;
39
40// Offsets of A, C beam bunches at P2
41constexpr int BunchOffsetsP2[2] = {344, 3017};
42
43// convert LHC bunch ID to BC for 2 beam directions
44constexpr int LHCBunch2P2BC(int bunch, BeamDirection dir)
45{
46 return (bunch + BunchOffsetsP2[int(dir)]) % LHCMaxBunches;
47}
48
49// convert BC at P2 to LHC bunch ID for 2 beam directions
50constexpr int P2BC2LHCBunch(int bc, BeamDirection dir)
51{
52 int bunch = bc - BunchOffsetsP2[int(dir)];
53 return bunch < 0 ? bunch + LHCMaxBunches : bunch;
54}
55
56} // namespace lhc
57} // namespace constants
58} // namespace o2
59
60#endif
uint64_t bc
Definition RawEventData.h:5
constexpr unsigned int MaxNOrbits
constexpr double LHCBunchSpacingMUS
constexpr int LHCMaxBunches
constexpr double LHCOrbitMUS
constexpr double LHCRFFreq
constexpr int LHCBunch2P2BC(int bunch, BeamDirection dir)
constexpr double LHCBunchSpacingNS
constexpr int P2BC2LHCBunch(int bc, BeamDirection dir)
constexpr double LHCOrbitNS
constexpr int BunchOffsetsP2[2]
constexpr double LHCRevFreq
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...