ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
ITkStripsByteStreamCnv
src
ITkStripsRawContByteStreamTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ITkStripsRawContByteStreamTool.h
"
6
7
#include "
ByteStreamData/RawEvent.h
"
8
#include "
ByteStreamCnvSvcBase/SrcIdMap.h
"
9
#include "eformat/SourceIdentifier.h"
10
#include "
InDetIdentifier/SCT_ID.h
"
11
#include "
InDetReadoutGeometry/SiDetectorElement.h
"
12
#include "
ITkStripsByteStreamCnv/IITkStripsRodEncoder.h
"
13
14
#include "
ITkStripCabling/IITkStripCablingTool.h
"
15
16
17
// Constructor
18
19
ITkStripsRawContByteStreamTool::ITkStripsRawContByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
20
const
IInterface* parent) :
21
base_class(
type
, name, parent){
22
//nop
23
}
24
25
// Initialize
26
StatusCode
27
ITkStripsRawContByteStreamTool::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
33
ATH_CHECK
(detStore()->retrieve(
m_itkStripsIDHelper
,
"SCT_ID"
));
34
return
StatusCode::SUCCESS;
35
}
36
37
// Finalize
38
39
StatusCode
40
ITkStripsRawContByteStreamTool::finalize
() {
41
return
StatusCode::SUCCESS;
42
}
43
44
// Convert method
45
46
StatusCode
47
ITkStripsRawContByteStreamTool::convert
(
const
SCT_RDO_Container
* itkStripsRDOCont)
const
{
48
49
const
EventContext& ctx = Gaudi::Hive::currentContext();
// FIXME: should be taken by convert
50
51
FullEventAssembler<SrcIdMap>
* fullEventAssembler =
nullptr
;
52
ATH_CHECK
(
m_byteStreamCnvSvc
->getFullEventAssembler (fullEventAssembler,
"SCTRawCont"
) );
53
FullEventAssembler<SrcIdMap>::RODDATA
* rod;
54
// Set ROD Minor version
55
fullEventAssembler->
setRodMinorVersion
(
m_rodBlockVersion
);
56
ATH_MSG_DEBUG
(
" Setting Minor Version Number to "
<<
m_rodBlockVersion
);
57
// Mapping between ROD IDs and the hits in that ROD
58
std::map<uint32_t, std::vector<const SCT_RDORawData*>> rdoMap;
59
60
// The following few lines are to make sure there is an entry in the rdoMap for
61
// every ROD, even if there are no hits in it for a particular event
62
// (as there might be ByteStream errors e.g. TimeOut errors).
63
std::vector<std::uint32_t> listOfAllRODs;
64
m_cabling
->getAllRods(listOfAllRODs, ctx);
65
for
(std::uint32_t rod : listOfAllRODs) {
66
rdoMap[rod].clear();
67
}
68
// Loop over the collections in the ITkStrips RDO container
69
for
(
const
auto
* itkStripsRawColl : *itkStripsRDOCont) {
70
if
(itkStripsRawColl ==
nullptr
) {
71
ATH_MSG_WARNING
(
"Null pointer to ITkStrips RDO collection."
);
72
continue
;
73
}
else
{
74
// Collection ID
75
Identifier
idColl{itkStripsRawColl->identify()};
76
IdentifierHash
idCollHash{
m_itkStripsIDHelper
->wafer_hash(idColl)};
77
uint32_t robid{
m_cabling
->getRobIdFromHash(idCollHash, ctx)};
78
if
(robid == 0)
continue
;
79
// Building the ROD ID
80
eformat::helper::SourceIdentifier srcIDROB{robid};
81
eformat::helper::SourceIdentifier srcIDROD{srcIDROB.subdetector_id(), srcIDROB.module_id()};
82
uint32_t rodid{srcIDROD.code()};
83
// Loop over RDOs in the collection
84
for
(
const
auto
* rdo : *itkStripsRawColl) {
85
// Fill the ROD/RDO map
86
rdoMap[rodid].push_back(rdo);
87
}
88
}
89
}
// End loop over collections
90
91
// Now encode data for each ROD in turn
92
for
(
const
auto
& rodToRDOs : rdoMap) {
93
rod = fullEventAssembler->
getRodData
(rodToRDOs.first);
// Get ROD data address
94
m_encoder
->fillROD(*rod, rodToRDOs.first, rodToRDOs.second);
// Encode ROD data
95
}
96
return
StatusCode::SUCCESS;
97
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IITkStripCablingTool.h
IITkStripsRodEncoder.h
ITkStripsRawContByteStreamTool.h
RawEvent.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_RDO_Container
InDetRawDataContainer< InDetRawDataCollection< SCT_RDORawData > > SCT_RDO_Container
Definition
SCT_RDO_Container.h:23
SiDetectorElement.h
SrcIdMap.h
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition
FullEventAssembler.h:38
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
ITkStripsRawContByteStreamTool::m_encoder
ToolHandle< IITkStripsRodEncoder > m_encoder
Algorithm Tool to decode ROB bytestream data into RDO.
Definition
ITkStripsRawContByteStreamTool.h:66
ITkStripsRawContByteStreamTool::m_cabling
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Definition
ITkStripsRawContByteStreamTool.h:69
ITkStripsRawContByteStreamTool::convert
virtual StatusCode convert(const SCT_RDO_Container *itkRDOCont) const override
Main Convert method.
Definition
ITkStripsRawContByteStreamTool.cxx:47
ITkStripsRawContByteStreamTool::finalize
virtual StatusCode finalize() override
Finalize.
Definition
ITkStripsRawContByteStreamTool.cxx:40
ITkStripsRawContByteStreamTool::initialize
virtual StatusCode initialize() override
Initialize.
Definition
ITkStripsRawContByteStreamTool.cxx:27
ITkStripsRawContByteStreamTool::m_rodBlockVersion
UnsignedShortProperty m_rodBlockVersion
Definition
ITkStripsRawContByteStreamTool.h:75
ITkStripsRawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition
ITkStripsRawContByteStreamTool.h:63
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
ITkStripsRawContByteStreamTool::ITkStripsRawContByteStreamTool
ITkStripsRawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition
ITkStripsRawContByteStreamTool.cxx:19
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
Identifier
Definition
IdentifierFieldParser.cxx:14
type
Generated on
for ATLAS Offline Software by
1.17.0