ATLAS Offline Software
TgcL1Rdo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRDO/TgcL1Rdo.h"
7 
8 // Default constructor
10 {
11  m_id = 9999;
12  clear();
13 }
14 
15 // Creates an empty container ready for writing
16 TgcL1Rdo::TgcL1Rdo(uint16_t id, IdentifierHash idHash) : DataVector<TgcL1RawData>(), m_id(id), m_idHash(idHash)
17 {
18  clear();
19 }
20 
21 // Full constructor
23  uint16_t srodId,
24  uint16_t bcId,
26 {
27  clear();
28  m_bcId = bcId;
29  m_l1Id = l1Id;
30 
32 }
33 
34 // set Online ID
35 void TgcL1Rdo::setOnlineId(uint16_t subDetectorId, uint16_t srodId)
36 {
38  m_srodId = srodId;
39 
40  // set my ID
42 }
43 
44 // class method for RawData identification
46 {
47  return calculateOnlineId(rawData.subDetectorId(), rawData.srodId());
48 }
49 
50 std::pair<int, int> TgcL1Rdo::initOnlineId() {
51  static constexpr int offset = -1; // 0 start
52  static constexpr int MAX_N_SROD = 3;
53  return std::make_pair(offset, MAX_N_SROD);
54 }
55 
56 // online ID calculator
58 {
59  static const std::pair<int, int> offset_max = initOnlineId();
60  int offset = offset_max.first;
61  int MAX_N_SROD = offset_max.second;
62  if (MAX_N_SROD < 0) {
63  return 9999;
64  }
65 
66  // A-side or C-side ?
67  uint16_t is = (subDetectorId == 0x67) ? 0 : 1;
68 
69  return is * MAX_N_SROD + srodId + offset;
70 }
71 
72 template <class stream>
73 stream& dump(stream& sl, const TgcL1Rdo& coll)
74 {
75  sl << "TgcL1Rdo: "
76  << " version=" << coll.version()
77  << ", id=" << std::hex << coll.identify() << std::dec
78  << ", srodId=" << coll.srodId()
79  << ", subDetectorId=" << std::hex << coll.subDetectorId() << std::dec
80  << ", triggerType=" << (int16_t)coll.triggerType()
81  << ", bcId=" << coll.bcId()
82  << ", l1Id=" << coll.l1Id()
83  << ", errors=" << std::hex << *((uint16_t*)&coll.errors())
84  << ", srodStatus=" << *((uint32_t*)&coll.srodStatus())
85  << ", localStatus=" << *((uint32_t*)&coll.localStatus()) << std::dec
86  << ", orbit=" << coll.orbit()
87  << std::endl << "TgcL1RawData: [" << std::endl;
88  int iRaw = 0;
89  for (const TgcL1RawData* tgc : coll)
90  {
91  sl << ++iRaw
92  << ": " << *tgc << std::endl;
93  }
94  sl << "]";
95  return sl;
96 }
97 
98 std::ostream& operator<<(std::ostream& sl, const TgcL1Rdo& coll)
99 {
100  dump(sl, coll) << std::endl;
101  return sl;
102 }
103 
105 {
106  m_version = 300;
108  memset(&m_errors, 0, sizeof(Errors));
109  memset(&m_srodStatus, 0, sizeof(SRodStatus));
110  memset(&m_localStatus, 0, sizeof(LocalStatus));
111  m_orbit = 0;
112 }
113 
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
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
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:73
TgcL1Rdo::identify
uint16_t identify() const
Definition: TgcL1Rdo.h:107
TgcL1Rdo::identifyRawData
static uint16_t identifyRawData(const TgcL1RawData &rawData)
Definition: TgcL1Rdo.cxx:45
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:50
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:35
TgcL1Rdo::TgcL1Rdo
TgcL1Rdo()
Default constructor.
Definition: TgcL1Rdo.cxx:9
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:326
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
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:57
TgcL1Rdo::clear
void clear()
Definition: TgcL1Rdo.cxx:104
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:98
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