ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonTGC_CnvTools
src
TgcRDO_Decoder.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 "
TgcRDO_Decoder.h
"
6
7
#include "Identifier/Identifier.h"
8
#include "
MuonDigitContainer/TgcDigit.h
"
9
#include "
MuonRDO/TgcRawData.h
"
10
11
namespace
Muon
{
12
// constructor
13
StatusCode
TgcRDO_Decoder::initialize
() {
14
ATH_MSG_DEBUG
(
"TgcRDO_Decoder::initialize"
);
15
16
// try to configure the cabling service
17
ATH_CHECK
(
m_cablingKey
.initialize());
18
19
return
StatusCode::SUCCESS;
20
}
21
22
void
TgcRDO_Decoder::applyPatch
(
bool
patch) {
23
m_applyPatch
= patch;
24
}
25
26
std::unique_ptr<TgcDigit>
TgcRDO_Decoder::getDigit
(
const
EventContext& ctx,
27
const
TgcRawData
& rawData,
28
bool
orFlag)
const
{
29
// MuonTGC_CablingSvc should be configured at initialise
30
const
TgcCablingMap
* cabling{
nullptr
};
31
if
(!
SG::get
(cabling,
m_cablingKey
, ctx).isSuccess()) {
32
ATH_MSG_ERROR
(
33
"Cabling is not available in "
34
"TgcRDO_Decoder::getDigit()"
);
35
return
nullptr
;
36
}
37
38
int
offset = 0, offsetORed = 0;
39
40
const
uint16_t sswId = rawData.
sswId
();
41
const
uint16_t slbId = rawData.
slbId
();
42
const
uint16_t bitpos = rawData.
bitpos
();
43
44
if
(
m_applyPatch
) {
45
if
(sswId == 9) {
46
if
((slbId % 4 == 3 && bitpos >= 77 && bitpos <= 84) ||
47
(slbId % 4 != 3 && bitpos >= 77 && bitpos <= 111)) {
48
offset = 1;
49
}
50
}
else
if
(sswId >= 3 && sswId <= 8) {
51
if
((slbId == 1 && bitpos >= 66 && bitpos <= 73) ||
52
(slbId == 2 && bitpos >= 42 && bitpos <= 63)) {
53
offset = 36;
54
}
55
if
((slbId == 1 && bitpos >= 102 && bitpos <= 109) ||
56
(slbId == 2 && bitpos >= 78 && bitpos <= 99)) {
57
offset = -36;
58
}
59
if
((slbId == 1 && bitpos >= 74 && bitpos <= 75) ||
60
(slbId == 2 && bitpos >= 40 && bitpos <= 41)) {
61
offsetORed = 36;
62
}
63
if
((slbId == 1 && bitpos >= 110 && bitpos <= 111) ||
64
(slbId == 2 && bitpos >= 76 && bitpos <= 77)) {
65
offsetORed = -36;
66
}
67
}
68
}
69
int
corr = orFlag ? offsetORed : offset;
70
71
// get official channel ID
72
Identifier
chanId;
73
bool
c_found = cabling->getOfflineIDfromReadoutID(
74
chanId, rawData.
subDetectorId
(), rawData.
rodId
(), sswId, slbId,
75
bitpos + corr, orFlag);
76
77
if
(!c_found) {
78
return
nullptr
;
79
}
80
81
return
std::make_unique<TgcDigit>(chanId, rawData.
bcTag
());
82
}
83
84
Identifier
TgcRDO_Decoder::getOfflineData
(
const
EventContext& ctx,
85
const
TgcRawData
& rawData,
86
bool
orFlag, uint16_t& bctag)
const
{
87
Identifier
chanId{};
88
89
// ITGCcablingSvc should be configured at initialise
90
const
TgcCablingMap
* cabling{
nullptr
};
91
if
(!
SG::get
(cabling,
m_cablingKey
, ctx).isSuccess()) {
92
ATH_MSG_ERROR
(
93
"Cabling is not available in "
94
"TgcRDO_Decoder::getOfflineData()"
);
95
return
chanId;
96
}
97
98
bctag =
TgcDigit::BC_UNDEFINED
;
99
100
const
uint16_t sswId = rawData.
sswId
();
101
const
uint16_t slbId = rawData.
slbId
();
102
const
uint16_t bitpos = rawData.
bitpos
();
103
104
int
offset = 0, offsetORed = 0;
105
if
(
m_applyPatch
) {
106
if
(sswId == 9) {
107
if
((slbId % 4 == 3 && bitpos >= 77 && bitpos <= 84) ||
108
(slbId % 4 != 3 && bitpos >= 77 && bitpos <= 111)) {
109
offset = 1;
110
}
111
}
else
if
(sswId >= 3 && sswId <= 8) {
112
if
((slbId == 1 && bitpos >= 66 && bitpos <= 73) ||
113
(slbId == 2 && bitpos >= 42 && bitpos <= 63)) {
114
offset = 36;
115
}
116
if
((slbId == 1 && bitpos >= 102 && bitpos <= 109) ||
117
(slbId == 2 && bitpos >= 78 && bitpos <= 99)) {
118
offset = -36;
119
}
120
if
((slbId == 1 && bitpos >= 74 && bitpos <= 75) ||
121
(slbId == 2 && bitpos >= 40 && bitpos <= 41)) {
122
offsetORed = 36;
123
}
124
if
((slbId == 1 && bitpos >= 110 && bitpos <= 111) ||
125
(slbId == 2 && bitpos >= 76 && bitpos <= 77)) {
126
offsetORed = -36;
127
}
128
}
129
}
130
int
corr = orFlag ? offsetORed : offset;
131
132
// get official channel ID
133
bool
c_found = cabling->getOfflineIDfromReadoutID(
134
chanId, rawData.
subDetectorId
(), rawData.
rodId
(), sswId, slbId,
135
bitpos + corr, orFlag);
136
137
if
(!c_found) {
138
return
chanId;
139
}
140
141
bctag = rawData.
bcTag
();
142
return
chanId;
143
}
144
}
// namespace Muon
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TgcDigit.h
TgcRDO_Decoder.h
TgcRawData.h
Muon::TgcCablingMap
Definition
TgcCablingMap.h:21
Muon::TgcRDO_Decoder::getOfflineData
virtual Identifier getOfflineData(const EventContext &ctx, const TgcRawData &rawData, bool orFlag, uint16_t &bctag) const override
Get offline ID and bcTag from TGC RDO.
Definition
TgcRDO_Decoder.cxx:84
Muon::TgcRDO_Decoder::m_cablingKey
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingKey
Definition
TgcRDO_Decoder.h:48
Muon::TgcRDO_Decoder::applyPatch
virtual void applyPatch(bool patch) override
Set a flag for application of patch.
Definition
TgcRDO_Decoder.cxx:22
Muon::TgcRDO_Decoder::initialize
virtual StatusCode initialize() override
Definition
TgcRDO_Decoder.cxx:13
Muon::TgcRDO_Decoder::getDigit
virtual std::unique_ptr< TgcDigit > getDigit(const EventContext &ctx, const TgcRawData &rawData, bool orFlag) const override
Get TGC Digit from TGC RDO.
Definition
TgcRDO_Decoder.cxx:26
Muon::TgcRDO_Decoder::m_applyPatch
bool m_applyPatch
Definition
TgcRDO_Decoder.h:51
TgcDigit::BC_UNDEFINED
@ BC_UNDEFINED
Definition
TgcDigit.h:37
TgcRawData
An unit object of TGC ROD output.
Definition
TgcRawData.h:23
TgcRawData::sswId
uint16_t sswId() const
Definition
TgcRawData.h:272
TgcRawData::bitpos
uint16_t bitpos() const
Definition
TgcRawData.h:293
TgcRawData::bcTag
uint16_t bcTag() const
Definition
TgcRawData.h:251
TgcRawData::subDetectorId
uint16_t subDetectorId() const
Definition
TgcRawData.h:264
TgcRawData::slbId
uint16_t slbId() const
Definition
TgcRawData.h:276
TgcRawData::rodId
uint16_t rodId() const
Definition
TgcRawData.h:268
Identifier
Definition
IdentifierFieldParser.cxx:14
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
Generated on
for ATLAS Offline Software by
1.17.0