39 {
40 TgcDigitCollection* collection = nullptr;
41
42 const IdContext tgcContext =
m_idHelperSvc->tgcIdHelper().module_context();
43
45
46
47
48 std::map<std::vector<uint16_t>,
uint16_t> stripMap;
49
50
51
52
53
54
55
56
57
58
59
60
62 if (rawData->isCoincidence()) continue;
64 if (rawData->sswId() == 7) continue;
65 if (rawData->bitpos() < 112 || rawData->bitpos() > 199) continue;
66
67 std::vector<uint16_t> stripId(5, 0);
68 stripId.at(0) = rawData->subDetectorId();
69 stripId.at(1) = rawData->rodId();
70 stripId.at(2) = rawData->sswId();
71 stripId.at(3) = rawData->bitpos();
72 stripId.at(4) = rawData->bcTag();
73 uint16_t stripSlbBits = 0x1 << (rawData->slbId() - 16);
74 std::map<std::vector<uint16_t>,
uint16_t>::iterator itMap = stripMap.find(stripId);
75 if (itMap == stripMap.end()) {
76 stripMap.insert(std::map<std::vector<uint16_t>, uint16_t>::value_type(stripId, stripSlbBits));
77 } else {
78 itMap->second |= stripSlbBits;
79 }
80 }
81
82 for (auto& jtPair : stripMap) {
83 if (jtPair.second <= 31) {
84
85
86
87 static const uint16_t originalHitBits[32] = {
88 0, 1, 0, 3, 0, 0, 4, 7,
89
90 0, 0, 0, 0, 8, 9, 12, 15,
91
92 0, 0, 0, 0, 0, 0, 0, 0,
93
94 16, 17, 0, 19, 24, 25, 28, 31};
95 jtPair.second = originalHitBits[jtPair.second];
96 } else {
97 jtPair.second = 0;
98 }
99 }
100
101
103
104 if (rawData->isCoincidence()) continue;
105
106
108 rawData->sswId() != 7 &&
109 rawData->bitpos() >= 112 && rawData->bitpos() <= 199
110 ) {
111 std::vector<uint16_t> stripId(5, 0);
112 stripId.at(0) = rawData->subDetectorId();
113 stripId.at(1) = rawData->rodId();
114 stripId.at(2) = rawData->sswId();
115 stripId.at(3) = rawData->bitpos();
116 stripId.at(4) = rawData->bcTag();
117 std::map<std::vector<uint16_t>,
uint16_t>::iterator itMap = stripMap.find(stripId);
118 if (itMap != stripMap.end()) {
119 uint16_t stripSlbBits = 0x1 << (rawData->slbId() - 16);
120 if (!(itMap->second & stripSlbBits)) continue;
121 }
122 }
123
124
125
126 for (int iOr = 0; iOr < 2; ++iOr) {
127
129
130 bool orFlag = false;
131
132
133 if (iOr != 0) {
134 const bool o_found =
m_tgcCabling->isOredChannel(rawData->subDetectorId(), rawData->rodId(), rawData->sswId(),
135 rawData->slbId(), rawData->bitpos());
136
137 if (o_found)
138 orFlag = true;
139 else
140 continue;
141 }
142
143
144 Identifier elementId;
145 const bool e_found =
m_tgcCabling->getElementIDfromReadoutID(elementId, rawData->subDetectorId(), rawData->rodId(),
146 rawData->sswId(), rawData->slbId(), rawData->bitpos(), orFlag);
147
148 if (!e_found) {
149 bool show_warning_level = true;
150
151
152
153
154
155 if (rawData->subDetectorId() == 103 && rawData->rodId() == 9 && rawData->sswId() == 6 && rawData->slbId() == 20 &&
156 rawData->bitpos() == 151) {
158 }
159
160 if (show_warning_level ||
msgLvl(MSG::DEBUG)) {
162 << " sub=" << rawData->subDetectorId() << " rod=" << rawData->rodId() << " ssw=" << rawData->sswId()
163 << " slb=" << rawData->slbId() << " bitpos=" << rawData->bitpos() << " orFlag=" << orFlag);
164 }
165 continue;
166 }
167
168
170
171
172 if (!newDigit) continue;
173
174
175 IdentifierHash coll_hash;
176 if (
m_idHelperSvc->tgcIdHelper().get_hash(elementId, coll_hash, &tgcContext)) {
178 <<
"context begin_index = " << tgcContext.
begin_index()
179 <<
" context end_index = " << tgcContext.
end_index() <<
" the identifier is ");
181 }
182
183 if (elementId != oldElementId) {
184
185 const auto *coll = tgcContainer->
indexFindPtr(coll_hash);
186 if (nullptr != coll) {
187 TgcDigitCollection* aCollection
ATLAS_THREAD_SAFE =
const_cast<TgcDigitCollection*
>(coll);
188 collection = aCollection;
189 } else {
190
191 ATH_MSG_DEBUG(
"Created a new digit collection : " << coll_hash);
192 collection = new TgcDigitCollection(elementId, coll_hash);
194 }
195
196 oldElementId = elementId;
197 }
198
199 if (!collection) {
200 ATH_MSG_WARNING(
"TgcRdoToTgcDigit::decodeTgc TgcDigitCollection* collection is null.");
201 return StatusCode::SUCCESS;
202 }
203
204
205 bool duplicate = false;
206 for (const TgcDigit* digit : *collection) {
207 if ((newDigit->identify() ==
digit->identify()) && (newDigit->bcTag() ==
digit->bcTag())) {
208 duplicate = true;
210 break;
211 }
212 }
213 if (!duplicate) {
214
215 collection->push_back(newDigit.release());
216 }
217 }
218 }
219 return StatusCode::SUCCESS;
220}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current TgcRawData
#define ATLAS_THREAD_SAFE
bool msgLvl(const MSG::Level lvl) const
size_type size() const noexcept
Returns the number of elements in the collection.
size_type begin_index() const
size_type end_index() const
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
void show() const
Print out in hex form.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< Muon::ITGC_RDO_Decoder > m_tgcRdoDecoderTool
ServiceHandle< MuonTGC_CablingSvc > m_tgcCabling
Gaudi::Property< bool > m_show_warning_level_invalid_TGC_A09_SSW6_hit