ATLAS Offline Software
TgcRdo.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/TgcRdo.h"
7 
8 // Default constructor
10 {
11  m_id = 9999;
12  clear();
13 }
14 
15 // Creates an empty container ready for writing
16 TgcRdo::TgcRdo(uint16_t id, IdentifierHash idHash) : DataVector<TgcRawData>(), m_id(id), m_idHash(idHash)
17 {
18  clear();
19 }
20 
21 // Full constructor
22 TgcRdo::TgcRdo(uint16_t subDetectorId,
23  uint16_t rodId,
24  uint16_t bcId,
25  uint16_t l1Id) : DataVector<TgcRawData>()
26 {
27  clear();
28  m_bcId = bcId;
29  m_l1Id = l1Id;
30 
32 }
33 
34 // set Online ID
35 void TgcRdo::setOnlineId(uint16_t subDetectorId, uint16_t rodId)
36 {
38  m_rodId = rodId;
39 
40  // set my ID
42 }
43 
44 // class method for RawData identification
46 {
47  return calculateOnlineId(rawData.subDetectorId(), rawData.rodId());
48 }
49 
50 // Returns offset, MAX_N_ROD
51 std::pair<int, int> TgcRdo::initOnlineId() {
52  static constexpr int offset = -1;
53  static constexpr int MAX_N_ROD = 12;
54  return std::make_pair (offset, MAX_N_ROD);
55 }
56 
57 // online ID calculator
59 {
60  int offset = -1;
61  int MAX_N_ROD = 12;
62  if ( rodId < 13 ){
63  static const std::pair<int, int> offset_max = initOnlineId();
64  offset = offset_max.first;
65  MAX_N_ROD = offset_max.second;
66  }else{
67  offset = 7; // 24-0x11
68  MAX_N_ROD = 3;
69  }
70  if (MAX_N_ROD < 0) {
71  return 9999;
72  }
73 
74  // A-side or C-side ?
75  uint16_t is = (subDetectorId == 0x67) ? 0 : 1;
76 
77  return is * MAX_N_ROD + rodId + offset; // 0-23 : ROD, 24-29 : SROD
78 }
79 
80 template <class stream>
81 stream& dump(stream& sl, const TgcRdo& coll)
82 {
83  sl << "TgcRdo: "
84  << " version=" << coll.version()
85  << ", id=" << std::hex << coll.identify() << std::dec
86  << ", rodId=" << coll.rodId()
87  << ", subDetectorId=" << std::hex << coll.subDetectorId() << std::dec
88  << ", triggerType=" << (int16_t)coll.triggerType()
89  << ", bcId=" << coll.bcId()
90  << ", l1Id=" << coll.l1Id()
91  << ", errors=" << std::hex << *((uint16_t*)&coll.errors())
92  << ", rodStatus=" << *((uint32_t*)&coll.rodStatus())
93  << ", localStatus=" << *((uint32_t*)&coll.localStatus()) << std::dec
94  << ", orbit=" << coll.orbit()
95  << std::endl << "TgcRawData: [" << std::endl;
96  int iRaw = 0;
97  for (const TgcRawData* rd : coll)
98  {
99  sl << ++iRaw
100  << ": " << *rd << std::endl;
101  }
102  sl << "]";
103  return sl;
104 }
105 
106 std::ostream& operator<<(std::ostream& sl, const TgcRdo& coll)
107 {
108  dump(sl, coll) << std::endl;
109  return sl;
110 }
111 
113 {
114  m_version = 300;
116  memset(&m_errors, 0, sizeof(Errors));
117  memset(&m_rodStatus, 0, sizeof(RodStatus));
118  memset(&m_localStatus, 0, sizeof(LocalStatus));
119  m_orbit = 0;
120 }
121 
TgcRdo::identify
uint16_t identify() const
Definition: TgcRdo.h:107
TgcRdo::identifyRawData
static uint16_t identifyRawData(const TgcRawData &rawData)
Definition: TgcRdo.cxx:45
TgcRdo::m_subDetectorId
uint16_t m_subDetectorId
Definition: TgcRdo.h:246
operator<<
std::ostream & operator<<(std::ostream &sl, const TgcRdo &coll)
Overload of << operator for std::ostream for debug output.
Definition: TgcRdo.cxx:106
TgcRdo::calculateOnlineId
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcRdo.cxx:58
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TgcRdo::m_id
uint16_t m_id
ID of this instance.
Definition: TgcRdo.h:240
TgcRdo::localStatus
const LocalStatus & localStatus() const
Definition: TgcRdo.h:190
TgcRdo::m_version
uint16_t m_version
Definition: TgcRdo.h:237
TgcRdo::m_triggerType
uint16_t m_triggerType
Definition: TgcRdo.h:250
TgcRdo::rodStatus
const RodStatus & rodStatus() const
Definition: TgcRdo.h:174
TgcRawData::subDetectorId
uint16_t subDetectorId() const
Definition: TgcRawData.h:264
TgcRdo::triggerType
uint16_t triggerType() const
Definition: TgcRdo.h:142
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
TgcRdo::l1Id
uint16_t l1Id() const
Definition: TgcRdo.h:150
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
TgcRdo::m_orbit
uint32_t m_orbit
Definition: TgcRdo.h:259
TgcRdo::clear
void clear()
Definition: TgcRdo.cxx:112
TgcRdo::LocalStatus
Definition: TgcRdo.h:77
TgcRawData::rodId
uint16_t rodId() const
Definition: TgcRawData.h:268
TgcRdo::orbit
uint32_t orbit() const
Definition: TgcRdo.h:206
TgcRdo::m_bcId
uint16_t m_bcId
Definition: TgcRdo.h:253
TgcRdo::m_rodId
uint16_t m_rodId
Definition: TgcRdo.h:247
TgcRdo::subDetectorId
uint16_t subDetectorId() const
Definition: TgcRdo.h:134
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TgcRdo.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TgcRdo::m_errors
Definition: TgcRdo.h:256
TgcRdo::bcId
uint16_t bcId() const
Definition: TgcRdo.h:146
TgcRdo::initOnlineId
static std::pair< int, int > initOnlineId()
Definition: TgcRdo.cxx:51
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:326
TgcRdo::RodStatus
Definition: TgcRdo.h:45
dump
stream & dump(stream &sl, const TgcRdo &coll)
Definition: TgcRdo.cxx:81
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
TgcRdo::errors
const Errors & errors() const
Definition: TgcRdo.h:158
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TgcRdo::m_localStatus
Definition: TgcRdo.h:258
TgcRdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcRdo.cxx:35
TgcRdo::m_l1Id
uint16_t m_l1Id
Definition: TgcRdo.h:254
TgcRdo::version
uint16_t version() const
Definition: TgcRdo.h:215
TgcRdo::TgcRdo
TgcRdo()
Default constructor.
Definition: TgcRdo.cxx:9
TgcRawData
An unit object of TGC ROD output.
Definition: TgcRawData.h:23
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
TgcRdo
Definition: TgcRdo.h:22
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
TgcRdo::rodId
uint16_t rodId() const
Definition: TgcRdo.h:138
TgcRdo::m_rodStatus
Definition: TgcRdo.h:257
TgcRdo::Errors
Definition: TgcRdo.h:36