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

#include <CSC_RawDataProviderTool.h>

Inheritance diagram for Muon::CSC_RawDataProviderTool:
Collaboration diagram for Muon::CSC_RawDataProviderTool:

Public Member Functions

virtual ~CSC_RawDataProviderTool ()
 default destructor
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode convert (const EventContext &ctx) const override
virtual StatusCode convert (const std::vector< uint32_t > &robIds, const EventContext &ctx) const override
virtual StatusCode convert (const std::vector< IdentifierHash > &rdoIdhVect, const EventContext &ctx) const override

Private Member Functions

StatusCode convertIntoContainer (const ROBFragmentList &vecRobs, const EventContext &ctx) const
 function to decode the passed ROB fragments into the passed container

Private Attributes

ToolHandle< ICSC_ROD_Decoderm_decoder {this, "Decoder", "Muon::CscROD_Decoder/CscROD_Decoder"}
 member variables for algorithm properties:
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::WriteHandleKey< CscRawDataContainerm_containerKey
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfoKey", "EventInfo", ""}
CSC_Hid2RESrcID m_hid2re
ServiceHandle< IROBDataProviderSvcm_robDataProvider {this, "RobProviderSvc", "ROBDataProviderSvc"}
ServiceHandle< CSCcablingSvcm_cabling {this, "CablingSvc", "CSCcablingSvc"}
SG::UpdateHandleKey< CscRawDataCollection_Cachem_rdoContainerCacheKey
 CSC container cache key.

Detailed Description

Definition at line 25 of file CSC_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ ~CSC_RawDataProviderTool()

Muon::CSC_RawDataProviderTool::~CSC_RawDataProviderTool ( )
virtualdefault

default destructor

Member Function Documentation

◆ convert() [1/3]

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

Definition at line 120 of file CSC_RawDataProviderTool.cxx.

120 {
121 return convert(m_hid2re.allRobIds(), ctx);
122}
virtual StatusCode convert(const EventContext &ctx) const override

◆ convert() [2/3]

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

Definition at line 101 of file CSC_RawDataProviderTool.cxx.

102 {
103 IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
104
105 ROBFragmentList vecOfRobf;
106 std::vector<uint32_t> robIds;
107
108 for (unsigned int i = 0; i < rdoIdhVect.size(); ++i) {
109 uint32_t rob_id = 0xffff;
110 m_cabling->hash2RobFull(rdoIdhVect[i], rob_id);
111 robIds.push_back(rob_id);
112 }
113 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
114 ATH_MSG_VERBOSE("Number of ROB fragments " << vecOfRobf.size());
115
116 // This would be passed to the function which does not use the IdentifierHash further
117 return convertIntoContainer(vecOfRobf, ctx);
118}
#define ATH_MSG_VERBOSE(x)
ServiceHandle< CSCcablingSvc > m_cabling
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
function to decode the passed ROB fragments into the passed container
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
setEventNumber uint32_t

◆ convert() [3/3]

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

Definition at line 124 of file CSC_RawDataProviderTool.cxx.

125 {
126 ROBFragmentList vecOfRobf;
127
128 ATH_MSG_VERBOSE("Number of ROB ids " << robIds.size());
129 // ask ROBDataProviderSvc for the vector of ROBFragment for all CSC ROBIDs
130 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
131 ATH_MSG_VERBOSE("Number of ROB fragments " << vecOfRobf.size());
132
133 return convertIntoContainer(vecOfRobf, ctx);
134
135}

◆ convertIntoContainer()

StatusCode Muon::CSC_RawDataProviderTool::convertIntoContainer ( const ROBFragmentList & vecRobs,
const EventContext & ctx ) const
private

function to decode the passed ROB fragments into the passed container

Definition at line 51 of file CSC_RawDataProviderTool.cxx.

