ATLAS Offline Software
MM_RawDataContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 
12 {
13 }
14 
16 
18  // Call base clase initialize
19  if( !MM_RawDataContainerCnvBase::initialize().isSuccess() )
20  return StatusCode::FAILURE;
21 
22  // Get the messaging service, print where you are
23  MsgStream log(msgSvc(), "MM_RawDataContainerCnv");
24  if (log.level() <= MSG::INFO) log << MSG::INFO << "MM_RawDataContainerCnv::initialize()" << endmsg;
25  // get DetectorStore service
26  ISvcLocator* svcLocator = Gaudi::svcLocator();
27 
29  StatusCode sc = svcLocator->service("DetectorStore", detStore);
30  if (sc.isFailure()) {
31  log << MSG::FATAL << "DetectorStore service not found !" << endmsg;
32  return StatusCode::FAILURE;
33  } else {
34  if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Found DetectorStore." << endmsg;
35  }
36 
37  // Get the helper from the detector store
38  const MmIdHelper *idHelper;
39  sc = detStore->retrieve(idHelper);
40  if (sc.isFailure()) {
41  log << MSG::FATAL << "Could not get ID helper !" << endmsg;
42  return StatusCode::FAILURE;
43  } else {
44  m_TPConverter_p1.initialize(idHelper);
45  m_TPConverter_p2.initialize(idHelper);
46  m_TPConverter_p3.initialize(idHelper);
47  if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Found the ID helper and passed to the TP convertor." << endmsg;
48  }
49 
50  return StatusCode::SUCCESS;
51 }
52 
54  MsgStream log(msgSvc(), "MM_RawDataContainerCnv" );
55  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
56  return m_TPConverter_p3.createPersistent( transCont, log );;
57 }
58 
61 {
62  using namespace Muon;
63  MsgStream log(msgSvc(), "MM_RawDataContainerCnv" );
64 
65  MM_RawDataContainer *transCont = nullptr;
66  static const pool::Guid p1_guid("5F202045-CE2C-4AD4-96BA-7DA18053B90F");
67  static const pool::Guid p2_guid("A49EBDAC-A190-4198-95DF-BF75FBBB487F");
68  static const pool::Guid p3_guid("229DDB7E-59D3-4BE5-B3D5-B873EBC5C9AA");
69 
70  if( compareClassGuid(p1_guid) ) {
71  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<std::endl;
72  std::unique_ptr< MM_RawDataContainer_p1 > cont( this->poolReadObject<MM_RawDataContainer_p1>() );
73  const MM_RawDataContainer_p1* constCont = cont.get();
74  transCont = m_TPConverter_p1.createTransient( constCont, log );
75  }
76  // ----------------------------------------------
77  // p2 has the relBCID included
78  else if( compareClassGuid(p2_guid) ) {
79  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<std::endl;
80  std::unique_ptr< MM_RawDataContainer_p2 > cont( this->poolReadObject<MM_RawDataContainer_p2>() );
81  const MM_RawDataContainer_p2* constCont = cont.get();
82  transCont = m_TPConverter_p2.createTransient( constCont, log );
83  }
84  // ----------------------------------------------
85  // p3 has timeAndChargeInCounts switch included
86  else if( compareClassGuid(p3_guid) ) {
87  if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<std::endl;
88  std::unique_ptr< MM_RawDataContainer_p3 > cont( this->poolReadObject<MM_RawDataContainer_p3>() );
89  const MM_RawDataContainer_p3* constCont = cont.get();
90  transCont = m_TPConverter_p3.createTransient( constCont, log );
91  }
92  // ----------------------------------------------
93  else {
94  throw std::runtime_error("Unsupported persistent version of MM Raw Data (RDO) container");
95  }
96  return transCont;
97 }
Muon::MM_RawDataContainerCnv_p2::initialize
void initialize(const MmIdHelper *idHelper)
Definition: MM_RawDataContainerCnv_p2.cxx:77
Muon::MM_RawDataContainerCnv_p2::createTransient
virtual Muon::MM_RawDataContainer * createTransient(const Muon::MM_RawDataContainer_p2 *persObj, MsgStream &log) override final
Definition: MM_RawDataContainerCnv_p2.cxx:66
MM_RawDataContainerCnv::MM_RawDataContainerCnv
MM_RawDataContainerCnv(ISvcLocator *svcloc)
Definition: MM_RawDataContainerCnv.cxx:10
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
Muon::MM_RawDataContainerCnv_p3::createTransient
virtual Muon::MM_RawDataContainer * createTransient(const Muon::MM_RawDataContainer_p3 *persObj, MsgStream &log) override final
Definition: MM_RawDataContainerCnv_p3.cxx:66
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
Muon::MM_RawDataContainer_p2
Definition: MM_RawDataContainer_p2.h:14
Muon::MM_RawDataContainer
Definition: MM_RawDataContainer.h:18
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MM_RawDataContainerCnv::~MM_RawDataContainerCnv
virtual ~MM_RawDataContainerCnv()
MM_RawDataContainerCnv.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
Muon::MM_RawDataContainerCnv_p3::initialize
void initialize(const MmIdHelper *idHelper)
Definition: MM_RawDataContainerCnv_p3.cxx:77
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
MmIdHelper.h
Muon::MM_RawDataContainer_p1
Definition: MM_RawDataContainer_p1.h:14
MM_RawDataContainerCnv::m_TPConverter_p1
Muon::MM_RawDataContainerCnv_p1 m_TPConverter_p1
Definition: MM_RawDataContainerCnv.h:33
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MM_RawDataContainerCnv::createTransient
virtual Muon::MM_RawDataContainer * createTransient()
Definition: MM_RawDataContainerCnv.cxx:60
MM_RawDataContainerCnv::m_TPConverter_p2
Muon::MM_RawDataContainerCnv_p2 m_TPConverter_p2
Definition: MM_RawDataContainerCnv.h:34
MM_RawDataContainerCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: MM_RawDataContainerCnv.cxx:17
MmIdHelper
Definition: MmIdHelper.h:54
Muon::MM_RawDataContainerCnv_p1::createTransient
virtual Muon::MM_RawDataContainer * createTransient(const Muon::MM_RawDataContainer_p1 *persObj, MsgStream &log) override final
Definition: MM_RawDataContainerCnv_p1.cxx:66
MM_RawDataContainerCnv::m_TPConverter_p3
Muon::MM_RawDataContainerCnv_p3 m_TPConverter_p3
Definition: MM_RawDataContainerCnv.h:35
DEBUG
#define DEBUG
Definition: page_access.h:11
MM_RawDataContainerCnv::createPersistent
virtual MM_RawDataContainer_PERS * createPersistent(Muon::MM_RawDataContainer *transCont)
Definition: MM_RawDataContainerCnv.cxx:53
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::MM_RawDataContainerCnv_p1::initialize
void initialize(const MmIdHelper *idHelper)
Definition: MM_RawDataContainerCnv_p1.cxx:77
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
Muon::MM_RawDataContainer_p3
Definition: MM_RawDataContainer_p3.h:14