ATLAS Offline Software
LArDigitContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArDigitContainerCnv.h"
14 #include <memory>
15 
16 
18  LArDigitContainerCnvBase(svcLoc, "LArDigitContainerCnv"),
19  m_p0_guid("B15FFDA0-206D-4062-8B5F-582A1ECD5502"),
20  m_p1_guid("F1876026-CDFE-4110-AA59-E441BAA5DE44"),
21  m_p2_guid("66F5B7Af-595C-4F79-A2B7-56590777C313"),
22  m_p3_guid("24480EBA-1AF1-4646-95A7-11285F09717C"),
23  m_storeGateSvc("StoreGateSvc", "LArDigitContainerCnv")
24 {}
25 
26 
28 
29  const LArOnlineID* idHelper=nullptr;
30  ATH_CHECK( detStore()->retrieve(idHelper,"LArOnlineID") );
31  m_idHelper=idHelper;//cast to base-class
32 
33  const LArOnline_SuperCellID* idSCHelper=nullptr;
34  ATH_CHECK( detStore()->retrieve(idSCHelper,"LArOnline_SuperCellID") );
35  m_idSCHelper=idSCHelper;//cast to base-class
36 
37  ATH_CHECK( m_storeGateSvc.retrieve() );
38 
40 }
41 
42 
44  ATH_MSG_DEBUG("Writing LArDigitContainer_p3");
47  converter.transToPers(trans, pers, msg());
48  return pers;
49 }
50 
51 
53 
55  ATH_MSG_DEBUG("Read version p0 of LArDigitContainer. GUID=" << m_classID.toString());
56  return poolReadObject<LArDigitContainer>();
57  }
58  else if (compareClassGuid(m_p1_guid)) {
59  ATH_MSG_DEBUG("Reading LArDigitContainer_p1. GUID=" << m_classID.toString());
61  std::unique_ptr<LArDigitContainer_p1> pers(poolReadObject<LArDigitContainer_p1>());
62  LArDigitContainerCnv_p1 converter;
63  converter.persToTrans(pers.get(), trans, msg());
64  return trans;
65  }
66  else if (compareClassGuid(m_p2_guid)) {
67  ATH_MSG_DEBUG("Reading LArDigitContainer_p2. GUID=" << m_classID.toString());
69  std::unique_ptr<LArDigitContainer_p2> pers(poolReadObject<LArDigitContainer_p2>());
71  converter.persToTrans(pers.get(), trans, msg());
72  return trans;
73  }
74  else if (compareClassGuid(m_p3_guid)) {
75  ATH_MSG_DEBUG("Reading LArDigitContainer_p3. GUID=" << m_classID.toString());
77  std::unique_ptr<LArDigitContainer_p3> pers(poolReadObject<LArDigitContainer_p3>());
79  converter.persToTrans(pers.get(), trans, msg());
80  return trans;
81  }
82  ATH_MSG_ERROR("Unsupported persistent version of LArDigitContainer. GUID=" << m_classID.toString());
83  throw std::runtime_error("Unsupported persistent version of Data Collection");
84  // not reached
85 }
LArDigitContainerCnv_p3::transToPers
virtual void transToPers(const LArDigitContainer *trans, LArDigitContainer_p3 *pers, MsgStream &log) const override
Definition: LArDigitContainerCnv_p3.cxx:82
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArDigitContainerCnv_p2::persToTrans
virtual void persToTrans(const LArDigitContainer_p2 *pers, LArDigitContainer *trans, MsgStream &log) const override
Definition: LArDigitContainerCnv_p2.cxx:37
T_AthenaPoolCustCnv::m_classID
Guid m_classID
Definition: T_AthenaPoolCustCnv.h:96
LArDigitContainerCnv_p1.h
LArDigitContainerCnv_p3
Definition: LArDigitContainerCnv_p3.h:17
LArDigitContainerCnv.h
LArDigitContainerCnv_p1
Definition: LArDigitContainerCnv_p1.h:16
Guid::toString
const std::string toString() const
Automatic conversion to string representation.
Definition: Guid.cxx:58
LArDigitContainerCnv::LArDigitContainerCnv
LArDigitContainerCnv(ISvcLocator *)
Definition: LArDigitContainerCnv.cxx:17
LArDigitContainerCnv::initialize
StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: LArDigitContainerCnv.cxx:27
LArDigitContainerCnv::createTransient
virtual LArDigitContainer * createTransient()
Definition: LArDigitContainerCnv.cxx:52
LArDigitContainerCnv_p3::persToTrans
virtual void persToTrans(const LArDigitContainer_p3 *pers, LArDigitContainer *trans, MsgStream &log) const override
Definition: LArDigitContainerCnv_p3.cxx:43
LArDigitContainerCnv::m_p3_guid
pool::Guid m_p3_guid
Definition: LArDigitContainerCnv.h:33
LArDigitContainer_p3.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArDigitContainerCnv::createPersistent
virtual LArDigitContainerPERS * createPersistent(LArDigitContainer *)
Definition: LArDigitContainerCnv.cxx:43
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
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
LArDigitContainerPERS
LArDigitContainer_p3 LArDigitContainerPERS
Definition: LArDigitContainerCnv.h:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArDigitContainer_p2.h
AthenaPoolConverter::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Handle to DetectorStore.
Definition: AthenaPoolConverter.h:69
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
LArDigitContainerCnv::m_p1_guid
pool::Guid m_p1_guid
Definition: LArDigitContainerCnv.h:31
LArDigitContainerCnv::m_storeGateSvc
ServiceHandle< StoreGateSvc > m_storeGateSvc
Definition: LArDigitContainerCnv.h:36
LArDigitContainer_p1.h
LArOnlineID
Definition: LArOnlineID.h:20
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
LArDigitContainerCnv_p1::persToTrans
virtual void persToTrans(const LArDigitContainer_p1 *pers, LArDigitContainer *trans, MsgStream &log) const override
Definition: LArDigitContainerCnv_p1.cxx:13
LArDigitContainerCnv_p2.h
LArDigitContainerCnv_p3.h
LArDigitContainerCnv::m_p0_guid
pool::Guid m_p0_guid
Definition: LArDigitContainerCnv.h:30
LArDigitContainerCnv::m_idHelper
const LArOnlineID_Base * m_idHelper
Definition: LArDigitContainerCnv.h:34
LArDigitContainer
Container class for LArDigit.
Definition: LArDigitContainer.h:24
LArDigitContainerCnv::m_p2_guid
pool::Guid m_p2_guid
Definition: LArDigitContainerCnv.h:32
LArOnline_SuperCellID.h
LArDigitContainerCnv::m_idSCHelper
const LArOnlineID_Base * m_idSCHelper
Definition: LArDigitContainerCnv.h:35
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
LArDigitContainer_p3
Definition: LArDigitContainer_p3.h:10
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
LArOnlineID.h
LArDigitContainerCnv_p2
Definition: LArDigitContainerCnv_p2.h:16