ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonByteStreamCnvTest
src
MdtRdoToMdtDigit.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MdtRdoToMdtDigit.h
"
6
7
StatusCode
MdtRdoToMdtDigit::initialize
() {
8
ATH_CHECK
(
m_idHelperSvc
.retrieve());
9
ATH_CHECK
(
m_mdtRdoDecoderTool
.retrieve());
10
ATH_CHECK
(
m_mdtRdoKey
.initialize());
11
ATH_CHECK
(
m_mdtDigitKey
.initialize());
12
return
StatusCode::SUCCESS;
13
}
14
15
StatusCode
MdtRdoToMdtDigit::execute
(
const
EventContext& ctx)
const
{
16
ATH_MSG_DEBUG
(
"in execute()"
);
17
SG::ReadHandle
rdoContainer{
m_mdtRdoKey
, ctx};
18
ATH_CHECK
(rdoContainer.
isPresent
());
19
ATH_MSG_DEBUG
(
"Retrieved "
<< rdoContainer->size() <<
" MDT RDOs."
);
20
21
SG::WriteHandle<MdtDigitContainer>
wh_mdtDigit(
m_mdtDigitKey
, ctx);
22
const
unsigned
int
hashMax =
m_idHelperSvc
->mdtIdHelper().module_hash_max();
23
ATH_CHECK
(wh_mdtDigit.
record
(std::make_unique<MdtDigitContainer>(hashMax)));
24
ATH_MSG_DEBUG
(
"Decoding MDT RDO into MDT Digit"
);
25
26
// now decode RDO into digits
27
DigitCollection
digitMap{};
28
digitMap.resize(hashMax);
29
for
(
const
MdtCsm
* csmColl : *rdoContainer) {
30
ATH_CHECK
(
decodeMdt
(ctx, *csmColl, digitMap));
31
}
32
33
for
(std::unique_ptr<MdtDigitCollection>&collection: digitMap) {
34
if
(!collection)
continue
;
35
const
IdentifierHash
hash = collection->identifierHash();
36
ATH_CHECK
(wh_mdtDigit->addCollection(collection.release(), hash));
37
}
38
return
StatusCode::SUCCESS;
39
}
40
41
StatusCode
MdtRdoToMdtDigit::decodeMdt
(
const
EventContext& ctx,
const
MdtCsm
& rdoColl,
DigitCollection
& digitMap)
const
{
42
if
(rdoColl.
empty
()) {
43
return
StatusCode::SUCCESS;
44
}
45
ATH_MSG_DEBUG
(
" Number of AmtHit in this Csm "
<< rdoColl.
size
());
46
47
uint16_t subdetId = rdoColl.
SubDetId
();
48
uint16_t mrodId = rdoColl.
MrodId
();
49
uint16_t csmId = rdoColl.
CsmId
();
50
51
52
// for each Csm, loop over AmtHit, converter AmtHit to digit
53
// retrieve/create digit collection, and insert digit into collection
54
for
(
const
MdtAmtHit
* amtHit : rdoColl) {
55
std::unique_ptr<MdtDigit> newDigit{
m_mdtRdoDecoderTool
->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
56
57
if
(!newDigit) {
58
ATH_MSG_WARNING
(
"Digit rejected"
);
59
continue
;
60
}
61
62
// find here the Proper Digit Collection identifier, using the rdo-hit id
63
// (since RDO collections are not in a 1-to-1 relation with digit collections)
64
const
IdentifierHash
coll_hash =
m_idHelperSvc
->moduleHash(newDigit->identify());
65
std::unique_ptr<MdtDigitCollection>& outCollection = digitMap[coll_hash];
66
if
(!outCollection) {
67
outCollection = std::make_unique<MdtDigitCollection>(
m_idHelperSvc
->chamberId(newDigit->identify()), coll_hash);
68
}
69
outCollection->push_back(std::move(newDigit));
70
}
71
return
StatusCode::SUCCESS;
72
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
MdtRdoToMdtDigit.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
MdtAmtHit
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
Definition
MdtAmtHit.h:20
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition
MdtCsm.h:22
MdtCsm::CsmId
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD).
Definition
MdtCsm.h:65
MdtCsm::MrodId
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Definition
MdtCsm.h:63
MdtCsm::SubDetId
uint16_t SubDetId() const
Returns the sub-detector Id.
Definition
MdtCsm.h:61
MdtRdoToMdtDigit::m_mdtRdoDecoderTool
ToolHandle< Muon::IMDT_RDO_Decoder > m_mdtRdoDecoderTool
Definition
MdtRdoToMdtDigit.h:27
MdtRdoToMdtDigit::initialize
virtual StatusCode initialize() override final
Definition
MdtRdoToMdtDigit.cxx:7
MdtRdoToMdtDigit::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
MdtRdoToMdtDigit.cxx:15
MdtRdoToMdtDigit::m_mdtDigitKey
SG::WriteHandleKey< MdtDigitContainer > m_mdtDigitKey
Definition
MdtRdoToMdtDigit.h:30
MdtRdoToMdtDigit::m_mdtRdoKey
SG::ReadHandleKey< MdtCsmContainer > m_mdtRdoKey
Definition
MdtRdoToMdtDigit.h:29
MdtRdoToMdtDigit::DigitCollection
std::vector< std::unique_ptr< MdtDigitCollection > > DigitCollection
Definition
MdtRdoToMdtDigit.h:24
MdtRdoToMdtDigit::decodeMdt
StatusCode decodeMdt(const EventContext &ctx, const MdtCsm &rdoCollection, DigitCollection &digitContainer) const
Definition
MdtRdoToMdtDigit.cxx:41
MdtRdoToMdtDigit::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
MdtRdoToMdtDigit.h:28
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition
StoreGate/src/VarHandleBase.cxx:400
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Generated on
for ATLAS Offline Software by
1.17.0