ATLAS Offline Software
Loading...
Searching...
No Matches
SCTRawContByteStreamTool Class Reference

Athena Algorithm Tool to provide conversion from SCT RDO container to ByteStream. More...

#include <SCTRawContByteStreamTool.h>

Inheritance diagram for SCTRawContByteStreamTool:
Collaboration diagram for SCTRawContByteStreamTool:

Public Member Functions

 SCTRawContByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
virtual ~SCTRawContByteStreamTool ()=default
 Destructor.
virtual StatusCode initialize () override
 Initialize.
virtual StatusCode finalize () override
 Finalize.
virtual StatusCode convert (const SCT_RDO_Container *sctRDOCont) const override
 Main Convert method.

Private Attributes

ServiceHandle< IByteStreamCnvSvcm_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
ToolHandle< ISCT_RodEncoderm_encoder {this, "Encoder", "SCT_RodEncoder", "SCT ROD Encoder for RDO to BS conversion"}
 Algorithm Tool to decode ROB bytestream data into RDO.
ToolHandle< ISCT_CablingToolm_cabling {this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"}
 Providing mappings of online and offline identifiers and also serial numbers.
const SCT_IDm_sctIDHelper {nullptr}
 Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.
UnsignedShortProperty m_rodBlockVersion {this, "RodBlockVersion", 0}

Detailed Description

Athena Algorithm Tool to provide conversion from SCT RDO container to ByteStream.

Conversion from SCT RDO container to ByteStream, and fill it in RawEvent.

The class inherits from AthAlgTool and ISCTRawContByteStreamTool.

Contains convert method that maps ROD ID's to vectors of RDOs in those RODs, then loops through the map, using RodEncoder to fill data for each ROD in turn.

Definition at line 37 of file SCTRawContByteStreamTool.h.

Constructor & Destructor Documentation

◆ SCTRawContByteStreamTool()

SCTRawContByteStreamTool::SCTRawContByteStreamTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 18 of file SCTRawContByteStreamTool.cxx.

19 :
20 base_class(type, name, parent)
21{
22}

◆ ~SCTRawContByteStreamTool()

virtual SCTRawContByteStreamTool::~SCTRawContByteStreamTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ convert()

StatusCode SCTRawContByteStreamTool::convert ( const SCT_RDO_Container * sctRDOCont) const
overridevirtual

Main Convert method.

Maps ROD ID's to vectors of RDOs in those RODs, then loops through the map, using RodEncoder to fill data for each ROD in turn.

Parameters
sctRDOContSCT RDO Container of Raw Data Collections.

Definition at line 49 of file SCTRawContByteStreamTool.cxx.

50{
51 FullEventAssembler<SrcIdMap>* fullEventAssembler = nullptr;
52 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fullEventAssembler,
53 "SCTRawCont") );
55
56 // Set ROD Minor version
57 fullEventAssembler->setRodMinorVersion(m_rodBlockVersion);
58 ATH_MSG_DEBUG(" Setting Minor Version Number to " << m_rodBlockVersion);
59
60 // Mapping between ROD IDs and the hits in that ROD
61 std::map<uint32_t, std::vector<const SCT_RDORawData*>> rdoMap;
62
63 // The following few lines are to make sure there is an entry in the rdoMap for
64 // every ROD, even if there are no hits in it for a particular event
65 // (as there might be ByteStream errors e.g. TimeOut errors).
66 std::vector<std::uint32_t> listOfAllRODs;
67 m_cabling->getAllRods(listOfAllRODs);
68 for (std::uint32_t rod : listOfAllRODs) {
69 rdoMap[rod].clear();
70 }
71
72 // Loop over the collections in the SCT RDO container
73 for (const InDetRawDataCollection<SCT_RDORawData>* sctRawColl : *sctRDOCont) {
74 if (sctRawColl == nullptr) {
75 ATH_MSG_WARNING("Null pointer to SCT RDO collection.");
76 continue;
77 }
78 else {
79 // Collection ID
80 Identifier idColl{sctRawColl->identify()};
81 IdentifierHash idCollHash{m_sctIDHelper->wafer_hash(idColl)};
82 uint32_t robid{m_cabling->getRobIdFromHash(idCollHash)};
83
84 if (robid == 0) continue;
85
86 // Building the ROD ID
87 eformat::helper::SourceIdentifier srcIDROB{robid};
88 eformat::helper::SourceIdentifier srcIDROD{srcIDROB.subdetector_id(), srcIDROB.module_id()};
89 uint32_t rodid{srcIDROD.code()};
90
91 // Loop over RDOs in the collection
92 for (const SCT_RDORawData* rdo : *sctRawColl) {
93 // Fill the ROD/RDO map
94 rdoMap[rodid].push_back(rdo);
95 }
96 }
97 } // End loop over collections
98
99 // Now encode data for each ROD in turn
100 for (const auto& rodToRDOs : rdoMap) {
101 rod = fullEventAssembler->getRodData(rodToRDOs.first); // Get ROD data address
102 m_encoder->fillROD(*rod, rodToRDOs.first, rodToRDOs.second); // Encode ROD data
103 }
104
105 return StatusCode::SUCCESS;
106}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
void setRodMinorVersion(uint16_t m)
change the ROD minor version
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
ToolHandle< ISCT_RodEncoder > m_encoder
Algorithm Tool to decode ROB bytestream data into RDO.
UnsignedShortProperty m_rodBlockVersion
ToolHandle< ISCT_CablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
const SCT_ID * m_sctIDHelper
Identifier helper class for the SCT subdetector that creates compact Identifier objects and Identifie...
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
setEventNumber uint32_t

