ATLAS Offline Software
ITkStripsRawContByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 #include "eformat/SourceIdentifier.h"
10 #include "InDetIdentifier/SCT_ID.h"
13 
15 
16 
17 // Constructor
18 
20  const IInterface* parent) :
21  base_class(type, name, parent){
22  //nop
23 }
24 
25 // Initialize
28  ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
29  // Retrieve ID mapping
30  ATH_CHECK(m_cabling.retrieve());
31  ATH_MSG_DEBUG("Retrieved service " << m_cabling);
32  // Get the SCT Helper, valid also for ITk strips
34  return StatusCode::SUCCESS;
35 }
36 
37 // Finalize
38 
41  return StatusCode::SUCCESS;
42 }
43 
44 // Convert method
45 
48  FullEventAssembler<SrcIdMap>* fullEventAssembler = nullptr;
49  ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fullEventAssembler,"SCTRawCont") );
51  // Set ROD Minor version
52  fullEventAssembler->setRodMinorVersion(m_rodBlockVersion);
53  ATH_MSG_DEBUG(" Setting Minor Version Number to " << m_rodBlockVersion);
54  // Mapping between ROD IDs and the hits in that ROD
55  std::map<uint32_t, std::vector<const SCT_RDORawData*>> rdoMap;
56 
57  // The following few lines are to make sure there is an entry in the rdoMap for
58  // every ROD, even if there are no hits in it for a particular event
59  // (as there might be ByteStream errors e.g. TimeOut errors).
60  std::vector<std::uint32_t> listOfAllRODs;
61  m_cabling->getAllRods(listOfAllRODs);
62  for (std::uint32_t rod : listOfAllRODs) {
63  rdoMap[rod].clear();
64  }
65  // Loop over the collections in the ITkStrips RDO container
66  for (const auto* itkStripsRawColl : *itkStripsRDOCont) {
67  if (itkStripsRawColl == nullptr) {
68  ATH_MSG_WARNING("Null pointer to ITkStrips RDO collection.");
69  continue;
70  } else {
71  // Collection ID
72  Identifier idColl{itkStripsRawColl->identify()};
73  IdentifierHash idCollHash{m_itkStripsIDHelper->wafer_hash(idColl)};
74  uint32_t robid{m_cabling->getRobIdFromHash(idCollHash)};
75  if (robid == 0) continue;
76  // Building the ROD ID
77  eformat::helper::SourceIdentifier srcIDROB{robid};
78  eformat::helper::SourceIdentifier srcIDROD{srcIDROB.subdetector_id(), srcIDROB.module_id()};
79  uint32_t rodid{srcIDROD.code()};
80  // Loop over RDOs in the collection
81  for (const auto* rdo : *itkStripsRawColl) {
82  // Fill the ROD/RDO map
83  rdoMap[rodid].push_back(rdo);
84  }
85  }
86  } // End loop over collections
87 
88  // Now encode data for each ROD in turn
89  for (const auto& rodToRDOs : rdoMap) {
90  rod = fullEventAssembler->getRodData(rodToRDOs.first); // Get ROD data address
91  m_encoder->fillROD(*rod, rodToRDOs.first, rodToRDOs.second); // Encode ROD data
92  }
93  return StatusCode::SUCCESS;
94 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
FullEventAssembler< SrcIdMap >
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ITkStripsRawContByteStreamTool::m_itkStripsIDHelper
const SCT_ID * m_itkStripsIDHelper
Identifier helper class for the SCT subdetector that creates compact Identifier objects and Identifie...
Definition: ITkStripsRawContByteStreamTool.h:73
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
ITkStripsRawContByteStreamTool::initialize
virtual StatusCode initialize() override
Initialize.
Definition: ITkStripsRawContByteStreamTool.cxx:27
IITkStripsRodEncoder.h
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ITkStripsRawContByteStreamTool.h
SrcIdMap.h
ITkStripsRawContByteStreamTool::m_encoder
ToolHandle< IITkStripsRodEncoder > m_encoder
Algorithm Tool to decode ROB bytestream data into RDO.
Definition: ITkStripsRawContByteStreamTool.h:66
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ITkStripsRawContByteStreamTool::ITkStripsRawContByteStreamTool
ITkStripsRawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: ITkStripsRawContByteStreamTool.cxx:19
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
IITkStripCablingTool.h
ITkStripsRawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition: ITkStripsRawContByteStreamTool.h:63
ITkStripsRawContByteStreamTool::m_rodBlockVersion
UnsignedShortProperty m_rodBlockVersion
Definition: ITkStripsRawContByteStreamTool.h:75
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
SiDetectorElement.h
ITkStripsRawContByteStreamTool::finalize
virtual StatusCode finalize() override
Finalize.
Definition: ITkStripsRawContByteStreamTool.cxx:40
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ITkStripsRawContByteStreamTool::convert
virtual StatusCode convert(const SCT_RDO_Container *itkRDOCont) const override
Main Convert method.
Definition: ITkStripsRawContByteStreamTool.cxx:47
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
ITkStripsRawContByteStreamTool::m_cabling
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Definition: ITkStripsRawContByteStreamTool.h:69
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
Identifier
Definition: IdentifierFieldParser.cxx:14