ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MDT_RawDataProviderTool Class Reference

#include <MDT_RawDataProviderTool.h>

Inheritance diagram for Muon::MDT_RawDataProviderTool:
Collaboration diagram for Muon::MDT_RawDataProviderTool:

Public Member Functions

virtual ~MDT_RawDataProviderTool ()=default
 default destructor
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode convert (const EventContext &ctx) const override
 IMuonRawDataProviderTool interface - EventContext-based methods.
virtual StatusCode convert (const std::vector< IdentifierHash > &HashVec, const EventContext &ctx) const override
virtual StatusCode convert (const std::vector< uint32_t > &robIds, const EventContext &ctx) const override
virtual StatusCode convertIntoContainer (const ROBFragmentList &vecRobs, const EventContext &ctx) const
 Convert method.

Private Attributes

ToolHandle< MdtROD_Decoderm_decoder {this, "Decoder", "MdtROD_Decoder/MdtROD_Decoder"}
SG::WriteHandleKey< MdtCsmContainerm_rdoContainerKey
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
unsigned int m_maxhashtoUse = 0U
ServiceHandle< IROBDataProviderSvcm_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
SG::ReadCondHandleKey< MuonMDT_CablingMapm_readKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
SG::UpdateHandleKey< MdtCsm_Cachem_rdoContainerCacheKey
 This is the key for the cache for the CSM containers, can be empty.

Detailed Description

Author
Mark Owen marko.nosp@m.wen@.nosp@m.cern..nosp@m.ch

Definition at line 30 of file MDT_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ ~MDT_RawDataProviderTool()

virtual Muon::MDT_RawDataProviderTool::~MDT_RawDataProviderTool ( )
virtualdefault

default destructor

Member Function Documentation

◆ convert() [1/3]

StatusCode Muon::MDT_RawDataProviderTool::convert ( const EventContext & ctx) const
overridevirtual

IMuonRawDataProviderTool interface - EventContext-based methods.

Definition at line 87 of file MDT_RawDataProviderTool.cxx.

89{
90
91 const MuonMDT_CablingMap* readCdo{};
92 ATH_CHECK(SG::get(readCdo, m_readKey, ctx));
93 return convert(readCdo->getAllROBId(), ctx);
94}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ListOfROB & getAllROBId() const
return the ROD id of a given chamber
virtual StatusCode convert(const EventContext &ctx) const override
IMuonRawDataProviderTool interface - EventContext-based methods.
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ convert() [2/3]

StatusCode Muon::MDT_RawDataProviderTool::convert ( const std::vector< IdentifierHash > & HashVec,
const EventContext & ctx ) const
overridevirtual

Definition at line 96 of file MDT_RawDataProviderTool.cxx.

96 {
97 const MuonMDT_CablingMap* readCdo{};
98 ATH_CHECK(SG::get(readCdo, m_readKey, ctx));
99 return convert(readCdo->getROBId(HashVec, msgStream()), ctx);
100}
uint32_t getROBId(const IdentifierHash &stationCode, MsgStream &log) const
return the ROD id of a given chamber, given the hash id

◆ convert() [3/3]

StatusCode Muon::MDT_RawDataProviderTool::convert ( const std::vector< uint32_t > & robIds,
const EventContext & ctx ) const
overridevirtual

Definition at line 102 of file MDT_RawDataProviderTool.cxx.

103 {
104 ROBFragmentList vecOfRobf;
105 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
106 return convertIntoContainer(vecOfRobf, ctx); // using the old one
107}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
virtual StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
Convert method.

◆ convertIntoContainer()

StatusCode Muon::MDT_RawDataProviderTool::convertIntoContainer ( const ROBFragmentList & vecRobs,
const EventContext & ctx ) const
virtual

Convert method.

Definition at line 36 of file MDT_RawDataProviderTool.cxx.

