ATLAS Offline Software
Loading...
Searching...
No Matches
RPCCandData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5#include <algorithm>
6#include <stdexcept>
7
8namespace L0Muon
9{
10
13
14 {
15 // Initialize the z positions and coincidence type
16 for (int i = 0; i < 4; ++i)
17 {
18 m_zPos[i] = 0xffff;
19 }
20 m_coinType = 0;
21 }
22
24 {
25 if (index < 0 || index > 3)
26 {
27 return;
28 }
30
31 m_zPos[index] = static_cast<uint16_t>(std::round((zPos + s_zPosRange) / (2.0f * s_zPosRange) * static_cast<float>(s_zPosBitRange)));
32
33
34 }
36 {
38 m_coinType = static_cast<uint8_t>(coinType / s_coinTypeRange * static_cast<float>(s_coinTypeBitRange));
39 }
40
41
42 float RPCCandData::zPos(int index) const
43{
44 if (index < 0 || index > 3) {
45 return 0.0;
46 }
47
48 if (m_zPos[index] == 0xffff) {
49 return -999.f;
50 }
51 return static_cast<float>(m_zPos[index]) / static_cast<float>(s_zPosBitRange) * 2.0f * s_zPosRange - s_zPosRange;
52}
53
54 uint8_t RPCCandData::coinType() const
55 {
56 return static_cast<uint8_t>(m_coinType / s_coinTypeRange * static_cast<float>(s_coinTypeBitRange));
57 }
58
59}
60
uint16_t bcTag() const
Definition ICandData.h:25
uint16_t subdetectorId() const
Definition ICandData.h:23
ICandData(uint16_t subdetectorId, uint16_t sectorId, uint16_t bcTag)
Definition ICandData.h:17
uint16_t sectorId() const
Definition ICandData.h:24
uint8_t coinType() const
std::array< uint16_t, 4 > m_zPos
Z positions of the RPC hits.
Definition RPCCandData.h:50
static constexpr uint8_t s_coinTypeRange
range of the coincidence type value
Definition RPCCandData.h:39
static constexpr uint8_t s_coinTypeBitRange
3 bits for the coincidence type
Definition RPCCandData.h:43
uint8_t m_coinType
coincidence type
Definition RPCCandData.h:53
void setZPos(float zPos, int index)
static constexpr float s_zPosRange
range of the RPC hits z positions
Definition RPCCandData.h:37
static constexpr uint16_t s_zPosBitRange
12 bits for z position
Definition RPCCandData.h:41
float zPos(int index) const
void setCoinType(uint8_t coinType)
Definition index.py:1