ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::TgcRDO_Decoder Class Reference

This class provides conversion from TGC RDO data to TGC Digits and offline ID. More...

#include <TgcRDO_Decoder.h>

Inheritance diagram for Muon::TgcRDO_Decoder:
Collaboration diagram for Muon::TgcRDO_Decoder:

Public Member Functions

 ~TgcRDO_Decoder ()=default
virtual StatusCode initialize () override
virtual void applyPatch (bool patch) override
 Set a flag for application of patch.
virtual std::unique_ptr< TgcDigitgetDigit (const EventContext &ctx, const TgcRawData &rawData, bool orFlag) const override
 Get TGC Digit from TGC RDO.
virtual Identifier getOfflineData (const EventContext &ctx, const TgcRawData &rawData, bool orFlag, uint16_t &bctag) const override
 Get offline ID and bcTag from TGC RDO.

Private Attributes

SG::ReadCondHandleKey< Muon::TgcCablingMapm_cablingKey
bool m_applyPatch {false}

Detailed Description

This class provides conversion from TGC RDO data to TGC Digits and offline ID.

Author
Susumu Oda Susum.nosp@m.u.Od.nosp@m.a@cer.nosp@m.n.ch

This class was developed by Tadashi Maeno based on CscRDO_Decoder written by Ketevi A. Assamagan.

Definition at line 28 of file TgcRDO_Decoder.h.

Constructor & Destructor Documentation

◆ ~TgcRDO_Decoder()

Muon::TgcRDO_Decoder::~TgcRDO_Decoder ( )
default

Member Function Documentation

◆ applyPatch()

void Muon::TgcRDO_Decoder::applyPatch ( bool patch)
overridevirtual

Set a flag for application of patch.

Need to describe when patch is required.

Definition at line 22 of file TgcRDO_Decoder.cxx.

22 {
23 m_applyPatch = patch;
24}

◆ getDigit()

std::unique_ptr< TgcDigit > Muon::TgcRDO_Decoder::getDigit ( const EventContext & ctx,
const TgcRawData & rawData,
bool orFlag ) const
overridevirtual

Get TGC Digit from TGC RDO.

Definition at line 26 of file TgcRDO_Decoder.cxx.

28 {
29 // MuonTGC_CablingSvc should be configured at initialise
30 const TgcCablingMap* cabling{nullptr};
31 if (!SG::get(cabling, m_cablingKey, ctx).isSuccess()) {
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}
#define ATH_MSG_ERROR(x)
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingKey
uint16_t sswId() const
Definition TgcRawData.h:272
uint16_t bitpos() const
Definition TgcRawData.h:293
uint16_t bcTag() const
Definition TgcRawData.h:251
uint16_t subDetectorId() const
Definition TgcRawData.h:264
uint16_t slbId() const
Definition TgcRawData.h:276
uint16_t rodId() const
Definition TgcRawData.h:268
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
setWord1 uint16_t

◆ getOfflineData()

Identifier Muon::TgcRDO_Decoder::getOfflineData ( const EventContext & ctx,
const TgcRawData & rawData,
bool orFlag,
uint16_t & bctag ) const
overridevirtual

Get offline ID and bcTag from TGC RDO.

Definition at line 84 of file TgcRDO_Decoder.cxx.

86 {
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()) {
93 "Cabling is not available in "
94 "TgcRDO_Decoder::getOfflineData()");
95 return chanId;
96 }
97
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}
@ BC_UNDEFINED
Definition TgcDigit.h:37

◆ initialize()

StatusCode Muon::TgcRDO_Decoder::initialize ( )
overridevirtual

Definition at line 13 of file TgcRDO_Decoder.cxx.

13 {
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)

Member Data Documentation

◆ m_applyPatch

bool Muon::TgcRDO_Decoder::m_applyPatch {false}
private

Definition at line 51 of file TgcRDO_Decoder.h.

51{false};

◆ m_cablingKey

SG::ReadCondHandleKey<Muon::TgcCablingMap> Muon::TgcRDO_Decoder::m_cablingKey
private
Initial value:
{
this, "CablingKey", "MuonTgc_CablingMap"}

Definition at line 48 of file TgcRDO_Decoder.h.

48 {
49 this, "CablingKey", "MuonTgc_CablingMap"};

The documentation for this class was generated from the following files: