6 #include "GaudiKernel/DataObject.h"
7 #include "GaudiKernel/IRegistry.h"
8 #include "MuCalDecode/CalibData.h"
9 #include "MuCalDecode/CalibEvent.h"
10 #include "MuCalDecode/CalibUti.h"
27 #include "GaudiKernel/ServiceHandle.h"
48 return StatusCode::SUCCESS;
64 ATH_CHECK(handle.record(std::make_unique<Muon::MdtPrepDataContainer>(
m_muonIdHelper->mdtIdHelper().module_hash_max())));
70 if (!muDetMgr.isValid()) {
72 return StatusCode::FAILURE;
77 ATH_MSG_DEBUG(
"MDT core decode processed in MT decode (calibration stream event)");
79 return StatusCode::SUCCESS;
91 return StatusCode::SUCCESS;
95 std::list<MdtCalibData> tubes = (
event->mdt())->
data();
99 std::vector<std::unique_ptr<Muon::MdtPrepDataCollection>> mdtCollections{};
101 int mdt_hits(0), mdt_chambers(0);
102 int StationName{0}, StationEta{0}, StationPhi{0}, MultiLayer{0},
TubeLayer{0}, Tube{0};
106 for (
const MdtCalibData& tubeData : tubes) {
107 uint16_t coarse = tubeData.leadingCoarse();
108 uint16_t fine = tubeData.leadingFine();
109 int tdc_counts = fine | (coarse << 5);
110 int adc_counts = tubeData.width();
111 WordIntoMdtId(tubeData.id(), StationName, StationEta, StationPhi, MultiLayer,
TubeLayer, Tube);
120 constexpr
double radius(7.5), errRadius(4.2);
123 errorMatrix(0, 0) = (errRadius * errRadius);
127 const unsigned int mdtHashIdx =
static_cast<unsigned int>(mdtHashId);
128 if (mdtHashIdx >= mdtCollections.size()) mdtCollections.resize(mdtHashIdx + 1);
129 std::unique_ptr<Muon::MdtPrepDataCollection>& mdtCollection = mdtCollections[mdtHashIdx];
130 if (!mdtCollection) {
131 mdtCollection = std::make_unique<Muon::MdtPrepDataCollection>(mdtHashId);
135 std::unique_ptr<Muon::MdtPrepData> newPrepData = std::make_unique<Muon::MdtPrepData>(
channelId,
driftRadius, std::move(errorMatrix), detEl, tdc_counts, adc_counts, digitStatus);
142 mdtCollection->
push_back(std::move(newPrepData));
146 for (std::unique_ptr<Muon::MdtPrepDataCollection>& coll : mdtCollections) {
151 ATH_MSG_DEBUG(
"Wrote " << mdt_hits <<
" MDT PRD hits for " << mdt_chambers <<
" chambers");
153 return StatusCode::SUCCESS;