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

A tool to decode TGC ROB fragments into TGC RDO. More...

#include <TGC_RawDataProviderTool.h>

Inheritance diagram for Muon::TGC_RawDataProviderTool:
Collaboration diagram for Muon::TGC_RawDataProviderTool:

Public Member Functions

virtual ~TGC_RawDataProviderTool ()=default
 Default destructor.
virtual StatusCode initialize () override
 Standard AlgTool method.
virtual StatusCode convert (const EventContext &) const override
 EventContext ones.
virtual StatusCode convert (const std::vector< IdentifierHash > &, const EventContext &) const override

Private Member Functions

StatusCode convertIntoContainer (const ROBFragmentList &vecRobs, const EventContext &ctx) const
 Method that converts the ROBFragments into the passed container.
ROBFragmentList getROBData (const std::vector< IdentifierHash > &rdoIdhVect, const EventContext &ctx) const
 Function to get the ROB data from a vector of IdentifierHash.
virtual StatusCode convert (const std::vector< uint32_t > &, const EventContext &) const override
 EventContext ones.

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
ToolHandle< ITGC_RodDecoderm_decoder
 Decoder for ROB fragment RDO conversion.
SG::WriteHandleKey< TgcRdoContainerm_rdoContainerKey
 RDO container key.
unsigned int m_maxhashtoUse = 0U
TGC_Hid2RESrcID m_hid2re
 ID converter.
ServiceHandle< IROBDataProviderSvcm_robDataProvider
 Rob Data Provider handle.
SG::ReadCondHandleKey< Muon::TgcCablingMapm_cablingKey
SG::UpdateHandleKey< TgcRdo_Cachem_rdoContainerCacheKey

Detailed Description

A tool to decode TGC ROB fragments into TGC RDO.

This version is for athenaMT.

Author
Zvi Tarem zvi@c.nosp@m.alip.nosp@m.er.co.nosp@m..il
Mark Owen marko.nosp@m.wen@.nosp@m.cern..nosp@m.ch

Definition at line 30 of file TGC_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ ~TGC_RawDataProviderTool()

virtual Muon::TGC_RawDataProviderTool::~TGC_RawDataProviderTool ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ convert() [1/3]

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

EventContext ones.

Definition at line 122 of file TGC_RawDataProviderTool.cxx.

122 {
123 ROBFragmentList vecOfRobf;
124 m_robDataProvider->getROBData(ctx, m_hid2re.allRobIds(), vecOfRobf);
125 return convertIntoContainer(vecOfRobf, ctx);
126}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Rob Data Provider handle.
StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
Method that converts the ROBFragments into the passed container.
TGC_Hid2RESrcID m_hid2re
ID converter.

◆ convert() [2/3]

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

Definition at line 128 of file TGC_RawDataProviderTool.cxx.

130 {
131 ROBFragmentList vecOfRobf =
132 getROBData(rdoIdhVect, ctx);
133
134 return convertIntoContainer(vecOfRobf, ctx);
135}
ROBFragmentList getROBData(const std::vector< IdentifierHash > &rdoIdhVect, const EventContext &ctx) const
Function to get the ROB data from a vector of IdentifierHash.

◆ convert() [3/3]

virtual StatusCode Muon::TGC_RawDataProviderTool::convert ( const std::vector< uint32_t > & ,
const EventContext &  ) const
inlineoverrideprivatevirtual

EventContext ones.

Definition at line 79 of file TGC_RawDataProviderTool.h.

80 {
81 return StatusCode::FAILURE;
82 }

◆ convertIntoContainer()

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

Method that converts the ROBFragments into the passed container.

Static variables are not thread safe

Definition at line 31 of file TGC_RawDataProviderTool.cxx.

32 {
33
34 SG::WriteHandle rdoContainerHandle(m_rdoContainerKey, ctx);
35
36 // Split the methods to have one where we use the cache and one where we
37 // just setup the container
38 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
39 if (!externalCacheRDO) {
40 ATH_CHECK(rdoContainerHandle.record(
41 std::make_unique<TgcRdoContainer>(m_maxhashtoUse)));
42 ATH_MSG_DEBUG("Created TGC container");
43 } else {
44 SG::UpdateHandle<TgcRdo_Cache> update(m_rdoContainerCacheKey, ctx);
45 ATH_CHECK(update.isValid());
46 ATH_CHECK(rdoContainerHandle.record(
47 std::make_unique<TgcRdoContainer>(update.ptr())));
48 ATH_MSG_DEBUG("Created container using cache for "
49 << m_rdoContainerCacheKey.key());
50 }
51
52 TgcRdoContainer* rdoContainer = rdoContainerHandle.ptr();
53
54 // this should never happen, but since we dereference the pointer, we should
55 // check
56 if (!rdoContainer) {
57 ATH_MSG_ERROR("TGC RDO Container is null, cannot decode TGC data");
58 return StatusCode::FAILURE;
59 }
61 static thread_local int DecodeErrCount = 0;
62
63 // Update to range based loop
64 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* fragment : vecRobs) {
65 if (m_decoder->fillCollection(*fragment, *rdoContainer, ctx)
66 .isFailure()) {
67 if (DecodeErrCount < 100) {
68 ATH_MSG_INFO("Problem with TGC ByteStream Decoding!");
69 DecodeErrCount++;
70 } else if (100 == DecodeErrCount) {
72 "Too many Problems with TGC Decoding messages. Turning "
73 "message off.");
74 DecodeErrCount++;
75 }
76 }
77 }
78 ATH_MSG_DEBUG("Size of TgcRdoContainer is " << rdoContainer->size());
79 return StatusCode::SUCCESS;
80}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current TgcRdoContainer
size_t size() const
Duplicate of fullSize for backwards compatability.
ToolHandle< ITGC_RodDecoder > m_decoder
Decoder for ROB fragment RDO conversion.
SG::WriteHandleKey< TgcRdoContainer > m_rdoContainerKey
RDO container key.
SG::UpdateHandleKey< TgcRdo_Cache > m_rdoContainerCacheKey
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

