331 {
334 ATH_MSG_DEBUG(
" Number of AmtHit in this Csm " << rdoColl->size());
336 Identifier elementId = id_helper.
parentID(rdoColl->identify());
337
338 uint16_t subdetId = rdoColl->SubDetId();
339 uint16_t mrodId = rdoColl->MrodId();
342 << " / " << rdoColl->MrodId() << " / " << rdoColl->CsmId());
343
344
345
346 std::map<Identifier, std::array<std::unique_ptr<MdtDigit>, 2>> mdtDigitColl{};
347
348 for (const MdtAmtHit* amtHit : *rdoColl) {
349 std::unique_ptr<MdtDigit> newDigit{
m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
350
351 if (!newDigit) {
353 << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
354 << amtHit->tdcId());
355 continue;
356 }
357 std::array<std::unique_ptr<MdtDigit>, 2> & moveTo = mdtDigitColl[newDigit->identify()];
358 if (!moveTo[0]) {
359 moveTo[0] = std::move(newDigit);
361 moveTo[1] = std::move(newDigit);
362 } else {
363 ATH_MSG_VERBOSE(
" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
364 <<
m_idHelperSvc->toString(newDigit->identify()) <<
" with adc = " << newDigit->adc()
365 << " tdc = " << newDigit->tdc());
366 }
367 }
368
369 auto convertTwins = [
this, &
cache, &ctx](std::unique_ptr<MdtDigit>
digit,
370 std::unique_ptr<MdtDigit> digit2) {
371 if (!digit ||
digit->isMasked()) {
return; }
372
374
375 if (!digit2 || digit2->isMasked()) {
378 << ", hash: "<< driftCircleColl->identifyHash());
379
380 const MdtCalibInput mdtCalibIn{*
digit, *
cache.legacyDetMgr};
381 const MdtCalibOutput mdtCalibOut{
m_calibrationTool->calibrate(ctx, mdtCalibIn,
false)};
382
384 std::unique_ptr<MdtPrepData> newPrepData =
createPrepData(mdtCalibIn, mdtCalibOut);
385 if (!newPrepData) return;
386
387 newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
388 driftCircleColl->push_back(std::move(newPrepData));
389 return;
390 }
392 <<
", tdc: "<<
digit->tdc()<<
", adc: "<<
digit->adc()<<
" -- "
394 <<", tdc: "<<digit2->tdc()<<", adc: "<<digit2->adc());
395
396 MdtCalibInput mdtCalib1st{*
digit, *
cache.legacyDetMgr};
397 MdtCalibInput mdtCalib2nd{*digit2, *
cache.legacyDetMgr};
398
399 updateClosestApproachTwin(mdtCalib1st);
400 updateClosestApproachTwin(mdtCalib2nd);
401
403 std::move(mdtCalib1st),
404 std::move(mdtCalib2nd));
405
410 cov(0, 1) =
cov(1, 0) = 0;
411
412 const MuonGM::MdtReadoutElement* descriptor =
cache.legacyDetMgr->getMdtReadoutElement(
digit->identify());
413 auto twin_newPrepData = std::make_unique<MdtTwinPrepData>(twinCalib.
primaryID(),
414 std::move(hitPos),
415 std::move(cov),
416 descriptor,
422
425
427 <<
"local pos center tube w/ TWIN INFO "<<
Amg::toString(twinCalib.
locZ() * Amg::Vector3D::UnitZ(), 2)<<std::endl
429
430 twin_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
431 driftCircleColl->push_back(std::move(twin_newPrepData));
432 };
433
434
435 for (auto &[id, digits] : mdtDigitColl) {
436
437 const Identifier twinId =
cache.twinTubeMap->twinId(
id);
439 if (id != twinId) {
440 std::array<std::unique_ptr<MdtDigit>, 2>& twinDigits = mdtDigitColl[twinId];
442 convertTwins(std::move(digits[0]), std::move(twinDigits[0]));
444 convertTwins(std::move(digits[1]), std::move(twinDigits[1]));
445 } else {
446 convertTwins(std::move(digits[0]), nullptr);
447 convertTwins(std::move(digits[1]), nullptr);
448 }
449 }
450 return StatusCode::SUCCESS;
451 }
MdtDriftCircleStatus primaryStatus() const
double primaryDriftR() const
Identifier twinID() const
Identifier primaryID() const
double uncertPrimaryR() const
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.