22 return StatusCode::SUCCESS;
26 ATH_MSG_DEBUG(
"MdtRdoToMdtPrepDataTool for " << idVect.size() <<
" offline collections called");
30 return StatusCode::FAILURE;
33 if (!idVect.empty()) {
37 std::vector<IdentifierHash> rdoHashes{};
41 if (rdoContainer->
empty()) {
42 return StatusCode::SUCCESS;
44 rdoHashes.reserve(rdoContainer->
size());
45 for (
const MdtCsm* csm : *rdoContainer) {
46 rdoHashes.push_back(csm->identifyHash());
50 return StatusCode::SUCCESS;
56 return decode(ctx, cablingMap->getMultiLayerHashVec(robIds, msgStream()));
66 cache.digitsForCnv.resize(
m_idHelperSvc->mdtIdHelper().detectorElement_hash_max());
67 cache.isValid = cache.prdContainer.record(
m_xAODKey, ctx).isSuccess() &&
68 cache.prdTwinContainer.record(
m_xAODTwinKey, ctx).isSuccess() &&
82 if (digit->isMasked() || !isValidChannel) {
88 digit->setAdc(digit->adc() / 4);
89 digit->setTdc(digit->tdc() / 4);
102 if(calibResult.
status() == MdtDriftCircleStatus::MdtStatusUnDefined) {
104 <<
", adc: "<<calibIn.
adc()<<
" vs. "<<
m_adcCut<<
", calibration bailed out "
105 <<(calibResult.
status() == MdtDriftCircleStatus::MdtStatusUnDefined?
"si":
"no"));
109 <<std::endl<<calibIn<<std::endl<<calibResult);
110 double cov{0.}, driftRadius{0.};
111 if (calibResult.
status() == MdtDriftCircleStatus::MdtStatusDriftTime){
139 <<
", tdc: "<<digit[0]->tdc()<<
", adc: "<<digit[0]->adc()<<
" -- "
141 <<
", tdc: "<<digit[1]->tdc()<<
", adc: "<<digit[1]->adc());
146 std::move(mdtCalib1st),
147 std::move(mdtCalib2nd));
152 <<(twinCalib.
primaryStatus() == MdtDriftCircleStatus::MdtStatusUnDefined?
"si":
"no"));
159 cov(1, 1) = Acts::square(twinCalib.
sigmaZ() );
195 uint16_t subdetId = rdoColl->
SubDetId();
196 uint16_t mrodId = rdoColl->
MrodId();
197 uint16_t csmId = rdoColl->
CsmId();
199 << mrodId <<
" / " << csmId);
203 for (
const MdtAmtHit* amtHit : *rdoColl) {
207 ATH_MSG_WARNING(
"Found issue MDT RDO decoder for subdetId/mrodId/csmId "
208 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
213 cache.digitsForCnv[detHash].push_back(std::move(newDigit));
215 return StatusCode::SUCCESS;
222 uint16_t subdetId = rdoColl->
SubDetId();
223 uint16_t mrodId = rdoColl->
MrodId();
224 uint16_t csmId = rdoColl->
CsmId();
226 <<
" subdetId/ mrodId/ csmId = " << rdoColl->
SubDetId()
227 <<
" / " << rdoColl->
MrodId() <<
" / " << rdoColl->
CsmId());
231 std::unordered_map<Identifier, TwinDigit_t> mdtDigitColl{};
233 for (
const MdtAmtHit* amtHit : *rdoColl) {
238 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
244 std::array<DigitPtr_t, 2> & moveTo = mdtDigitColl[newDigit->
identify()];
246 moveTo[0] = std::move(newDigit);
247 }
else if (!moveTo[1]) {
248 moveTo[1] = std::move(newDigit);
250 ATH_MSG_VERBOSE(
" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
252 <<
" tdc = " << newDigit->
tdc());
256 for (
auto &[
id, digits] : mdtDigitColl) {
258 const Identifier twinId = cache.twinTubeMap->twinId(
id);
263 std::array<DigitPtr_t, 2>& twinDigits = mdtDigitColl[twinId];
264 for (std::size_t k = 0 ; k < 2; ++k) {
265 if (digits[k] && twinDigits[k]) {
266 if (digits[k]->identify() > twinDigits[k]->identify()) {
269 cache.twinDigitsForCnv[detHash].push_back(std::array{std::move(digits[k]), std::move(twinDigits[k])});
271 DigitVec_t& outDigits = cache.digitsForCnv[detHash];
272 if (digits[k]) { outDigits.push_back(std::move(digits[k])); }
273 if (twinDigits[k]) { outDigits.push_back(std::move(twinDigits[k])); }
278 return StatusCode::SUCCESS;
281 const std::vector<IdentifierHash>& multiLayerHashInRobs,
286 if (rdoContainer->
empty()) {
288 return StatusCode::SUCCESS;
293 ATH_MSG_DEBUG(
"The rdo container does not have the hash " << hash);
298 for (
DigitVec_t& digitPerStation : cache.digitsForCnv) {
299 std::ranges::for_each(digitPerStation,
304 for (
auto& [hash, digitPerStation] : cache.twinDigitsForCnv) {
305 std::ranges::for_each(digitPerStation,
310 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
MdtCalibOutput::MdtDriftCircleStatus MdtDriftCircleStatus
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const
return true if container is empty
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,...
size_t size() const
Duplicate of fullSize for backwards compatability.
This is a "hash" representation of an Identifier.
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
double driftRadius() const
Returns the drift radius of the calibrated object.
Muon::MdtDriftCircleStatus MdtDriftCircleStatus
MdtDriftCircleStatus status() const
Status of the calibration.
MdtDriftCircleStatus primaryStatus() const
double primaryDriftR() const
Identifier twinID() const
Identifier primaryID() const
double uncertPrimaryR() const
This container provides acces to the MDT RDOs.
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD).
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Identifier identify() const
Returns the CSM offline identifier (chamber offline id).
uint16_t SubDetId() const
Returns the sub-detector Id.
bool isMasked() const
Return whether the digit is masked or not.
Identifier parentID(const Identifier &id) const
get parent id from channel id
int tube(const Identifier &id) const
int tubeLayer(const Identifier &id) const
Identifier identify() const
Readout element to describe the Monitored Drift Tube (Mdt) chambers Mdt chambers usually comrpise out...
bool isValid(const IdentifierHash &measHash) const
Checks whether the passed meaurement hash corresponds to a valid tube described by the readout elemen...
double innerTubeRadius() const
Returns the inner tube radius.
static IdentifierHash measurementHash(unsigned layerNumber, unsigned tubeNumber)
Constructs a Measurement hash from layer && tube number.
IdentifierHash identHash() const
Returns the hash of the readout element which is identical to the detector element hash provided by t...
void setTube(std::uint16_t tube_n)
Sets the tube number.
void setLayer(std::uint8_t layer_n)
Sets the layer number.
void setReadoutElement(const MuonGMR4::MdtReadoutElement *readoutEle)
set the pointer to the MdtReadoutElement
void setTdc(std::int16_t tdc)
Setter methods.
void setStatus(MdtDriftCircleStatus st)
Sets the status of the drift circle.
void setAdc(std::int16_t adc)
Sets the ADC counts.
void setTwinLayer(std::uint8_t layer_n)
Sets the layer number.
void setTwinAdc(std::int16_t adc)
Sets the ADC counts.
void setTwinTdc(std::int16_t tdc)
Sets the TDC counts.
void setTwinTube(std::uint16_t tube_n)
Sets the tube number.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
This header ties the generic definitions in this package.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
MdtDriftCircle_v1 MdtDriftCircle
MdtTwinDriftCircle_v1 MdtTwinDriftCircle
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...