ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
SCT_RawDataByteStreamCnv
src
SCTRawContByteStreamTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SCTRawContByteStreamTool.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 "
SCT_RawDataByteStreamCnv/ISCT_RodEncoder.h
"
13
#include "
SCT_Cabling/ISCT_CablingTool.h
"
14
#include "
StoreGate/ReadCondHandle.h
"
15
16
// Constructor
17
18
SCTRawContByteStreamTool::SCTRawContByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
19
const
IInterface* parent) :
20
base_class(
type
, name, parent)
21
{
22
}
23
24
// Initialize
25
26
StatusCode
SCTRawContByteStreamTool::initialize
()
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
35
ATH_CHECK
(detStore()->retrieve(
m_sctIDHelper
,
"SCT_ID"
));
36
37
return
StatusCode::SUCCESS;
38
}
39
40
// Finalize
41
42
StatusCode
SCTRawContByteStreamTool::finalize
()
43
{
44
return
StatusCode::SUCCESS;
45
}
46
47
// Convert method
48
49
StatusCode
SCTRawContByteStreamTool::convert
(
const
SCT_RDO_Container
* sctRDOCont)
const
50
{
51
FullEventAssembler<SrcIdMap>
* fullEventAssembler =
nullptr
;
52
ATH_CHECK
(
m_byteStreamCnvSvc
->getFullEventAssembler (fullEventAssembler,
53
"SCTRawCont"
) );
54
FullEventAssembler<SrcIdMap>::RODDATA
* rod;
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ISCT_CablingTool.h
Header file for abstract interface to SCT cabling tool.
ISCT_RodEncoder.h
RawEvent.h
ReadCondHandle.h
SCTRawContByteStreamTool.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
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
InDetRawDataCollection
Definition
InDetRawDataCollection.h:31
SCTRawContByteStreamTool::m_encoder
ToolHandle< ISCT_RodEncoder > m_encoder
Algorithm Tool to decode ROB bytestream data into RDO.
Definition
SCTRawContByteStreamTool.h:68
SCTRawContByteStreamTool::initialize
virtual StatusCode initialize() override
Initialize.
Definition
SCTRawContByteStreamTool.cxx:26
SCTRawContByteStreamTool::convert
virtual StatusCode convert(const SCT_RDO_Container *sctRDOCont) const override
Main Convert method.
Definition
SCTRawContByteStreamTool.cxx:49
SCTRawContByteStreamTool::m_rodBlockVersion
UnsignedShortProperty m_rodBlockVersion
Definition
SCTRawContByteStreamTool.h:77
SCTRawContByteStreamTool::SCTRawContByteStreamTool
SCTRawContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition
SCTRawContByteStreamTool.cxx:18
SCTRawContByteStreamTool::m_cabling
ToolHandle< ISCT_CablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Definition
SCTRawContByteStreamTool.h:71
SCTRawContByteStreamTool::finalize
virtual StatusCode finalize() override
Finalize.
Definition
SCTRawContByteStreamTool.cxx:42
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
SCTRawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition
SCTRawContByteStreamTool.h:65
SCT_RDORawData
Definition
SCT_RDORawData.h:24
Identifier
Definition
IdentifierFieldParser.cxx:14
type
Generated on
for ATLAS Offline Software by
1.17.0