ATLAS Offline Software
TgcL1Rdo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRDO/TgcL1Rdo.h"
7 #include <bit>
8 #include <string.h> // memset
9 
10 // Default constructor
12 {
13  m_id = 9999;
14  clear();
15 }
16 
17 // Creates an empty container ready for writing
18 TgcL1Rdo::TgcL1Rdo(uint16_t id, IdentifierHash idHash) : DataVector<TgcL1RawData>(), m_id(id), m_idHash(idHash)
19 {
20  clear();
21 }
22 
23 // Full constructor
25  uint16_t srodId,
26  uint16_t bcId,
28 {
29  clear();
30  m_bcId = bcId;
31  m_l1Id = l1Id;
32 
34 }
35 
36 // set Online ID
37 void TgcL1Rdo::setOnlineId(uint16_t subDetectorId, uint16_t srodId)
38 {
40  m_srodId = srodId;
41 
42  // set my ID
44 }
45 
46 // class method for RawData identification
48 {
49  return calculateOnlineId(rawData.subDetectorId(), rawData.srodId());
50 }
51 
52 std::pair<int, int> TgcL1Rdo::initOnlineId() {
53  static constexpr int offset = -1; // 0 start
54  static constexpr int MAX_N_SROD = 3;
55  return std::make_pair(offset, MAX_N_SROD);
56 }
57 
58 // online ID calculator
60 {
61  static const std::pair<int, int> offset_max = initOnlineId();
62  int offset = offset_max.first;
63  int MAX_N_SROD = offset_max.second;
64  if (MAX_N_SROD < 0) {
65  return 9999;
66  }
67 
68  // A-side or C-side ?
69  uint16_t is = (subDetectorId == 0x67) ? 0 : 1;
70 
71  return is * MAX_N_SROD + srodId + offset;
72 }
73 
74 template <class stream>
75 stream& dump(stream& sl, const TgcL1Rdo& coll)
76 {
77  sl << "TgcL1Rdo: "
78  << " version=" << coll.version()
79  << ", id=" << std::hex << coll.identify() << std::dec
80  << ", srodId=" << coll.srodId()
81  << ", subDetectorId=" << std::hex << coll.subDetectorId() << std::dec
82  << ", triggerType=" << (int16_t)coll.triggerType()
83  << ", bcId=" << coll.bcId()
84  << ", l1Id=" << coll.l1Id()
85  << ", errors=" << std::hex << std::bit_cast<unsigned>(coll.errors())
86  << ", srodStatus=" << std::bit_cast<unsigned>(coll.srodStatus())
87  << ", localStatus=" << std::bit_cast<unsigned>(coll.localStatus()) << std::dec
88  << ", orbit=" << coll.orbit()
89  << std::endl << "TgcL1RawData: [" << std::endl;
90  int iRaw = 0;
91  for (const TgcL1RawData* tgc : coll)
92  {
93  sl << ++iRaw
94  << ": " << *tgc << std::endl;
95  }
96  sl << "]";
97  return sl;
98 }
99 
100 std::ostream& operator<<(std::ostream& sl, const TgcL1Rdo& coll)
101 {
102  dump(sl, coll) << std::endl;
103  return sl;
104 }
105 
107 {
108  m_version = 300;
110  memset(&m_errors, 0, sizeof(Errors));
111  memset(&m_srodStatus, 0, sizeof(SRodStatus));
112  memset(&m_localStatus, 0, sizeof(LocalStatus));
113  m_orbit = 0;
114 }
115 
TgcL1Rdo::m_srodStatus
Definition: TgcL1Rdo.h:254
TgcL1Rdo::Errors
Definition: TgcL1Rdo.h:36
TgcL1Rdo::SRodStatus
Definition: TgcL1Rdo.h:45
TgcL1Rdo::triggerType
uint16_t triggerType() const
Definition: TgcL1Rdo.h:142
TgcL1Rdo::m_l1Id
uint16_t m_l1Id
Definition: TgcL1Rdo.h:251
TgcL1Rdo::m_bcId
uint16_t m_bcId
Definition: TgcL1Rdo.h:250
TgcL1RawData::subDetectorId
uint16_t subDetectorId() const
Definition: TgcL1RawData.h:194
TgcL1Rdo::m_triggerType
uint16_t m_triggerType
Definition: TgcL1Rdo.h:247
TgcL1Rdo::orbit
uint32_t orbit() const
Definition: TgcL1Rdo.h:206
TgcL1RawData::srodId
uint16_t srodId() const
Definition: TgcL1RawData.h:210
TgcL1Rdo::l1Id
uint16_t l1Id() const
Definition: TgcL1Rdo.h:150
TgcL1Rdo::m_version
uint16_t m_version
Definition: TgcL1Rdo.h:234
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
TgcL1Rdo.h
dump
stream & dump(stream &sl, const TgcL1Rdo &coll)
Definition: TgcL1Rdo.cxx:75
TgcL1Rdo::identify
uint16_t identify() const
Definition: TgcL1Rdo.h:107
TgcL1Rdo::identifyRawData
static uint16_t identifyRawData(const TgcL1RawData &rawData)
Definition: TgcL1Rdo.cxx:47
TgcL1Rdo::m_errors
Definition: TgcL1Rdo.h:253
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TgcL1RawData
An unit object of TGC SROD output.
Definition: TgcL1RawData.h:21
TgcL1Rdo::version
uint16_t version() const
Definition: TgcL1Rdo.h:215
TgcL1Rdo::localStatus
const LocalStatus & localStatus() const
Definition: TgcL1Rdo.h:190
TgcL1Rdo::bcId
uint16_t bcId() const
Definition: TgcL1Rdo.h:146
TgcL1Rdo::initOnlineId
static std::pair< int, int > initOnlineId()
Definition: TgcL1Rdo.cxx:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TgcL1Rdo::subDetectorId
uint16_t subDetectorId() const
Definition: TgcL1Rdo.h:134
TgcL1Rdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t srodId)
Definition: TgcL1Rdo.cxx:37
TgcL1Rdo::TgcL1Rdo
TgcL1Rdo()
Default constructor.
Definition: TgcL1Rdo.cxx:11
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:326
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
TgcL1Rdo::m_orbit
uint32_t m_orbit
Definition: TgcL1Rdo.h:256
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TgcL1Rdo::m_subDetectorId
uint16_t m_subDetectorId
Definition: TgcL1Rdo.h:243
TgcL1Rdo::m_localStatus
Definition: TgcL1Rdo.h:255
TgcL1Rdo::m_id
uint16_t m_id
ID of this instance.
Definition: TgcL1Rdo.h:237
TgcL1Rdo::calculateOnlineId
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcL1Rdo.cxx:59
TgcL1Rdo::clear
void clear()
Definition: TgcL1Rdo.cxx:106
TgcL1Rdo::srodId
uint16_t srodId() const
Definition: TgcL1Rdo.h:138
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
operator<<
std::ostream & operator<<(std::ostream &sl, const TgcL1Rdo &coll)
Overload of << operator for std::ostream for debug output.
Definition: TgcL1Rdo.cxx:100
TgcL1Rdo::m_srodId
uint16_t m_srodId
Definition: TgcL1Rdo.h:244
TgcL1Rdo::LocalStatus
Definition: TgcL1Rdo.h:77
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TgcL1Rdo::srodStatus
const SRodStatus & srodStatus() const
Definition: TgcL1Rdo.h:174
TgcL1Rdo::errors
const Errors & errors() const
Definition: TgcL1Rdo.h:158
TgcL1Rdo
Definition: TgcL1Rdo.h:22