ATLAS Offline Software
LArTTL1ContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Framework includes
6 #include "GaudiKernel/MsgStream.h"
7 
8 // LArTPCnv includes
10 
11 // LArEventAthenaPool includes
12 #include "LArTTL1ContainerCnv.h"
13 
16 {
17  MsgStream msg( msgSvc(), "LArTTL1ContainerCnv" );
18 
20  LArTTL1Container_PERS *persObj = cnv.createPersistent( transCont, msg );
21 
22  if (msg.level()<=MSG::DEBUG)
23  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
24  return persObj;
25 }
26 
28 
29  MsgStream msg( msgSvc(), "LArTTL1ContainerCnv" );
30 
31  LArTTL1Container *transObj = 0;
32 
33  static const pool::Guid tr_guid("38FAECC7-D0C5-4DD8-8FAE-8D35F0542ECD");
34  static const pool::Guid p1_guid("b859a463-2ea4-4902-b46a-89e5fbc20132");
35 
36  if ( compareClassGuid(tr_guid) ) {
37 
38  // regular object from before the T/P separation
39  return poolReadObject<LArTTL1Container>();
40 
41  } else if ( compareClassGuid(p1_guid) ) {
42 
43  // using unique_ptr ensures deletion of the persistent object
44  std::unique_ptr<LArTTL1Container_p1> persObj( poolReadObject<LArTTL1Container_p1>() );
46  transObj = cnv.createTransient( persObj.get(), msg );
47  } else {
48  throw std::runtime_error("Unsupported persistent version of LArTTL1Container");
49  }
50 
51  return transObj;
52 }
LArTTL1Container_p1
Definition: LArTTL1Container_p1.h:12
LArTTL1ContainerCnv_p1.h
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArTTL1ContainerCnv::createTransient
virtual LArTTL1Container * createTransient()
Build the transient representation from a persistent one.
Definition: LArTTL1ContainerCnv.cxx:27
LArTTL1Container
Container class for LArTTL1.
Definition: LArTTL1Container.h:24
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
DEBUG
#define DEBUG
Definition: page_access.h:11
LArTTL1ContainerCnv::createPersistent
virtual LArTTL1Container_PERS * createPersistent(LArTTL1Container *transCont)
Build the persistent representation from the transient one.
Definition: LArTTL1ContainerCnv.cxx:15
LArTTL1ContainerCnv.h
TPCnvVector
Definition: TPConverter.h:1256
T_AthenaPoolCustCnv< LArTTL1Container, LArTTL1Container_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.