ATLAS Offline Software
CscPrepDataContainerCnv.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
15 // #include "MuonIdHelpers/CscIdHelper.h"
18 
19 
22 {
23 }
24 
26 
28  // Call base clase initialize
29  if( !CscPrepDataContainerCnvBase::initialize().isSuccess() )
30  return StatusCode::FAILURE;
31 
32  // msgSvc()->setOutputLevel( "CscPrepDataContainerCnv", MSG::DEBUG );
33 
34  // Get the messaging service, print where you are
35  MsgStream log(msgSvc(), "CscPrepDataContainerCnv");
36  if (log.level() <= MSG::INFO) log << MSG::INFO << "CscPrepDataContainerCnv::initialize()" << endmsg;
37 
38  return StatusCode::SUCCESS;
39 }
40 
42  MsgStream log(msgSvc(), "CscPrepDataContainerCnv" );
43  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
45  // COMPRESS CscPrepDataContainer_PERS *pers= m_converter_p2.createPersistent( transCont, log );
46  return pers;
47 }
48 
50  MsgStream log(msgSvc(), "CscPrepDataContainerCnv" );
51  static const pool::Guid p0_guid("C48250B1-7575-DFA1-1313-01AAAF759AEA"); // before t/p split
52  static const pool::Guid p1_guid("B941657D-1ABF-4A88-B23C-6C4212CD04B3"); // with CscPrepData_tlp1
53  static const pool::Guid p2_guid("BF5DA875-6D5B-4DCA-9CD8-E0ABC4FD92F5"); // with CscPrepDataContainer_p2
54  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg;
55  Muon::CscPrepDataContainer* p_collection(nullptr);
56  if( compareClassGuid(p2_guid) ) {
57  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg;
58  std::unique_ptr< Muon::CscPrepDataContainer_p2 > p_coll( poolReadObject< Muon::CscPrepDataContainer_p2 >() );
59  p_collection = m_converter_p2.createTransient( p_coll.get(), log );
60  } else if( compareClassGuid(p1_guid) ) {
61  CscPrepDataContainerCnv_tlp1 tpConvertor_p1;
62  std::unique_ptr< Muon::CscPrepDataContainer_tlp1 > col_vect( poolReadObject< Muon::CscPrepDataContainer_tlp1 >() );
63  p_collection = m_TPConverter.createTransient( col_vect.get(), log );
64  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg;
65  }
66  //----------------------------------------------------------------
67  else if( compareClassGuid(p0_guid) ) {
68  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): Old input file"<<std::endl;
69  throw std::runtime_error("Not currently supporting reading non TP-split PRDs");
70  //std::unique_ptr< CscPrepDataContainer_p0 > col_vect( poolReadObject< CscPrepDataContainer_p0 >() );
71  //p_collection = m_converter_p0.createTransient( col_vect.get(), log );
72  }
73  else {
74  throw std::runtime_error("Unsupported persistent version of CscPrepDataContainer");
75 
76  }
77  return p_collection;
78 }
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
Muon::CscPrepDataContainerCnv_p2::createTransient
virtual Muon::CscPrepDataContainer * createTransient(const Muon::CscPrepDataContainer_p2 *persObj, MsgStream &log)
Definition: CscPrepDataContainerCnv_p2.cxx:244
CscPrepDataContainerCnv_tlp1
Definition: CscPrepDataContainerCnv_tlp1.h:23
CscPrepDataContainerCnv::m_TPConverter
CscPrepDataContainerCnv_tlp1 m_TPConverter
Definition: CscPrepDataContainerCnv.h:44
CscPrepDataContainerCnv_tlp1.h
CscPrepDataContainerCnv.h
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
CscPrepDataContainerCnv::~CscPrepDataContainerCnv
virtual ~CscPrepDataContainerCnv()
CscPrepDataContainerCnv::CscPrepDataContainerCnv
CscPrepDataContainerCnv(ISvcLocator *svcloc)
Definition: CscPrepDataContainerCnv.cxx:20
CscPrepDataContainer.h
CscPrepDataContainerCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: CscPrepDataContainerCnv.cxx:27
CscPrepDataContainerCnv::createTransient
virtual Muon::CscPrepDataContainer * createTransient()
Definition: CscPrepDataContainerCnv.cxx:49
Muon::CscPrepDataContainer_tlp1
Definition: CscPrepDataContainer_tlp1.h:24
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CscPrepDataContainerCnv::m_converter_p2
Muon::CscPrepDataContainerCnv_p2 m_converter_p2
Definition: CscPrepDataContainerCnv.h:43
TopLevelTPConverter::createPersistent
virtual TL_PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of transObj.
Definition: TopLevelTPConverter.h:110
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
StoreGateSvc.h
CscPrepDataContainerCnv::createPersistent
virtual CscPrepDataContainer_PERS * createPersistent(Muon::CscPrepDataContainer *transCont)
Definition: CscPrepDataContainerCnv.cxx:41