51#define WARNING_WITH_LINE(msg) ATH_MSG_WARNING(__func__ << "():" << __LINE__<< " " << msg)
65 }
catch (
const eformat::Issue& ex) {
67 return StatusCode::FAILURE;
72 uint32_t nstat = robFrag.nstatus();
75 const uint32_t* it{
nullptr};
87 return StatusCode::FAILURE;
93 const unsigned int size = robFrag.rod_ndata();
116 SourceIdentifier sid(robFrag.rod_source_id());
119 cabling_data.subdetectorId = sid.subdetector_id();
120 cabling_data.mrod = sid.module_id();
124 robFrag.rod_data(vint);
126 ATH_MSG_DEBUG(
"**********Decoder dumping the words******** ");
130 for (
unsigned int i = 0; i < size; i++)
ATH_MSG_DEBUG(
"word " << i <<
" = " << MSG::hex << vint[i] << MSG::dec);
133 return StatusCode::FAILURE;
138 if (csmReadOut.
is_BOB()) {
144 ATH_MSG_WARNING(
" Subdetector, ROD ID: 0x" << MSG::hex << cabling_data.subdetectorId << MSG::dec <<
", 0x" << cabling_data.mrod
150 return StatusCode::FAILURE;
154 if (csmReadOut.
is_EOB()) {
155 ATH_MSG_WARNING(
"No CSM data ROD ID: 0x" << MSG::hex << cabling_data.subdetectorId <<
156 ", 0x" <<
static_cast<unsigned int>(cabling_data.mrod) << MSG::dec);
157 return StatusCode::SUCCESS;
164 return StatusCode::FAILURE;
166 auto&
msg = msgStream();
167 while (!csmReadOut.
is_EOB()) {
168 while ((!csmReadOut.
is_BOL()) && (!csmReadOut.
is_EOB())) {
170 if (wordPos >= size) {
172 return StatusCode::FAILURE;
177 if (csmReadOut.
is_BOL()) {
179 }
else if (csmReadOut.
is_EOB()) {
181 return StatusCode::FAILURE;
187 cabling_data.csm = csmReadOut.
csmId();
192 ATH_MSG_DEBUG(
"subdetId : " << cabling_data.subdetectorId <<
" "
193 <<
"mrodId : " << cabling_data.mrod <<
" "
194 <<
"csmId : " << cabling_data.csm);
196 cabling_data.tdcId = 0xff;
197 cabling_data.channelId = 0xff;
203 ATH_MSG_DEBUG(
"getOfflineIdfromOnlineID result: " << cabling_data);
207 ATH_MSG_WARNING(
"Skip decoding of CSM link, subdetId : " << MSG::hex << std::showbase << cabling_data.subdetectorId <<
" "
208 <<
"mrodId : " << cabling_data.mrod <<
" " << MSG::dec
209 <<
"csmId : " << cabling_data.csm);
239 std::unique_ptr<MdtCsm> collection{
nullptr};
246 collection = std::make_unique<MdtCsm>(moduleId, idHash);
252 collection->set_values(collection->identify(), collection->identifyHash(), cabling_data.subdetectorId, cabling_data.mrod,
256 if (wordPos >= size) {
258 return StatusCode::FAILURE;
265 if (wordPos >= size) {
267 return StatusCode::FAILURE;
271 while (!csmReadOut.
is_TWC()) {
272 uint16_t tdcNum = isHpTdc ? hptdcReadOut.
tdcId() : amtReadOut.
tdcId();
274 ATH_MSG_DEBUG(
" Decoding data from TDC number : " << tdcNum);
278 if (wordPos >= size) {
280 return StatusCode::FAILURE;
285 std::unique_ptr<MdtAmtHit> amtHit{
nullptr};
288 while (!((isHpTdc ? hptdcReadOut.
is_EOT() : amtReadOut.
is_EOT()) ||
289 (isHpTdc ? hptdcReadOut.
is_BOT() : amtReadOut.
is_BOT()) ||
290 (isHpTdc ? csmReadOut.
is_TWC() : amtReadOut.
is_TWC()))) {
299 if ((isHpTdc ? hptdcReadOut.
is_TSM() : amtReadOut.
is_TSM()) &&
301 chanNum = isHpTdc ? hptdcReadOut.
channel() : amtReadOut.
channel();
303 amtHit = std::make_unique<MdtAmtHit>(tdcNum, chanNum);
304 amtHit->setValues((isHpTdc ? hptdcReadOut.
coarse() : amtReadOut.
coarse()),
305 (isHpTdc ? hptdcReadOut.
fine() : amtReadOut.
fine()), 0);
306 amtHit->addData(vint[wordPos]);
307 leadingHitMap.insert(std::make_pair(chanNum, std::move(amtHit)));
308 }
else if ((isHpTdc ? hptdcReadOut.
is_TSM() : amtReadOut.
is_TSM()) &&
310 chanNum = isHpTdc ? hptdcReadOut.
channel() : amtReadOut.
channel();
311 leading_amt_map::iterator chanPosition = leadingHitMap.find(chanNum);
313 if (chanPosition != leadingHitMap.end()) {
315 amtHit = std::move(chanPosition->second);
316 uint16_t coarse = amtHit->coarse();
317 uint16_t fine = amtHit->fine();
318 int tdcCountsFirst = coarse * 32 + fine;
322 isHpTdc ? hptdcReadOut.
coarse() * 32 + hptdcReadOut.
fine() : amtReadOut.
coarse() * 32 + amtReadOut.
fine();
323 int width = tdcCounts - tdcCountsFirst;
325 amtHit->setValues(coarse, fine,
width);
326 amtHit->addData(vint[wordPos]);
327 collection->push_back(std::move(amtHit));
330 leadingHitMap.erase(chanPosition);
332 ATH_MSG_DEBUG(
"failure: corresponding leading edge not found for the trailing edge tdc: " << tdcNum <<
" chan: "
336 }
else if ((isHpTdc ? hptdcReadOut.
is_TCM() : amtReadOut.
is_TCM()) && collection) {
337 uint16_t chanNum = isHpTdc ? hptdcReadOut.
channel() : amtReadOut.
channel();
339 amtHit = std::make_unique<MdtAmtHit>(tdcNum, chanNum);
340 amtHit->setValues((isHpTdc ? hptdcReadOut.
coarse() : amtReadOut.
coarse()),
341 (isHpTdc ? hptdcReadOut.
fine() : amtReadOut.
fine()),
342 (isHpTdc ? hptdcReadOut.
width() : amtReadOut.
width()));
343 amtHit->addData(vint[wordPos]);
344 collection->push_back(std::move(amtHit));
349 if (wordPos >= size) {
351 return StatusCode::FAILURE;
356 if (isHpTdc) csmReadOut.
decodeWord(vint[wordPos]);
361 for (
auto& itHit : leadingHitMap) { collection->push_back(std::move(itHit.second)); }
363 leadingHitMap.clear();
367 if ((isHpTdc ? hptdcReadOut.
is_EOT() : amtReadOut.
is_EOT())) {
369 if (wordPos >= size) {
371 return StatusCode::FAILURE;
382 if (wordPos >= size) {
384 return StatusCode::FAILURE;
388 return StatusCode::SUCCESS;