37 {
38
39 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
40
41 SG::WriteHandle rdoContainerHandle(m_rdoContainerKey, ctx);
42
43 MdtCsmContainer* rdoContainer = nullptr;
44
45 // here we have two paths. The first one we do not use an external cache, so just create
46 // the MDT CSM container and record it. For the second path, we create the container
47 // by passing in the container cache key so that the container is linked with the event
48 // wide cache.
49 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
50 if (!externalCacheRDO) {
51 // without the cache we just record the container
52 ATH_CHECK(rdoContainerHandle.record(std::make_unique<MdtCsmContainer>(m_maxhashtoUse)));
53 ATH_MSG_DEBUG("Created container");
54 rdoContainer = rdoContainerHandle.ptr();
55 } else {
56 // use the cache to get the container
57 SG::UpdateHandle update(m_rdoContainerCacheKey, ctx);
58 ATH_CHECK(update.isValid());
59 ATH_CHECK(rdoContainerHandle.record(std::make_unique<MdtCsmContainer>(update.ptr())));
60 ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key());
61 rdoContainer = rdoContainerHandle.ptr();
62 }
63
64 // this should never happen, but since we dereference the pointer we should check it first
65 if (!rdoContainer) {
66 ATH_MSG_ERROR("MdtCsmContainer is null, cannot convert MDT raw data");
67 return StatusCode::FAILURE;
68 }
69
70
71 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
72
73 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* frag : vecRobs) {
74 // convert only if data payload is delivered
75 if (frag->rod_ndata() != 0) {
76 m_decoder->fillCollections(*frag, *rdoContainer).ignore();
77 } else {
78 ATH_MSG_DEBUG(" ROB " << MSG::hex << frag->source_id() << " is delivered with an empty payload" );
79 // store the error condition into the StatusCode and continue
80 }
81 }
82 // in presence of errors return FAILURE
83 ATH_MSG_DEBUG("After processing numColls=" << rdoContainer->numberOfCollections());
84 return StatusCode::SUCCESS;
85}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
virtual size_t numberOfCollections() const override final
return number of collections
ToolHandle< MdtROD_Decoder > m_decoder
SG::WriteHandleKey< MdtCsmContainer > m_rdoContainerKey
SG::UpdateHandleKey< MdtCsm_Cache > m_rdoContainerCacheKey
This is the key for the cache for the CSM containers, can be empty.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

◆ initialize()

StatusCode Muon::MDT_RawDataProviderTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 12 of file MDT_RawDataProviderTool.cxx.

12 {
13 ATH_MSG_VERBOSE("Starting init");
14
15 ATH_MSG_VERBOSE("Getting m_robDataProvider");
16
17 // Get ROBDataProviderSvc
18 ATH_CHECK(m_robDataProvider.retrieve());
19 ATH_CHECK(m_idHelperSvc.retrieve());
20
21 ATH_MSG_VERBOSE("Getting m_decoder");
22
23 // Retrieve decoder
24 ATH_CHECK(m_decoder.retrieve());
25 m_maxhashtoUse = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME") != -1 ? m_idHelperSvc->mdtIdHelper().detectorElement_hash_max()
26 : m_idHelperSvc->mdtIdHelper().module_hash_max();
27
28 ATH_CHECK(m_rdoContainerKey.initialize());
29 ATH_CHECK(m_readKey.initialize());
31
32 ATH_MSG_DEBUG("initialize() successful in " << name());
33 return StatusCode::SUCCESS;
34}
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

Member Data Documentation

◆ m_decoder

ToolHandle<MdtROD_Decoder> Muon::MDT_RawDataProviderTool::m_decoder {this, "Decoder", "MdtROD_Decoder/MdtROD_Decoder"}
private

Definition at line 53 of file MDT_RawDataProviderTool.h.

53{this, "Decoder", "MdtROD_Decoder/MdtROD_Decoder"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MDT_RawDataProviderTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 57 of file MDT_RawDataProviderTool.h.

57{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_maxhashtoUse

unsigned int Muon::MDT_RawDataProviderTool::m_maxhashtoUse = 0U
private

Definition at line 59 of file MDT_RawDataProviderTool.h.

◆ m_rdoContainerCacheKey

SG::UpdateHandleKey<MdtCsm_Cache> Muon::MDT_RawDataProviderTool::m_rdoContainerCacheKey
private
Initial value:
{this, "CsmContainerCacheKey", "",
"Optional external cache for the CSM container"
}

This is the key for the cache for the CSM containers, can be empty.

Definition at line 66 of file MDT_RawDataProviderTool.h.

66 {this, "CsmContainerCacheKey", "",
67 "Optional external cache for the CSM container"
68 };

◆ m_rdoContainerKey

SG::WriteHandleKey<MdtCsmContainer> Muon::MDT_RawDataProviderTool::m_rdoContainerKey
private
Initial value:
{this, "RdoLocation", "MDTCSM",
"Name of the MDTCSM produced by RawDataProvider"}

Definition at line 54 of file MDT_RawDataProviderTool.h.

54 {this, "RdoLocation", "MDTCSM",
55 "Name of the MDTCSM produced by RawDataProvider"};

◆ m_readKey

SG::ReadCondHandleKey<MuonMDT_CablingMap> Muon::MDT_RawDataProviderTool::m_readKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
private

Definition at line 64 of file MDT_RawDataProviderTool.h.

64{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"};

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> Muon::MDT_RawDataProviderTool::m_robDataProvider {this, "ROBDataProviderSvc", "ROBDataProviderSvc"}
private

Definition at line 62 of file MDT_RawDataProviderTool.h.

62{this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

The documentation for this class was generated from the following files: