ATLAS Offline Software
Loading...
Searching...
No Matches
LArLATOMEHeaderContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "GaudiKernel/DataObject.h"
10#include "GaudiKernel/IRegistry.h"
12// For LATOME while no Condition alg exists
13#include "LArLATOMEROBIDs.h"
14
16 AthConstConverter(storageType(), classID(),svcloc,"LArLATOMEHeaderContByteStreamCnv"),
17 m_scTool("LArLATOMEDecoder"),
18 m_rdpSvc("ROBDataProviderSvc", name()) {};
19
20
22
26
27
28StatusCode
30 ATH_MSG_DEBUG("initialize ");
31 ATH_CHECK( AthConstConverter::initialize());
32 ATH_CHECK( m_rdpSvc.retrieve());
33 ATH_CHECK( m_scTool.retrieve());
34 return StatusCode::SUCCESS;
35}
36
37StatusCode
38LArLATOMEHeaderContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const {
39 ATH_MSG_VERBOSE("Executing CreateObj method for LArLATOMEHeaderContainer");
40
41 ByteStreamAddress *pRE_Addr= dynamic_cast<ByteStreamAddress*>(pAddr); //Cast from OpaqueAddress to ByteStreamAddress
42 if (!pRE_Addr)
43 {ATH_MSG_ERROR("dynamic_cast of OpaqueAdress to ByteStreamAddress failed!");
44 return StatusCode::FAILURE;
45 }
46
47 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> robFrags;
48 m_rdpSvc->getROBData(Gaudi::Hive::currentContext(), LArByteStream::s_allROBIDs_LATOME, robFrags );
49 const std::string& key = *(pAddr->par()); // Get key used in the StoreGateSvc::retrieve function
50 // get gain and pass to convert function.
51 std::unique_ptr<LArLATOMEHeaderContainer> header_coll=std::make_unique<LArLATOMEHeaderContainer>();
52
53 // Convert the RawEvent to LArDigitContainer
54 ATH_MSG_VERBOSE("Converting LATOME_HEADER (from ByteStream). key=" << key);
55
56
57 //Supercell readout
58 StatusCode sc=m_scTool->convert(robFrags,nullptr,nullptr, nullptr, nullptr, nullptr, header_coll.get());
59 if (sc!=StatusCode::SUCCESS) {
60 ATH_MSG_WARNING("Conversion tool returned an error. LAr SC containers might be empty.");
61 }
62 pObj = SG::asStorable(std::move(header_coll));
63
64 return StatusCode::SUCCESS;
65
66}
67
68 StatusCode
69LArLATOMEHeaderContByteStreamCnv::createRepConst(DataObject* , IOpaqueAddress*& ) const
70{
71 return StatusCode::SUCCESS;
72}
#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.
Byte stream converter of LATOME.
static Double_t sc
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.
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
static const std::vector< uint32_t > s_allROBIDs_LATOME
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)