ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
LUCID
LUCID_Cnv
LUCID_RawDataByteStreamCnv
src
LUCID_DigitByteStreamCnv.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 "
LUCID_RawDataByteStreamCnv/LUCID_DigitByteStreamCnv.h
"
6
#include "
AthenaBaseComps/AthCheckMacros.h
"
7
#include "
LUCID_RawEvent/LUCID_DigitContainer.h
"
8
#include "
AthenaKernel/ClassID_traits.h
"
9
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
10
#include "
StoreGate/StoreGateSvc.h
"
11
#include "
LUCID_RawDataByteStreamCnv/LUCID_RodEncoder.h
"
12
13
#include <cstdint>
14
#include <string>
15
#include <map>
16
17
typedef
std::map<uint32_t, LUCID_RodEncoder>
LucidRodEncoder_map
;
18
19
LUCID_DigitByteStreamCnv::LUCID_DigitByteStreamCnv
(ISvcLocator* svcloc) :
20
Converter
(
storageType
(),
classID
(), svcloc),
21
AthMessaging
(
"LUCID_DigitByteStreamCnv"
),
22
m_ByteStreamEventAccess
(
"ByteStreamCnvSvc"
,
"LUCID_DigitByteStreamCnv"
),
23
m_RodBlockVersion
(0),
24
m_BCs_per_LVL1ID
(1)
25
{
26
27
}
28
29
StatusCode
LUCID_DigitByteStreamCnv::initialize
() {
30
31
ATH_CHECK
( Converter::initialize() );
32
ATH_CHECK
(
m_ByteStreamEventAccess
.retrieve() );
33
34
return
StatusCode::SUCCESS;
35
}
36
37
CLID
LUCID_DigitByteStreamCnv::classID
() {
38
39
return
ClassID_traits<LUCID_DigitContainer>::ID
();
40
}
41
42
long
LUCID_DigitByteStreamCnv::storageType
() {
43
44
return
ByteStreamAddress::storageType
();
45
}
46
47
StatusCode
LUCID_DigitByteStreamCnv::createRep
(DataObject* pObj, IOpaqueAddress*& pAddr) {
48
49
ATH_MSG_DEBUG
(
" LUCID_DigitByteStreamCnv::createRep"
);
50
51
RawEventWrite
*
re
=
m_ByteStreamEventAccess
->getRawEvent();
52
LUCID_DigitContainer
* RDO_container =
nullptr
;
53
54
// dynamic cast of the pObj to RDO_container based in clid of pObj
55
if
(!
SG::fromStorable
(pObj, RDO_container)) {
56
ATH_MSG_ERROR
(
"Can not cast to LUCID_DigitContainer"
);
57
return
StatusCode::RECOVERABLE;
58
}
59
60
// get name of the persistent object (pObj)
61
std::string nm = pObj->registry()->name();
62
63
// and create a empty generic BytestreamAddress for the specific clid of pObj
64
ByteStreamAddress
* addr =
new
ByteStreamAddress
(
classID
(), nm,
""
);
65
66
pAddr = addr;
67
68
StatusCode
sc
=
fillFEA
(RDO_container,
re
);
69
70
if
(
sc
.isFailure()){
71
ATH_MSG_ERROR
(
" Could not convert RawData with to ByteStream "
);
72
return
StatusCode::RECOVERABLE;
73
}
74
75
return
StatusCode::SUCCESS;
76
}
77
78
StatusCode
LUCID_DigitByteStreamCnv::fillFEA
(
LUCID_DigitContainer
* RDO_container,
RawEventWrite
*
re
){
79
80
m_fea
.clear();
81
// type of RODDATA is std::vector<uint32_t>
82
FullEventAssembler<SrcIdMap>::RODDATA
* theROD;
83
84
m_fea
.setRodMinorVersion(
RodBlockVersion
());
85
ATH_MSG_DEBUG
(
"Setting ROD Minor Version Number to: "
<<
m_RodBlockVersion
);
86
87
LucidRodEncoder_map
RDOEncoder_map;
88
89
LUCID_DigitContainer::const_iterator
it_cont = RDO_container->
begin
();
90
LUCID_DigitContainer::const_iterator
it_cont_end = RDO_container->
end
();
91
LUCID_RodEncoder::Cache
cache{};
92
for
( ; it_cont != it_cont_end; ++it_cont) {
93
94
if
((*it_cont) !=
nullptr
) {
95
96
uint32_t rodId =
getSourceID
();
97
98
RDOEncoder_map[rodId].addDigit((*it_cont),cache);
99
}
100
else
ATH_MSG_WARNING
(
" Digit is empty, skipping digit."
);
101
}
102
103
LucidRodEncoder_map::iterator it_map = RDOEncoder_map.begin();
104
LucidRodEncoder_map::iterator it_map_end = RDOEncoder_map.end();
105
106
for
(; it_map != it_map_end; ++it_map) {
107
108
// (*it_map) is now a pointer of the type std::pair<const uint32_t, LUCID_RDOEncoder >
109
110
theROD =
m_fea
.getRodData((*it_map).first);
111
112
((*it_map).second).encode(*theROD, cache,
msg
());
113
114
(*theROD).push_back(0);
// add status word
115
116
LUCID_RawData
lrd(*theROD);
117
118
lrd.
encodeLumatMapping
();
119
120
*theROD = lrd.
getDataBlock
();
121
}
122
123
m_fea
.fill(
re
,
msg
(MSG::INFO));
124
125
return
StatusCode::SUCCESS;
126
}
re
const std::regex re(r_e)
AthCheckMacros.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ByteStreamAddress.h
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LucidRodEncoder_map
std::map< uint32_t, LUCID_RodEncoder > LucidRodEncoder_map
Definition
LUCID_DigitByteStreamCnv.cxx:17
LUCID_DigitByteStreamCnv.h
LUCID_DigitContainer.h
LUCID_RodEncoder.h
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
StoreGateSvc.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition
AthMessaging.h:167
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition
ByteStreamAddress.h:28
ByteStreamAddress::storageType
static constexpr long storageType()
Definition
ByteStreamAddress.h:51
Converter::Converter
Converter()
Definition
Converter.h:29
DataVector< LUCID_Digit >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
LUCID_DigitByteStreamCnv::getSourceID
unsigned int getSourceID()
Definition
LUCID_DigitByteStreamCnv.h:48
LUCID_DigitByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition
LUCID_DigitByteStreamCnv.cxx:29
LUCID_DigitByteStreamCnv::storageType
static long storageType()
Definition
LUCID_DigitByteStreamCnv.cxx:42
LUCID_DigitByteStreamCnv::m_fea
FullEventAssembler< SrcIdMap > m_fea
Definition
LUCID_DigitByteStreamCnv.h:54
LUCID_DigitByteStreamCnv::m_BCs_per_LVL1ID
int m_BCs_per_LVL1ID
Definition
LUCID_DigitByteStreamCnv.h:56
LUCID_DigitByteStreamCnv::m_ByteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Definition
LUCID_DigitByteStreamCnv.h:52
LUCID_DigitByteStreamCnv::LUCID_DigitByteStreamCnv
LUCID_DigitByteStreamCnv(ISvcLocator *svcloc)
Definition
LUCID_DigitByteStreamCnv.cxx:19
LUCID_DigitByteStreamCnv::classID
static CLID classID()
Definition
LUCID_DigitByteStreamCnv.cxx:37
LUCID_DigitByteStreamCnv::fillFEA
StatusCode fillFEA(LUCID_DigitContainer *RDO_container, RawEventWrite *re)
Definition
LUCID_DigitByteStreamCnv.cxx:78
LUCID_DigitByteStreamCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
Definition
LUCID_DigitByteStreamCnv.cxx:47
LUCID_DigitByteStreamCnv::m_RodBlockVersion
unsigned short m_RodBlockVersion
Definition
LUCID_DigitByteStreamCnv.h:55
LUCID_DigitByteStreamCnv::RodBlockVersion
unsigned short RodBlockVersion(void)
Definition
LUCID_DigitByteStreamCnv.h:45
LUCID_DigitContainer
Definition
LUCID_DigitContainer.h:13
LUCID_RawData
Definition
LUCID_RawData.h:40
LUCID_RawData::encodeLumatMapping
void encodeLumatMapping(void)
Definition
LUCID_RawData.cxx:281
LUCID_RawData::getDataBlock
std::vector< uint32_t > getDataBlock() const
Definition
LUCID_RawData.h:97
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition
StorableConversions.h:169
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
LUCID_RodEncoder::Cache
Definition
LUCID_RodEncoder.h:24
Generated on
for ATLAS Offline Software by
1.17.0