◆ getROBData()

TGC_RawDataProviderTool::ROBFragmentList Muon::TGC_RawDataProviderTool::getROBData ( const std::vector< IdentifierHash > & rdoIdhVect,
const EventContext & ctx ) const
private

Function to get the ROB data from a vector of IdentifierHash.

Definition at line 83 of file TGC_RawDataProviderTool.cxx.

85 {
86 ROBFragmentList vecOfRobf;
87 const TgcCablingMap* cabling{};
88 if (!SG::get(cabling, m_cablingKey, ctx).isSuccess()) {
90 "Could not get cabling, return empty vector of ROB fragments");
91 return vecOfRobf;
92 }
93
94 IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context();
95
96 std::vector<uint32_t> robIds;
97
98 unsigned int size = rdoIdhVect.size();
99 for (unsigned int i = 0; i < size; ++i) {
100 Identifier Id;
101 if (m_idHelperSvc->tgcIdHelper().get_id(rdoIdhVect[i], Id,
102 &tgcContext)) {
104 "Unable to get TGC Identifier from collection hash id ");
105 continue;
106 }
107 const Identifier tgcId = Id;
108 uint32_t rodId = m_hid2re.getRodID(tgcId, cabling);
109 uint32_t robId = m_hid2re.getRobID(rodId);
110 std::vector<uint32_t>::iterator it_robId =
111 std::find(robIds.begin(), robIds.end(), robId);
112 if (it_robId == robIds.end()) {
113 robIds.push_back(robId);
114 }
115 }
116 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
117 ATH_MSG_VERBOSE("Number of ROB fragments " << vecOfRobf.size());
118 return vecOfRobf;
119}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
setEventNumber uint32_t

◆ initialize()

StatusCode Muon::TGC_RawDataProviderTool::initialize ( )
overridevirtual

Standard AlgTool method.

Definition at line 9 of file TGC_RawDataProviderTool.cxx.

9 {
10 ATH_CHECK(m_idHelperSvc.retrieve());
11
12 ATH_CHECK(m_decoder.retrieve());
13
14 // Get ROBDataProviderSvc
15 ATH_CHECK(m_robDataProvider.retrieve());
16
17 m_maxhashtoUse = m_idHelperSvc->tgcIdHelper().module_hash_max();
18
19 ATH_CHECK(m_rdoContainerKey.initialize());
20
21 ATH_CHECK(m_cablingKey.initialize());
22 m_hid2re.fillAllRobIds();
23 // Initialise the container cache if available
25 !m_rdoContainerCacheKey.key().empty()));
26
27 ATH_MSG_INFO("initialize() successful in " << name());
28 return StatusCode::SUCCESS;
29}

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<Muon::TgcCablingMap> Muon::TGC_RawDataProviderTool::m_cablingKey
private
Initial value:
{
this, "CablingKey", "MuonTgc_CablingMap"}

Definition at line 73 of file TGC_RawDataProviderTool.h.

73 {
74 this, "CablingKey", "MuonTgc_CablingMap"};

◆ m_decoder

ToolHandle<ITGC_RodDecoder> Muon::TGC_RawDataProviderTool::m_decoder
private
Initial value:
{
this, "Decoder", "Muon::TGC_RodDecoderReadout/TGC_RodDecoderReadout"}

Decoder for ROB fragment RDO conversion.

Definition at line 58 of file TGC_RawDataProviderTool.h.

58 {
59 this, "Decoder", "Muon::TGC_RodDecoderReadout/TGC_RodDecoderReadout"};

◆ m_hid2re

TGC_Hid2RESrcID Muon::TGC_RawDataProviderTool::m_hid2re
private

ID converter.

Definition at line 68 of file TGC_RawDataProviderTool.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::TGC_RawDataProviderTool::m_idHelperSvc
private
Initial value:
{
this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 55 of file TGC_RawDataProviderTool.h.

55 {
56 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_maxhashtoUse

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

Definition at line 65 of file TGC_RawDataProviderTool.h.

◆ m_rdoContainerCacheKey

SG::UpdateHandleKey<TgcRdo_Cache> Muon::TGC_RawDataProviderTool::m_rdoContainerCacheKey
private
Initial value:
{
this, "TgcContainerCacheKey", ""}

Definition at line 76 of file TGC_RawDataProviderTool.h.

76 {
77 this, "TgcContainerCacheKey", ""};

◆ m_rdoContainerKey

SG::WriteHandleKey<TgcRdoContainer> Muon::TGC_RawDataProviderTool::m_rdoContainerKey
private
Initial value:
{
this, "RdoLocation", "TGCRDO",
"Name of the TGCRDO produced by RawDataProvider"}

RDO container key.

Definition at line 61 of file TGC_RawDataProviderTool.h.

61 {
62 this, "RdoLocation", "TGCRDO",
63 "Name of the TGCRDO produced by RawDataProvider"}; // MT

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> Muon::TGC_RawDataProviderTool::m_robDataProvider
private
Initial value:
{
this, "ROBDataProviderSvc", "ROBDataProviderSvc"}

Rob Data Provider handle.

Definition at line 70 of file TGC_RawDataProviderTool.h.

70 {
71 this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

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