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

#include <MDT_RawDataProviderToolMT.h>

Inheritance diagram for Muon::MDT_RawDataProviderToolMT:
Collaboration diagram for Muon::MDT_RawDataProviderToolMT:

Public Member Functions

 MDT_RawDataProviderToolMT (const std::string &, const std::string &, const IInterface *)
virtual ~MDT_RawDataProviderToolMT ()=default
 default destructor
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs) const override
 Convert method - declared in Muon::IMuonRdoToPrepDataTool.
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const std::vector< IdentifierHash > &) const override
virtual StatusCode convert () const override
 the new ones
virtual StatusCode convert (const std::vector< IdentifierHash > &HashVec) const override
virtual StatusCode convert (const std::vector< uint32_t > &robIds) const override
 for a particular vector of ROBId's
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const EventContext &ctx) const override
 EventContext.
virtual StatusCode convert (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const std::vector< IdentifierHash > &, const EventContext &ctx) const override
virtual StatusCode convert (const EventContext &ctx) const override
 for the entire event
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
 for a particular vector of ROBId's
virtual StatusCode convertIntoContainer (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, MdtCsmContainer &mdtContainer) 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 32 of file MDT_RawDataProviderToolMT.h.

Constructor & Destructor Documentation

◆ MDT_RawDataProviderToolMT()

Muon::MDT_RawDataProviderToolMT::MDT_RawDataProviderToolMT ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 11 of file MDT_RawDataProviderToolMT.cxx.

11 :
12 base_class(t, n, p) {
13 declareInterface<Muon::IMuonRawDataProviderTool>(this);
14
15}

◆ ~MDT_RawDataProviderToolMT()

virtual Muon::MDT_RawDataProviderToolMT::~MDT_RawDataProviderToolMT ( )
virtualdefault

default destructor

Member Function Documentation

◆ convert() [1/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( ) const
overridevirtual

the new ones

for the entire event

Definition at line 60 of file MDT_RawDataProviderToolMT.cxx.

61{
62 return convert(Gaudi::Hive::currentContext());
63}
virtual StatusCode convert() const override
the new ones

◆ convert() [2/10]

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

for the entire event

Definition at line 65 of file MDT_RawDataProviderToolMT.cxx.

67{
68 SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey, ctx};
69 const MuonMDT_CablingMap* readCdo{*readHandle};
70 if (!readCdo) {
71 ATH_MSG_ERROR("Null pointer to the read conditions object");
72 return StatusCode::FAILURE;
73 }
74 return convert(readCdo->getAllROBId(), ctx);
75}
#define ATH_MSG_ERROR(x)
const ListOfROB & getAllROBId() const
return the ROD id of a given chamber
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey

◆ convert() [3/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs) const
overridevirtual

Convert method - declared in Muon::IMuonRdoToPrepDataTool.

Definition at line 111 of file MDT_RawDataProviderToolMT.cxx.

111 {
112 return convert(vecRobs, Gaudi::Hive::currentContext());
113}

◆ convert() [4/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs,
const EventContext & ctx ) const
overridevirtual

EventContext.

Definition at line 115 of file MDT_RawDataProviderToolMT.cxx.

116 {
117 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
118
119 SG::WriteHandle<MdtCsmContainer> rdoContainerHandle(m_rdoContainerKey, ctx);
120
121 MdtCsmContainer* rdoContainer = nullptr;
122
123 // here we have two paths. The first one we do not use an external cache, so just create
124 // the MDT CSM container and record it. For the second path, we create the container
125 // by passing in the container cache key so that the container is linked with the event
126 // wide cache.
127 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
128 if (!externalCacheRDO) {
129 // without the cache we just record the container
130 ATH_CHECK(rdoContainerHandle.record(std::make_unique<MdtCsmContainer>(m_maxhashtoUse)));
131 ATH_MSG_DEBUG("Created container");
132 rdoContainer = rdoContainerHandle.ptr();
133 } else {
134 // use the cache to get the container
135 SG::UpdateHandle<MdtCsm_Cache> update(m_rdoContainerCacheKey, ctx);
136 ATH_CHECK(update.isValid());
137 ATH_CHECK(rdoContainerHandle.record(std::make_unique<MdtCsmContainer>(update.ptr())));
138 ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key());
139 rdoContainer = rdoContainerHandle.ptr();
140 }
141
142 // this should never happen, but since we dereference the pointer we should check it first
143 if (!rdoContainer) {
144 ATH_MSG_ERROR("MdtCsmContainer is null, cannot convert MDT raw data");
145 return StatusCode::FAILURE;
146 }
147
148 // use the convert function in the MDT_RawDataProviderToolCore class
149 ATH_CHECK(convertIntoContainer(vecRobs, *rdoContainer));
150
151 return StatusCode::SUCCESS;
152}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
SG::UpdateHandleKey< MdtCsm_Cache > m_rdoContainerCacheKey
This is the key for the cache for the CSM containers, can be empty.
virtual StatusCode convertIntoContainer(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, MdtCsmContainer &mdtContainer) const
Convert method.
SG::WriteHandleKey< MdtCsmContainer > m_rdoContainerKey

