ATLAS Offline Software
Loading...
Searching...
No Matches
RPC_RawDataProviderToolCore.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
6#include "eformat/SourceIdentifier.h"
7
8using eformat::helper::SourceIdentifier;
10
11Muon::RPC_RawDataProviderToolCore::RPC_RawDataProviderToolCore(const std::string& t, const std::string& n, const IInterface* p) :
12 AthAlgTool(t, n, p), m_robDataProvider("ROBDataProviderSvc", n) {}
13
15 // retrieve ROD decoder
16 ATH_CHECK(m_decoder.retrieve());
17
18 ATH_CHECK(m_containerKey.initialize());
19 ATH_CHECK(m_sec.initialize());
20
21 // get ROB data provider service
22 ATH_CHECK(m_robDataProvider.retrieve());
23
24 ATH_CHECK(m_readKey.initialize());
25
26 return StatusCode::SUCCESS;
27}
28
30 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vecRobs, const std::vector<IdentifierHash>& collections,
31 RpcPadContainer* pad, RpcSectorLogicContainer* logic, const bool& decodeSL) const {
32 for (auto itFrag = vecRobs.begin(); itFrag != vecRobs.end(); itFrag++) {
33 // convert only if data payload is delivered
34 if ((**itFrag).rod_ndata() != 0) {
35 std::vector<IdentifierHash> coll = to_be_converted(**itFrag, collections);
36
37 if (m_decoder->fillCollections(**itFrag, *pad, coll, logic, decodeSL).isFailure()) {
38 // store the error conditions into the StatusCode and continue
39 }
40 } else {
41 if (msgLvl(MSG::DEBUG)) {
42 uint32_t sourceId = (**itFrag).source_id();
43 msg(MSG::DEBUG) << " ROB " << MSG::hex << sourceId << " is delivered with an empty payload" << MSG::dec << endmsg;
44 }
45 // store the error condition into the StatusCode and continue
46 }
47 }
48
49 ATH_MSG_DEBUG("After processing, number of collections in container : " << pad->numberOfCollections());
50
51 // in presence of errors return FAILURE
52 // CALLGRIND_STOP_INSTRUMENTATION
53 return StatusCode::SUCCESS;
54}
55
56std::vector<IdentifierHash> Muon::RPC_RawDataProviderToolCore::to_be_converted(const ROBFragment& robFrag,
57 const std::vector<IdentifierHash>& coll) const {
59 const RpcCablingCondData* readCdo{*readHandle};
60
61 std::vector<IdentifierHash> to_return;
62 if (coll.empty()) {
63 // get SubdetectorId and ModuleId
64 uint32_t source_id = robFrag.rod_source_id();
65 SourceIdentifier sid(source_id);
66 to_return = (readCdo->rod2hash(sid.subdetector_id(), sid.module_id()));
67 } else {
68 uint32_t source_id = robFrag.rod_source_id();
69 std::vector<IdentifierHash>::const_iterator it = coll.begin();
70 to_return.reserve(coll.size());
71 for (; it != coll.end(); ++it) {
72 if (source_id == readCdo->hash2source(*it)) to_return.emplace_back(*it);
73 }
74 }
75
76 return to_return;
77}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
bool msgLvl(const MSG::Level lvl) const
virtual size_t numberOfCollections() const override final
return number of collections
SG::ReadCondHandleKey< RpcCablingCondData > m_readKey
std::vector< IdentifierHash > to_be_converted(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, const std::vector< IdentifierHash > &coll) const
StatusCode convertIntoContainers(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, const std::vector< IdentifierHash > &collections, RpcPadContainer *pad, RpcSectorLogicContainer *logic, const bool &decodeSL) const
SG::WriteHandleKey< RpcPadContainer > m_containerKey
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
SG::WriteHandleKey< RpcSectorLogicContainer > m_sec
RPC_RawDataProviderToolCore(const std::string &t, const std::string &n, const IInterface *p)
std::vector< IdentifierHash > rod2hash(uint16_t subsystem, uint16_t rod) const
uint32_t hash2source(unsigned int h) const
Use IdentifiableContainer with RpcPad.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
MsgStream & msg
Definition testRead.cxx:32