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 ROBFragmentList &vecRobs) const override
 Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool.
virtual StatusCode convert (const ROBFragmentList &vecRobs, const std::vector< IdentifierHash > &rdoIdhVect) const override
 Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool with IdentifierHash vector.
virtual StatusCode convert () const override
 New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool.
virtual StatusCode convert (const std::vector< IdentifierHash > &rdoIdhVect) const override
 New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool with ID Hash vector.
virtual StatusCode convert (const ROBFragmentList &, const EventContext &) const override
 EventContext ones.
virtual StatusCode convert (const ROBFragmentList &, const std::vector< IdentifierHash > &, const EventContext &) const override
virtual StatusCode convert (const EventContext &) const override
virtual StatusCode convert (const std::vector< IdentifierHash > &, const EventContext &) const override

Private Member Functions

StatusCode convertIntoContainer (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, TgcRdoContainer &tgcRdoContainer, const EventContext &ctx) const
 Method that converts the ROBFragments into the passed container.
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > 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 override
 convert from vector of ROB IDs is not available
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/10]

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

New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool.

Definition at line 149 of file TGC_RawDataProviderTool.cxx.

149 {
150 return convert(Gaudi::Hive::currentContext());
151}
virtual StatusCode convert() const override
New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool.

◆ convert() [2/10]

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

Definition at line 153 of file TGC_RawDataProviderTool.cxx.

153 {
154 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
155 const std::vector<uint32_t>& robIds = m_hid2re.allRobIds();
156
157 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
158
159 return convert(vecOfRobf, ctx);
160}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Rob Data Provider handle.
TGC_Hid2RESrcID m_hid2re
ID converter.

◆ convert() [3/10]

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

EventContext ones.

Definition at line 103 of file TGC_RawDataProviderTool.cxx.

104 {
105
106 SG::WriteHandle<TgcRdoContainer> rdoContainerHandle(m_rdoContainerKey, ctx);
107
108 // Split the methods to have one where we use the cache and one where we
109 // just setup the container
110 const bool externalCacheRDO = !m_rdoContainerCacheKey.key().empty();
111 if (!externalCacheRDO) {
112 ATH_CHECK(rdoContainerHandle.record(
113 std::make_unique<TgcRdoContainer>(m_maxhashtoUse)));
114 ATH_MSG_DEBUG("Created TGC container");
115 } else {
116 SG::UpdateHandle<TgcRdo_Cache> update(m_rdoContainerCacheKey, ctx);
117 ATH_CHECK(update.isValid());
118 ATH_CHECK(rdoContainerHandle.record(
119 std::make_unique<TgcRdoContainer>(update.ptr())));
120 ATH_MSG_DEBUG("Created container using cache for "
121 << m_rdoContainerCacheKey.key());
122 }
123
124 TgcRdoContainer* rdoContainer = rdoContainerHandle.ptr();
125
126 // this should never happen, but since we dereference the pointer, we should
127 // check
128 if (!rdoContainer) {
129 ATH_MSG_ERROR("TGC RDO Container is null, cannot decode TGC data");
130 return StatusCode::FAILURE;
131 }
132
133 return convertIntoContainer(vecRobs, *rdoContainer, ctx);
134}
#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 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
SG::WriteHandleKey< TgcRdoContainer > m_rdoContainerKey
RDO container key.
SG::UpdateHandleKey< TgcRdo_Cache > m_rdoContainerCacheKey
StatusCode convertIntoContainer(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, TgcRdoContainer &tgcRdoContainer, const EventContext &ctx) const
Method that converts the ROBFragments into the passed container.

◆ convert() [4/10]

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

Definition at line 143 of file TGC_RawDataProviderTool.cxx.

145 {
146 return convert(vecRobs, ctx);
147}

◆ convert() [5/10]

StatusCode Muon::TGC_RawDataProviderTool::convert ( const ROBFragmentList & vecRobs) const
overridevirtual

Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool.

Definition at line 98 of file TGC_RawDataProviderTool.cxx.

99 {
100 return convert(vecRobs, Gaudi::Hive::currentContext());
101}

◆ convert() [6/10]

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

Old decoding method which uses IROBDataProviderSvc in TgcRdoToPrepDataTool with IdentifierHash vector.

Definition at line 136 of file TGC_RawDataProviderTool.cxx.

137 {
138 // This function does not use the IdentifierHash so we pass to the
139 // EventContext function which also does not use it
140 return convert(vecRobs, Gaudi::Hive::currentContext());
141}

◆ convert() [7/10]

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

Definition at line 167 of file TGC_RawDataProviderTool.cxx.

