ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArByteStream
src
LArRawChannelContByteStreamCnv.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 "
LArByteStream/LArRawChannelContByteStreamCnv.h
"
6
#include "
LArByteStream/LArRawDataContByteStreamTool.h
"
7
8
#include "
ByteStreamCnvSvcBase/IByteStreamCnvSvc.h
"
9
#include "
ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h
"
10
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
11
#include "
ByteStreamData/RawEvent.h
"
12
13
#include "
LArRawEvent/LArRawChannelContainer.h
"
14
#include "
LArRawEvent/LArDigitContainer.h
"
15
16
#include "
AthenaKernel/CLASS_DEF.h
"
17
18
//STL-Stuff
19
#include <map>
20
#include <iostream>
21
#include <string>
22
23
24
LArRawChannelContByteStreamCnv::LArRawChannelContByteStreamCnv
(ISvcLocator* svcloc) :
25
AthConstConverter
(
storageType
(),
classID
(),svcloc,
"LArRawChannelContByteStreamCnv"
),
26
m_tool
(
"LArRawDataContByteStreamTool"
),
27
m_rdpSvc
(
"ROBDataProviderSvc"
,
name
()),
28
m_byteStreamCnvSvc
(
"ByteStreamCnvSvc"
,
name
()),
29
m_contSize
(0)
30
{}
31
32
CLID
LArRawChannelContByteStreamCnv::classID
(){
33
return
ClassID_traits<LArRawChannelContainer>::ID
() ;
34
}
35
36
LArRawChannelContByteStreamCnv::~LArRawChannelContByteStreamCnv
() {
37
}
38
39
40
StatusCode
41
LArRawChannelContByteStreamCnv::initialize
()
42
{
43
ATH_CHECK
( AthConstConverter::initialize() );
44
45
if
(
m_rdpSvc
.retrieve().isFailure()) {
46
ATH_MSG_WARNING
(
" Can't get ByteStreamInputSvc interface Reading of ByteStream Data not possible. "
);
47
}
48
49
ATH_CHECK
(
m_byteStreamCnvSvc
.retrieve() );
50
51
ATH_CHECK
(
m_tool
.retrieve() );
52
53
return
StatusCode::SUCCESS;
54
}
55
56
StatusCode
57
LArRawChannelContByteStreamCnv::createObjConst
(IOpaqueAddress* pAddr, DataObject*& pObj)
const
58
{
//Convert RawChannels from ByteStream to StoreGate
59
60
ByteStreamAddress
* pRE_Addr{};
61
ATH_CHECK
( (pRE_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
62
63
const
EventContext& ctx = pRE_Addr->
getEventContext
();
64
const
RawEvent
*
re
=
m_rdpSvc
->getEvent(ctx);
65
if
(!
re
) {
66
ATH_MSG_ERROR
(
"Could not get raw event from ByteStreamInputSvc"
);
67
return
StatusCode::FAILURE;
68
}
69
70
// create LArRawChannelContainer
71
LArRawChannelContainer
* channelContainer =
new
LArRawChannelContainer
() ;
72
if
(
m_contSize
) channelContainer->reserve(
m_contSize
);
73
74
StatusCode
sc
=
m_tool
->convert(
re
,channelContainer,
CaloGain::CaloGain
(0));
//Gain is a dummy variable in this case...
75
if
(
sc
!=StatusCode::SUCCESS) {
76
ATH_MSG_WARNING
(
"Conversion tool returned an error. LArRawChannelContainer might be empty."
);
77
}
78
79
pObj =
SG::asStorable
( channelContainer ) ;
80
81
ATH_MSG_DEBUG
(
"Created a LArRawChannelContainer of size"
<< channelContainer->size() );
82
83
if
(!
m_contSize
) {
84
m_contSize
=channelContainer->size();
85
ATH_MSG_DEBUG
(
"For the following events, we will reserve space for "
86
<<
m_contSize
<<
" LArRawchannels"
);
87
}
88
89
return
StatusCode::SUCCESS;
90
91
92
}
93
94
StatusCode
95
LArRawChannelContByteStreamCnv::createRepConst
(DataObject* pObj, IOpaqueAddress*& pAddr)
const
96
{
// convert LArRawChannels in the container into ByteStream
97
98
// Get Full Event Assembler
99
FullEventAssembler<RodRobIdMap>
*fea = 0;
100
ATH_CHECK
(
m_byteStreamCnvSvc
->getFullEventAssembler(fea,
"LAr"
) );
101
102
LArRawChannelContainer
* ChannelContainer =
nullptr
;
103
if
(!
SG::fromStorable
(pObj, ChannelContainer ) || !ChannelContainer) {
104
ATH_MSG_ERROR
(
" Can not cast to LArRawChannelContainer "
);
105
return
StatusCode::FAILURE;
106
}
107
108
const
std::string& nm = pObj->registry()->name();
109
110
if
( pAddr !=
nullptr
) pAddr->release();
111
pAddr =
new
ByteStreamAddress
(
classID
(),nm,
""
);
112
pAddr->addRef();
113
114
ATH_CHECK
(
m_tool
->WriteLArRawChannels(ChannelContainer,*fea) );
115
return
StatusCode::SUCCESS;
116
}
re
const std::regex re(r_e)
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_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ByteStreamAddress.h
ByteStreamCnvSvcBase.h
CLASS_DEF.h
macros to associate a CLID to a type
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IByteStreamCnvSvc.h
LArDigitContainer.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LArRawChannelContByteStreamCnv.h
LArRawChannelContainer.h
LArRawDataContByteStreamTool.h
Helper tool for conversion of raw data classes to/from LArByteStream.
LArRawChannelContainer
Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old LArRawChannelContainer
Definition
LArTPCnv.cxx:86
RawEvent.h
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition
RawEvent.h:37
AthConstConverter::AthConstConverter
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
Definition
AthConstConverter.h:35
AthConstConverter::name
const std::string & name() const
Definition
AthConstConverter.h:67
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition
ByteStreamAddress.h:28
ByteStreamAddress::getEventContext
const EventContext & getEventContext() const
Definition
ByteStreamAddress.h:62
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition
FullEventAssembler.h:38
LArRawChannelContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
Definition
LArRawChannelContByteStreamCnv.cxx:95
LArRawChannelContByteStreamCnv::m_rdpSvc
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
Definition
LArRawChannelContByteStreamCnv.h:49
LArRawChannelContByteStreamCnv::storageType
static long storageType()
Definition
LArRawChannelContByteStreamCnv.h:44
LArRawChannelContByteStreamCnv::LArRawChannelContByteStreamCnv
LArRawChannelContByteStreamCnv(ISvcLocator *svcloc)
Definition
LArRawChannelContByteStreamCnv.cxx:24
LArRawChannelContByteStreamCnv::~LArRawChannelContByteStreamCnv
virtual ~LArRawChannelContByteStreamCnv()
Definition
LArRawChannelContByteStreamCnv.cxx:36
LArRawChannelContByteStreamCnv::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition
LArRawChannelContByteStreamCnv.h:50
LArRawChannelContByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition
LArRawChannelContByteStreamCnv.cxx:41
LArRawChannelContByteStreamCnv::m_contSize
std::atomic< size_t > m_contSize
Definition
LArRawChannelContByteStreamCnv.h:51
LArRawChannelContByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Definition
LArRawChannelContByteStreamCnv.cxx:57
LArRawChannelContByteStreamCnv::classID
static CLID classID()
Definition
LArRawChannelContByteStreamCnv.cxx:32
LArRawChannelContByteStreamCnv::m_tool
ToolHandle< BYTESTREAMTOOL > m_tool
Definition
LArRawChannelContByteStreamCnv.h:48
LArRawChannelContainer
Container for LArRawChannel (IDC using LArRawChannelCollection).
Definition
LArRawChannelContainer.h:26
CaloGain::CaloGain
CaloGain
Definition
CaloGain.h:11
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition
StorableConversions.h:169
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
Generated on
for ATLAS Offline Software by
1.17.0