ATLAS Offline Software
Loading...
Searching...
No Matches
LArFebHeaderContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9
15
17
19
20//STL-Stuff
21#include <map>
22#include <iostream>
23
24
26 AthConstConverter(storageType(), classID(),svcloc,"LArFebHeaderContByteStreamCnv"),
27 m_tool("LArRawDataContByteStreamTool"),
28 m_rdpSvc("ROBDataProviderSvc", name())
29{}
30
34
35
36StatusCode
38{
39 ATH_CHECK( AthConstConverter::initialize() );
40
41 if ( m_rdpSvc.retrieve().isFailure()) {
42 ATH_MSG_WARNING( " Can't get ByteStreamInputSvc interface Reading of ByteStream Data not possible. " );
43 }
44
45 ATH_CHECK( m_tool.retrieve() );
46
47 return StatusCode::SUCCESS;
48}
49
50
51StatusCode LArFebHeaderContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
52{//Convert Digits from ByteStream to StoreGate
53 ATH_MSG_VERBOSE( "Executing CreateObj method for LArFebHeaderContainer " );
54
55 if (!m_rdpSvc) {
56 ATH_MSG_ERROR( " ROBDataProviderSvc not loaded. Can't read ByteStream." );
57 return StatusCode::FAILURE;
58 }
59 ByteStreamAddress *pRE_Addr;
60 pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr); //Cast from OpaqueAddress to ByteStreamAddress
61 if (!pRE_Addr) {
62 ATH_MSG_ERROR( "dynamic_cast of OpaqueAdress to ByteStreamAddress failed!" );
63 return StatusCode::FAILURE;
64 }
65
66 const RawEvent* re = m_rdpSvc->getEvent(Gaudi::Hive::currentContext());
67 if (!re) {
68 ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
69 return StatusCode::FAILURE;
70 }
71
72 // Convert the RawEvent to LArFebHeaderContainer
73 ATH_MSG_DEBUG( "Converting LArFebHeaders (from ByteStream)." );
74 LArFebHeaderContainer *febHeaderContainer=new LArFebHeaderContainer;
75 StatusCode sc=m_tool->convert(re,febHeaderContainer,(CaloGain::CaloGain)0);
76 if (sc!=StatusCode::SUCCESS) {
77 ATH_MSG_WARNING( "Conversion tool returned an error. LArFebHeaderContainer might be empty." );
78 }
79
80 pObj = SG::asStorable(febHeaderContainer) ;
81
82 return StatusCode::SUCCESS;
83}
84
85StatusCode LArFebHeaderContByteStreamCnv::createRepConst(DataObject* /*pObj*/, IOpaqueAddress*& /*pAddr*/) const
86{// convert LArFebHeaders from StoreGate into ByteStream
87 ATH_MSG_ERROR( "CreateRep method of LArFebHeaderContainer not implemented!" );
88 return StatusCode::SUCCESS;
89}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
macros to associate a CLID to a type
uint32_t CLID
The Class ID type.
static Double_t sc
Helper tool for conversion of raw data classes to/from LArByteStream.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
const std::string & name() const
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Container class for LArFebHeader.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)