169 {
170 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf =
171 getROBData(rdoIdhVect, ctx);
172
173 return convert(vecOfRobf, rdoIdhVect, ctx);
174}
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > getROBData(const std::vector< IdentifierHash > &rdoIdhVect, const EventContext &ctx) const
Function to get the ROB data from a vector of IdentifierHash.

◆ convert() [8/10]

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

New decoding methods which do not use IROBDataProviderSvc in TgcRdoToPrepDataTool with ID Hash vector.

Definition at line 162 of file TGC_RawDataProviderTool.cxx.

163 {
164 return convert(rdoIdhVect, Gaudi::Hive::currentContext());
165}

◆ convert() [9/10]

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

convert from vector of ROB IDs is not available

Definition at line 103 of file TGC_RawDataProviderTool.h.

103 {
104 return StatusCode::FAILURE;
105 }

◆ convert() [10/10]

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

EventContext ones.

Definition at line 107 of file TGC_RawDataProviderTool.h.

108 {
109 return StatusCode::FAILURE;
110 }

◆ convertIntoContainer()

StatusCode Muon::TGC_RawDataProviderTool::convertIntoContainer ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vecRobs,
TgcRdoContainer & tgcRdoContainer,
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.

33 {
34
36 static thread_local int DecodeErrCount = 0;
37
38 // Update to range based loop
39 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* fragment : vecRobs) {
40 if (m_decoder->fillCollection(*fragment, tgcRdoContainer, ctx)
41 .isFailure()) {
42 if (DecodeErrCount < 100) {
43 ATH_MSG_INFO("Problem with TGC ByteStream Decoding!");
44 DecodeErrCount++;
45 } else if (100 == DecodeErrCount) {
47 "Too many Problems with TGC Decoding messages. Turning "
48 "message off.");
49 DecodeErrCount++;
50 }
51 }
52 }
53 ATH_MSG_DEBUG("Size of TgcRdoContainer is " << tgcRdoContainer.size());
54 return StatusCode::SUCCESS;
55}
#define ATH_MSG_INFO(x)
size_t size() const
Duplicate of fullSize for backwards compatability.
ToolHandle< ITGC_RodDecoder > m_decoder
Decoder for ROB fragment RDO conversion.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27

◆ getROBData()

std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > 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 58 of file TGC_RawDataProviderTool.cxx.

60 {
61 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vecOfRobf;
62 const TgcCablingMap* cabling{};
63 if (!SG::get(cabling, m_cablingKey, ctx).isSuccess()) {
65 "Could not get cabling, return empty vector of ROB fragments");
66 return vecOfRobf;
67 }
68
69 IdContext tgcContext = m_idHelperSvc->tgcIdHelper().module_context();
70
71 std::vector<uint32_t> robIds;
72
73 unsigned int size = rdoIdhVect.size();
74 for (unsigned int i = 0; i < size; ++i) {
75 Identifier Id;
76 if (m_idHelperSvc->tgcIdHelper().get_id(rdoIdhVect[i], Id,
77 &tgcContext)) {
79 "Unable to get TGC Identifier from collection hash id ");
80 continue;
81 }
82 const Identifier tgcId = Id;
83 uint32_t rodId = m_hid2re.getRodID(tgcId, cabling);
84 uint32_t robId = m_hid2re.getRobID(rodId);
85 std::vector<uint32_t>::iterator it_robId =
86 std::find(robIds.begin(), robIds.end(), robId);
87 if (it_robId == robIds.end()) {
88 robIds.push_back(robId);
89 }
90 }
91 m_robDataProvider->getROBData(ctx, robIds, vecOfRobf);
92 ATH_MSG_VERBOSE("Number of ROB fragments " << vecOfRobf.size());
93 return vecOfRobf;
94}
#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 97 of file TGC_RawDataProviderTool.h.

97 {
98 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 82 of file TGC_RawDataProviderTool.h.

82 {
83 this, "Decoder", "Muon::TGC_RodDecoderReadout/TGC_RodDecoderReadout"};

◆ m_hid2re

TGC_Hid2RESrcID Muon::TGC_RawDataProviderTool::m_hid2re
private

ID converter.

Definition at line 92 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 79 of file TGC_RawDataProviderTool.h.

79 {
80 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_maxhashtoUse

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

Definition at line 89 of file TGC_RawDataProviderTool.h.

◆ m_rdoContainerCacheKey

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

Definition at line 100 of file TGC_RawDataProviderTool.h.

100 {
101 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 85 of file TGC_RawDataProviderTool.h.

85 {
86 this, "RdoLocation", "TGCRDO",
87 "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 94 of file TGC_RawDataProviderTool.h.

94 {
95 this, "ROBDataProviderSvc", "ROBDataProviderSvc"};

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