◆ convert() [5/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs,
const std::vector< IdentifierHash > &  ) const
overridevirtual

Definition at line 101 of file MDT_RawDataProviderToolMT.cxx.

102 {
103 return convert(vecRobs, Gaudi::Hive::currentContext());
104}

◆ convert() [6/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs,
const std::vector< IdentifierHash > & ,
const EventContext & ctx ) const
overridevirtual

Definition at line 106 of file MDT_RawDataProviderToolMT.cxx.

107 {
108 return convert(vecRobs, ctx);
109}

◆ convert() [7/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< IdentifierHash > & HashVec) const
overridevirtual

Definition at line 77 of file MDT_RawDataProviderToolMT.cxx.

77 {
78 return convert(HashVec, Gaudi::Hive::currentContext());
79}

◆ convert() [8/10]

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

Definition at line 81 of file MDT_RawDataProviderToolMT.cxx.

81 {
82 SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey, ctx};
83 const MuonMDT_CablingMap* readCdo{*readHandle};
84 if (!readCdo) {
85 ATH_MSG_ERROR("Null pointer to the read conditions object");
86 return StatusCode::FAILURE;
87 }
88 return convert(readCdo->getROBId(HashVec, msgStream()), ctx);
89}
uint32_t getROBId(const IdentifierHash &stationCode, MsgStream &log) const
return the ROD id of a given chamber, given the hash id

◆ convert() [9/10]

StatusCode Muon::MDT_RawDataProviderToolMT::convert ( const std::vector< uint32_t > & robIds) const
overridevirtual

for a particular vector of ROBId's

Definition at line 91 of file MDT_RawDataProviderToolMT.cxx.

91 {
92 return convert(robIds, Gaudi::Hive::currentContext());
93}

◆ convert() [10/10]

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

for a particular vector of ROBId's

Definition at line 95 of file MDT_RawDataProviderToolMT.cxx.

95 {
96 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
97 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
98 return convert(vecOfRobf, ctx); // using the old one
99}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider

◆ convertIntoContainer()

StatusCode Muon::MDT_RawDataProviderToolMT::convertIntoContainer ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs,
MdtCsmContainer & mdtContainer ) const
virtual

Convert method.

Definition at line 41 of file MDT_RawDataProviderToolMT.cxx.

42 {
43 ATH_MSG_VERBOSE("convert(): " << vecRobs.size() << " ROBFragments.");
44
45 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* frag : vecRobs) {
46 // convert only if data payload is delivered
47 if (frag->rod_ndata() != 0) {
48 m_decoder->fillCollections(*frag, mdtContainer).ignore();
49 } else {
50 ATH_MSG_DEBUG(" ROB " << MSG::hex << frag->source_id() << " is delivered with an empty payload" );
51 // store the error condition into the StatusCode and continue
52 }
53 }
54 // in presence of errors return FAILURE
55 ATH_MSG_DEBUG("After processing numColls=" << mdtContainer.numberOfCollections());
56 return StatusCode::SUCCESS;
57}
virtual size_t numberOfCollections() const override final
return number of collections
ToolHandle< MdtROD_Decoder > m_decoder
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

◆ initialize()

StatusCode Muon::MDT_RawDataProviderToolMT::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 17 of file MDT_RawDataProviderToolMT.cxx.

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

Member Data Documentation

◆ m_decoder

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

Definition at line 66 of file MDT_RawDataProviderToolMT.h.

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

◆ m_idHelperSvc

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

Definition at line 70 of file MDT_RawDataProviderToolMT.h.

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

◆ m_maxhashtoUse

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

Definition at line 72 of file MDT_RawDataProviderToolMT.h.

◆ m_rdoContainerCacheKey

SG::UpdateHandleKey<MdtCsm_Cache> Muon::MDT_RawDataProviderToolMT::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 79 of file MDT_RawDataProviderToolMT.h.

79 {this, "CsmContainerCacheKey", "",
80 "Optional external cache for the CSM container"
81 };

◆ m_rdoContainerKey

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

Definition at line 67 of file MDT_RawDataProviderToolMT.h.

67 {this, "RdoLocation", "MDTCSM",
68 "Name of the MDTCSM produced by RawDataProvider"};

◆ m_readKey

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

Definition at line 77 of file MDT_RawDataProviderToolMT.h.

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

◆ m_robDataProvider

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

Definition at line 75 of file MDT_RawDataProviderToolMT.h.

75{this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

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