52 {
53 std::set<uint32_t> robIdSet;
54
55 SG::WriteHandle rdoContainerHandle{m_containerKey, ctx};
56
57 // Split the methods to have one where we use the cache and one where we just setup the container
58 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
59 if (!externalCacheRDO) {
60 ATH_CHECK(rdoContainerHandle.record(std::make_unique<CscRawDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max())));
61 ATH_MSG_DEBUG("Created CSCRawDataContainer");
62 } else {
63 SG::UpdateHandle update{m_rdoContainerCacheKey, ctx};
64 ATH_CHECK(update.isValid());
65 ATH_CHECK(rdoContainerHandle.record(std::make_unique<CscRawDataContainer>(update.ptr())));
66 ATH_MSG_DEBUG("Created container using cache for " << m_rdoContainerCacheKey.key());
67 }
68
69 CscRawDataContainer* container = rdoContainerHandle.ptr();
70
71 if (!container) {
72 ATH_MSG_ERROR("CSC RDO container pointer is null, cannot decode data");
73 return StatusCode::FAILURE;
74 }
75 const xAOD::EventInfo* eventInfo{nullptr};
76 ATH_CHECK(SG::get(eventInfo, m_eventInfoKey, ctx));
77
78 ATH_MSG_DEBUG("Before processing numColls=" << container->numberOfCollections());
79
80 ATH_MSG_DEBUG("vector of ROB ID to decode: size = " << vecRobs.size());
81
82 for (const ROBFragment* frag : vecRobs) {
83 uint32_t robid = frag->rod_source_id();
84
85 // check if this ROBFragment was already decoded (EF case in ROIs
86 if (!robIdSet.insert(robid).second) {
87 ATH_MSG_DEBUG(" ROB Fragment with ID " << std::hex << robid << std::dec << " already decoded, skip");
88 } else {
89 m_decoder->fillCollection(*eventInfo, *frag, *container);
90 }
91 }
92
93 ATH_MSG_DEBUG("After processing numColls=" << container->numberOfCollections());
94
95 return StatusCode::SUCCESS;
96}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current CscRawDataContainer
virtual size_t numberOfCollections() const override final
return number of collections
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ToolHandle< ICSC_ROD_Decoder > m_decoder
member variables for algorithm properties:
SG::WriteHandleKey< CscRawDataContainer > m_containerKey
SG::UpdateHandleKey< CscRawDataCollection_Cache > m_rdoContainerCacheKey
CSC container cache key.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ initialize()

StatusCode Muon::CSC_RawDataProviderTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 27 of file CSC_RawDataProviderTool.cxx.

27 {
28 ATH_CHECK(m_cabling.retrieve());
29 ATH_CHECK(m_robDataProvider.retrieve());
30 ATH_MSG_INFO("Retrieved service " << m_robDataProvider);
31
32 ATH_CHECK(m_idHelperSvc.retrieve());
33 m_hid2re.set(m_cabling.get(), &m_idHelperSvc->cscIdHelper());
34
35 // Retrieve decoder
36 ATH_CHECK(m_decoder.retrieve());
37 ATH_MSG_INFO("Retrieved tool " << m_decoder);
38
39 ATH_CHECK(m_containerKey.initialize());
40 ATH_CHECK(m_eventInfoKey.initialize());
41
42 // Initialise the container cache if available
44
45 ATH_MSG_INFO("initialize() successful in " << name());
46 return StatusCode::SUCCESS;
47}
#define ATH_MSG_INFO(x)

Member Data Documentation

◆ m_cabling

ServiceHandle<CSCcablingSvc> Muon::CSC_RawDataProviderTool::m_cabling {this, "CablingSvc", "CSCcablingSvc"}
private

Definition at line 57 of file CSC_RawDataProviderTool.h.

57{this, "CablingSvc", "CSCcablingSvc"};

◆ m_containerKey

SG::WriteHandleKey<CscRawDataContainer> Muon::CSC_RawDataProviderTool::m_containerKey
private
Initial value:
{this, "RdoLocation", "CSCRDO",
"Name of the CSCRDO produced by RawDataProvider"}

Definition at line 51 of file CSC_RawDataProviderTool.h.

51 {this, "RdoLocation", "CSCRDO",
52 "Name of the CSCRDO produced by RawDataProvider"};

◆ m_decoder

ToolHandle<ICSC_ROD_Decoder> Muon::CSC_RawDataProviderTool::m_decoder {this, "Decoder", "Muon::CscROD_Decoder/CscROD_Decoder"}
private

member variables for algorithm properties:

Definition at line 47 of file CSC_RawDataProviderTool.h.

47{this, "Decoder", "Muon::CscROD_Decoder/CscROD_Decoder"};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> Muon::CSC_RawDataProviderTool::m_eventInfoKey {this, "EventInfoKey", "EventInfo", ""}
private

Definition at line 53 of file CSC_RawDataProviderTool.h.

53{this, "EventInfoKey", "EventInfo", ""};

◆ m_hid2re

CSC_Hid2RESrcID Muon::CSC_RawDataProviderTool::m_hid2re
private

Definition at line 54 of file CSC_RawDataProviderTool.h.

◆ m_idHelperSvc

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

Definition at line 49 of file CSC_RawDataProviderTool.h.

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

◆ m_rdoContainerCacheKey

SG::UpdateHandleKey<CscRawDataCollection_Cache> Muon::CSC_RawDataProviderTool::m_rdoContainerCacheKey
private
Initial value:
{this, "CscContainerCacheKey", "",
"Optional external cache for the CSC container"}

CSC container cache key.

Definition at line 60 of file CSC_RawDataProviderTool.h.

60 {this, "CscContainerCacheKey", "",
61 "Optional external cache for the CSC container"};

◆ m_robDataProvider

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

Definition at line 56 of file CSC_RawDataProviderTool.h.

56{this, "RobProviderSvc", "ROBDataProviderSvc"};

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