ATLAS Offline Software
Loading...
Searching...
No Matches
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
19{
20 clear();
21}
22
23// Full constructor
25 uint16_t srodId,
26 uint16_t bcId,
27 uint16_t l1Id) : DataVector<TgcL1RawData>()
28{
29 clear();
30 m_bcId = bcId;
31 m_l1Id = l1Id;
32
34}
35
36// set Online ID
45
46// class method for RawData identification
48{
49 return calculateOnlineId(rawData.subDetectorId(), rawData.srodId());
50}
51
52std::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
74template <class stream>
75stream& 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
100std::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
Helpers for checking error return status codes and reporting errors.
std::ostream & operator<<(std::ostream &sl, const TgcL1Rdo &coll)
Overload of << operator for std::ostream for debug output.
Definition TgcL1Rdo.cxx:100
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
This is a "hash" representation of an Identifier.
An unit object of TGC SROD output.
uint16_t subDetectorId() const
uint16_t srodId() const
uint16_t version() const
Definition TgcL1Rdo.h:215
uint16_t m_triggerType
Definition TgcL1Rdo.h:247
uint16_t triggerType() const
Definition TgcL1Rdo.h:142
uint16_t m_bcId
Definition TgcL1Rdo.h:250
uint16_t m_id
ID of this instance.
Definition TgcL1Rdo.h:237
IdentifierHash m_idHash
OFFLINE hash of this collection.
Definition TgcL1Rdo.h:240
uint16_t identify() const
Definition TgcL1Rdo.h:107
uint16_t l1Id() const
Definition TgcL1Rdo.h:150
const Errors & errors() const
Definition TgcL1Rdo.h:158
TgcL1Rdo()
Default constructor.
Definition TgcL1Rdo.cxx:11
const SRodStatus & srodStatus() const
Definition TgcL1Rdo.h:174
const LocalStatus & localStatus() const
Definition TgcL1Rdo.h:190
uint16_t srodId() const
Definition TgcL1Rdo.h:138
uint16_t m_version
Definition TgcL1Rdo.h:234
uint16_t m_srodId
Definition TgcL1Rdo.h:244
void setOnlineId(uint16_t subDetectorId, uint16_t srodId)
Definition TgcL1Rdo.cxx:37
uint16_t m_l1Id
Definition TgcL1Rdo.h:251
uint16_t bcId() const
Definition TgcL1Rdo.h:146
uint16_t m_subDetectorId
Definition TgcL1Rdo.h:243
uint32_t m_orbit
Definition TgcL1Rdo.h:256
void clear()
Definition TgcL1Rdo.cxx:106
static uint16_t identifyRawData(const TgcL1RawData &rawData)
Definition TgcL1Rdo.cxx:47
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcL1Rdo.cxx:59
static std::pair< int, int > initOnlineId()
Definition TgcL1Rdo.cxx:52
uint32_t orbit() const
Definition TgcL1Rdo.h:206
uint16_t subDetectorId() const
Definition TgcL1Rdo.h:134
-event-from-file