ATLAS Offline Software
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"
11 #include "AthenaKernel/CLASS_DEF.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 
25 }
26 
27 
30  ATH_MSG_DEBUG("initialize ");
32  ATH_CHECK( m_rdpSvc.retrieve());
33  ATH_CHECK( m_scTool.retrieve());
34  return StatusCode::SUCCESS;
35 }
36 
38 LArLATOMEHeaderContByteStreamCnv::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
69 LArLATOMEHeaderContByteStreamCnv::createRepConst(DataObject* , IOpaqueAddress*& ) const
70 {
71  return StatusCode::SUCCESS;
72 }
LArLATOMEHeaderContByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:29
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArLATOMEHeaderContByteStreamCnv::m_scTool
ToolHandle< LArLATOMEDecoder > m_scTool
Definition: LArLATOMEHeaderContByteStreamCnv.h:43
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthConstConverter
Gaudi converter base class with const interfaces.
Definition: AthConstConverter.h:33
LArLATOMEROBIDs.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
LArLATOMEHeaderContByteStreamCnv::classID
static const CLID & classID()
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:23
LArLATOMEHeaderContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:69
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArLATOMEHeaderContByteStreamCnv::m_rdpSvc
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
Definition: LArLATOMEHeaderContByteStreamCnv.h:44
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
LArLATOMEHeaderContByteStreamCnv::~LArLATOMEHeaderContByteStreamCnv
virtual ~LArLATOMEHeaderContByteStreamCnv()
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArLATOMEHeaderContByteStreamCnv.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArLATOMEDecoder.h
Byte stream converter of LATOME.
CLASS_DEF.h
macros to associate a CLID to a type
LArLATOMEHeaderContByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:38
LArLATOMEHeaderContByteStreamCnv::LArLATOMEHeaderContByteStreamCnv
LArLATOMEHeaderContByteStreamCnv(ISvcLocator *svcloc)
Definition: LArLATOMEHeaderContByteStreamCnv.cxx:15
IROBDataProviderSvc.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37