ATLAS Offline Software
TgcPrepDataContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // Gaudi
8 #include "GaudiKernel/StatusCode.h"
9 #include "GaudiKernel/MsgStream.h"
10 
11 // Athena
12 #include "StoreGate/StoreGateSvc.h"
13 
14 // Id includes
18 
21 {
22 }
23 
25 
27  // Call base clase initialize
28  if( !TgcPrepDataContainerCnvBase::initialize().isSuccess() )
29  return StatusCode::FAILURE;
30 
31 // msgSvc()->setOutputLevel( "TgcPrepDataContainerCnv", MSG::DEBUG );
32 
33  // Get the messaging service, print where you are
34  MsgStream log(msgSvc(), "TgcPrepDataContainerCnv");
35  if (log.level() <= MSG::INFO) log << MSG::INFO << "TgcPrepDataContainerCnv::initialize()" << endmsg;
36 
37  return StatusCode::SUCCESS;
38 }
39 
41  MsgStream log(msgSvc(), "TgcPrepDataContainerCnv" );
42  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
44  return pers;
45 }
46 
48  MsgStream log(msgSvc(), "TgcPrepDataContainerCnv" );
49  static const pool::Guid p0_guid("04E7158E-416B-8E31-D370-616631B8617E"); // before t/p split
50  static const pool::Guid p1_guid("8C563637-620B-43A0-9A5D-E0BC09496745"); // with TgcPrepData_tlp1
51  static const pool::Guid p2_guid("EBB4DCEC-CE23-4A30-BEF7-F3150E4060CB"); // with TgcPrepDataContainerCnv_p2
52  static const pool::Guid p3_guid("215726D6-15F4-41D2-B808-1B9E9FD84166"); // with TgcPrepDataContainerCnv_p3
53 
54 
55  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg;
56  Muon::TgcPrepDataContainer* p_collection(nullptr);
57  if( compareClassGuid(p3_guid) ) {
58  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<endmsg;
59  std::unique_ptr< Muon::TgcPrepDataContainer_p3 > p_coll( poolReadObject< Muon::TgcPrepDataContainer_p3 >() );
60  p_collection = m_converter_p3.createTransient( p_coll.get(), log );
61  } else if( compareClassGuid(p2_guid) ) {
62  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg;
63  std::unique_ptr< Muon::TgcPrepDataContainer_p2 > p_coll( poolReadObject< Muon::TgcPrepDataContainer_p2 >() );
64  p_collection = m_converter_p2.createTransient( p_coll.get(), log );
65  } else if( compareClassGuid(p1_guid) ) {
66  TgcPrepDataContainerCnv_tlp1 tpConvertor_p1;
67  std::unique_ptr< Muon::TgcPrepDataContainer_tlp1 > col_vect( poolReadObject< Muon::TgcPrepDataContainer_tlp1 >() );
68  p_collection = m_TPConverter.createTransient( col_vect.get(), log );
69  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg;
70  }
71  //----------------------------------------------------------------
72  else if( compareClassGuid(p0_guid) ) {
73  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): Old input file"<<std::endl;
74  throw std::runtime_error("Not currently supporting reading non TP-split PRDs");
75  //std::unique_ptr< TgcPrepDataContainer_p0 > col_vect( poolReadObject< TgcPrepDataContainer_p0 >() );
76  //p_collection = m_converter_p0.createTransient( col_vect.get(), log );
77  }
78  else {
79  throw std::runtime_error("Unsupported persistent version of TgcPrepDataContainer");
80 
81  }
82  return p_collection;
83 }
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
TgcPrepDataContainerCnv::m_converter_p2
Muon::TgcPrepDataContainerCnv_p2 m_converter_p2
Definition: TgcPrepDataContainerCnv.h:47
TgcPrepDataContainerCnv::TgcPrepDataContainerCnv
TgcPrepDataContainerCnv(ISvcLocator *svcloc)
Definition: TgcPrepDataContainerCnv.cxx:19
TgcPrepDataContainerCnv.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
TgcPrepDataContainerCnv::m_TPConverter
TgcPrepDataContainerCnv_tlp1 m_TPConverter
Definition: TgcPrepDataContainerCnv.h:48
TgcPrepDataContainerCnv::m_converter_p3
Muon::TgcPrepDataContainerCnv_p3 m_converter_p3
Definition: TgcPrepDataContainerCnv.h:46
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TgcPrepDataContainer.h
TgcPrepDataContainerCnv::~TgcPrepDataContainerCnv
virtual ~TgcPrepDataContainerCnv()
Muon::MuonPRD_Container_p2
Class to contain the Muon Prep Raw Data.
Definition: MuonPRD_Container_p2.h:26
TgcPrepDataContainerCnv::createTransient
virtual Muon::TgcPrepDataContainer * createTransient()
Definition: TgcPrepDataContainerCnv.cxx:47
Muon::TgcPrepDataContainerCnv_p3::createTransient
virtual Muon::TgcPrepDataContainer * createTransient(const Muon::TgcPrepDataContainer_p3 *persObj, MsgStream &log)
Definition: TgcPrepDataContainerCnv_p3.cxx:222
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::TgcPrepDataContainerCnv_p2::createTransient
virtual Muon::TgcPrepDataContainer * createTransient(const Muon::TgcPrepDataContainer_p2 *persObj, MsgStream &log)
Definition: TgcPrepDataContainerCnv_p2.cxx:218
TgcPrepDataContainerCnv::createPersistent
virtual TgcPrepDataContainer_PERS * createPersistent(Muon::TgcPrepDataContainer *transCont)
Definition: TgcPrepDataContainerCnv.cxx:40
TgcReadoutElement.h
TgcIdHelper.h
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
TgcPrepDataContainerCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: TgcPrepDataContainerCnv.cxx:26
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
StoreGateSvc.h
TgcPrepDataContainerCnv_tlp1
Definition: TgcPrepDataContainerCnv_tlp1.h:23