ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual ~SCTRawContByteStreamTool ()=default
 Destructor. More...
 
virtual StatusCode initialize () override
 Initialize. More...
 
virtual StatusCode finalize () override
 Finalize. More...
 
virtual StatusCode convert (const SCT_RDO_Container *sctRDOCont) const override
 Main Convert method. More...
 

Private Attributes

ServiceHandle< ByteStreamCnvSvcm_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. More...
 
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. More...
 
const SCT_IDm_sctIDHelper {nullptr}
 Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. More...
 
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 }

◆ 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 }

Member Data Documentation

◆ m_byteStreamCnvSvc

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

Definition at line 64 of file SCTRawContByteStreamTool.h.

◆ 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.

◆ 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.

◆ m_rodBlockVersion

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

Definition at line 77 of file SCTRawContByteStreamTool.h.

◆ 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.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCTRawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< ByteStreamCnvSvc > m_byteStreamCnvSvc
Definition: SCTRawContByteStreamTool.h:65
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FullEventAssembler< SrcIdMap >
SCTRawContByteStreamTool::m_rodBlockVersion
UnsignedShortProperty m_rodBlockVersion
Definition: SCTRawContByteStreamTool.h:77
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SCT_RDORawData
Definition: SCT_RDORawData.h:24
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
SCTRawContByteStreamTool::m_sctIDHelper
const SCT_ID * m_sctIDHelper
Identifier helper class for the SCT subdetector that creates compact Identifier objects and Identifie...
Definition: SCTRawContByteStreamTool.h:75
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCTRawContByteStreamTool::m_cabling
ToolHandle< ISCT_CablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Definition: SCTRawContByteStreamTool.h:71
IdentifierHash
Definition: IdentifierHash.h:38
SCTRawContByteStreamTool::m_encoder
ToolHandle< ISCT_RodEncoder > m_encoder
Algorithm Tool to decode ROB bytestream data into RDO.
Definition: SCTRawContByteStreamTool.h:68
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data