◆ finalize()

StatusCode SCTRawContByteStreamTool::finalize ( )
overridevirtual

Finalize.

Definition at line 42 of file SCTRawContByteStreamTool.cxx.

43{
44 return StatusCode::SUCCESS;
45}

◆ initialize()

StatusCode SCTRawContByteStreamTool::initialize ( )
overridevirtual

Initialize.

Definition at line 26 of file SCTRawContByteStreamTool.cxx.

27{
28 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
29
30 // Retrieve ID mapping
31 ATH_CHECK(m_cabling.retrieve());
32 ATH_MSG_INFO("Retrieved service " << m_cabling);
33
34 // Get the SCT Helper
36
37 return StatusCode::SUCCESS;
38}
#define ATH_MSG_INFO(x)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_byteStreamCnvSvc

ServiceHandle<IByteStreamCnvSvc> SCTRawContByteStreamTool::m_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
private

Definition at line 64 of file SCTRawContByteStreamTool.h.

65{ this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" };

◆ m_cabling

ToolHandle<ISCT_CablingTool> SCTRawContByteStreamTool::m_cabling {this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"}
private

Providing mappings of online and offline identifiers and also serial numbers.

Definition at line 71 of file SCTRawContByteStreamTool.h.

71{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"};

◆ m_encoder

ToolHandle<ISCT_RodEncoder> SCTRawContByteStreamTool::m_encoder {this, "Encoder", "SCT_RodEncoder", "SCT ROD Encoder for RDO to BS conversion"}
private

Algorithm Tool to decode ROB bytestream data into RDO.

Definition at line 68 of file SCTRawContByteStreamTool.h.

68{this, "Encoder", "SCT_RodEncoder", "SCT ROD Encoder for RDO to BS conversion"};

◆ m_rodBlockVersion

UnsignedShortProperty SCTRawContByteStreamTool::m_rodBlockVersion {this, "RodBlockVersion", 0}
private

Definition at line 77 of file SCTRawContByteStreamTool.h.

77{this, "RodBlockVersion", 0};

◆ m_sctIDHelper

const SCT_ID* SCTRawContByteStreamTool::m_sctIDHelper {nullptr}
private

Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.

Also allows decoding of these IDs.

Definition at line 75 of file SCTRawContByteStreamTool.h.

75{nullptr};

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