ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCnv
LArByteStream
src
LArAccumulatedDigitContByteStreamCnv.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/LArAccumulatedDigitContByteStreamCnv.h
"
6
#include "
LArByteStream/LArRawDataContByteStreamTool.h
"
7
8
#include "
CaloIdentifier/CaloGain.h
"
9
10
#include "
ByteStreamCnvSvcBase/IByteStreamCnvSvc.h
"
11
#include "
ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h
"
12
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
13
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
14
#include "
ByteStreamData/RawEvent.h
"
15
16
#include "GaudiKernel/MsgStream.h"
17
#include "GaudiKernel/StatusCode.h"
18
#include "GaudiKernel/DataObject.h"
19
#include "GaudiKernel/IRegistry.h"
20
21
#include "
LArRawEvent/LArAccumulatedDigitContainer.h
"
22
23
#include "
StoreGate/StoreGateSvc.h
"
24
#include "
AthenaKernel/CLASS_DEF.h
"
25
26
// Tool
27
#include "GaudiKernel/IToolSvc.h"
28
29
//STL-Stuff
30
#include <map>
31
#include <iostream>
32
33
34
LArAccumulatedDigitContByteStreamCnv::LArAccumulatedDigitContByteStreamCnv
(ISvcLocator* svcloc) :
35
AthConstConverter
(
storageType
(),
classID
(),svcloc,
"LArAccumulatedDigitContByteStreamCnv"
),
36
m_tool
(
"LArRawDataContByteStreamTool"
),
37
m_rdpSvc
(
"ROBDataProviderSvc"
,
name
())
38
{}
39
40
CLID
LArAccumulatedDigitContByteStreamCnv::classID
(){
41
return
ClassID_traits<LArAccumulatedDigitContainer>::ID
() ;
42
}
43
44
LArAccumulatedDigitContByteStreamCnv::~LArAccumulatedDigitContByteStreamCnv
() {
45
}
46
47
48
StatusCode
49
LArAccumulatedDigitContByteStreamCnv::initialize
()
50
{
51
ATH_CHECK
( AthConstConverter::initialize() );
52
53
if
(
m_rdpSvc
.retrieve().isFailure()) {
54
ATH_MSG_WARNING
(
" Can't get ByteStreamInputSvc interface Reading of ByteStream Data not possible. "
);
55
}
56
57
ATH_CHECK
(
m_tool
.retrieve() );
58
59
return
StatusCode::SUCCESS;
60
61
}
62
63
StatusCode
64
LArAccumulatedDigitContByteStreamCnv::createObjConst
(IOpaqueAddress* pAddr, DataObject*& pObj)
const
65
{
//Convert Accumulated Digits from ByteStream to StoreGate
66
ATH_MSG_VERBOSE
(
"Executing CreateObj method for LArAccumulatedDigitContainer "
);
67
68
if
(!
m_rdpSvc
) {
69
ATH_MSG_ERROR
(
" ROBDataProviderSvc not loaded. Can't read ByteStream."
);
70
return
StatusCode::FAILURE;
71
}
72
73
ByteStreamAddress
* pRE_Addr{};
74
ATH_CHECK
( (pRE_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
75
76
const
EventContext& ctx = pRE_Addr->
getEventContext
();
77
const
RawEvent
*
re
=
m_rdpSvc
->getEvent(ctx);
78
if
(!
re
) {
79
ATH_MSG_ERROR
(
"Could not get raw event from ByteStreamInputSvc"
);
80
return
StatusCode::FAILURE;
81
}
82
const
std::string& key = *(pAddr->par());
// Get key used in the StoreGateSvc::retrieve function
83
// get gain and pass to convert function.
84
CaloGain::CaloGain
gain=
CaloGain::LARNGAIN
;
//At this place, LARNGAINS means Automatic gain.
85
if
(key==
"HIGH"
)
86
gain=
CaloGain::LARHIGHGAIN
;
87
else
if
(key==
"MEDIUM"
)
88
gain=
CaloGain::LARMEDIUMGAIN
;
89
else
if
(key==
"LOW"
)
90
gain=
CaloGain::LARLOWGAIN
;
91
92
// Convert the RawEvent to LArAccumulatedDigitContainer
93
ATH_MSG_DEBUG
(
"Converting LArAccumulatedDigits (from ByteStream). key="
<< key <<
" ,gain="
<< gain );
94
LArAccumulatedDigitContainer
*DigitContainer=
new
LArAccumulatedDigitContainer
(
SG::VIEW_ELEMENTS
);
95
StatusCode
sc
=
m_tool
->convert(
re
,DigitContainer,gain);
96
if
(
sc
!=StatusCode::SUCCESS) {
97
ATH_MSG_WARNING
(
"Conversion tool returned an error. LArAccumulatedDigitContainer might be empty."
);
98
}
99
pObj =
SG::asStorable
(DigitContainer) ;
100
101
return
StatusCode::SUCCESS;
102
}
103
// IWS 19.07.2005
104
StatusCode
105
LArAccumulatedDigitContByteStreamCnv::createRepConst
(DataObject*
/*pObj*/
, IOpaqueAddress*&
/*pAddr*/
)
const
106
{
// convert LArAccumulatedDigits from StoreGate into ByteStream
107
ATH_MSG_ERROR
(
"CreateRep method of LArAccumulatedDigitContainer not implemented"
);
108
return
StatusCode::SUCCESS;
109
}
110
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_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:27
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:28
ByteStreamAddress.h
ByteStreamCnvSvcBase.h
CaloGain.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
IROBDataProviderSvc.h
LArAccumulatedDigitContByteStreamCnv.h
LArAccumulatedDigitContainer.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LArRawDataContByteStreamTool.h
Helper tool for conversion of raw data classes to/from LArByteStream.
RawEvent.h
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition
RawEvent.h:37
StoreGateSvc.h
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
LArAccumulatedDigitContByteStreamCnv::m_tool
ToolHandle< BYTESTREAMTOOL > m_tool
Definition
LArAccumulatedDigitContByteStreamCnv.h:54
LArAccumulatedDigitContByteStreamCnv::LArAccumulatedDigitContByteStreamCnv
LArAccumulatedDigitContByteStreamCnv(ISvcLocator *svcloc)
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:34
LArAccumulatedDigitContByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:49
LArAccumulatedDigitContByteStreamCnv::~LArAccumulatedDigitContByteStreamCnv
virtual ~LArAccumulatedDigitContByteStreamCnv()
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:44
LArAccumulatedDigitContByteStreamCnv::m_rdpSvc
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
Definition
LArAccumulatedDigitContByteStreamCnv.h:55
LArAccumulatedDigitContByteStreamCnv::storageType
static long storageType()
Definition
LArAccumulatedDigitContByteStreamCnv.h:50
LArAccumulatedDigitContByteStreamCnv::classID
static CLID classID()
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:40
LArAccumulatedDigitContByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:64
LArAccumulatedDigitContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
Definition
LArAccumulatedDigitContByteStreamCnv.cxx:105
LArAccumulatedDigitContainer
Container class for LArAccumulatedDigit.
Definition
LArAccumulatedDigitContainer.h:22
CaloGain::CaloGain
CaloGain
Definition
CaloGain.h:11
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition
CaloGain.h:18
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition
CaloGain.h:18
CaloGain::LARNGAIN
@ LARNGAIN
Definition
CaloGain.h:19
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition
CaloGain.h:18
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
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