ATLAS Offline Software
CscRawDataContainerCnv.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 #include <TString.h> // for Form
7 
10  if (sc!=StatusCode::SUCCESS) return sc;
11  std::cout << "CscRawDataContainerCnv::initialize" << std::endl;
12  // pass the IMuonIdHelperSvc to the CscRawDataCnv (needed for p2/p3 to translate between geometrical and positional hashes)
13  SmartIF<Muon::IMuonIdHelperSvc> idHelp = serviceLocator()->service<Muon::IMuonIdHelperSvc>( "MuonIdHelperSvc" );
14  if (!idHelp.isValid()) throw std::runtime_error(Form("File: %s, Line: %d\nCscRawDataContainerCnv::initialize() - No valid MuonIdHelperSvc present (needed for channel hash conversion)", __FILE__, __LINE__));
15  this->m_TPconverter.m_elementCnv.m_elementCnv.setMuonIdHelperSvc(idHelp.get());
16  // ^ ^ ^
17  // | | |
18  // TPCnvIDCont TPCnvVector CscRawDataCnv_p4
19 
20  // do the same for p1-p3
21  m_converter_p1.m_elementCnv.m_elementCnv.setMuonIdHelperSvc(idHelp.get());
22  m_converter_p2.m_elementCnv.m_elementCnv.setMuonIdHelperSvc(idHelp.get());
23  m_converter_p3.m_elementCnv.m_elementCnv.setMuonIdHelperSvc(idHelp.get());
24  return StatusCode::SUCCESS;
25 }
26 
28 {
29  MsgStream log(msgSvc(), "CscRawDataContainerCnv" );
30  if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " **** Entered createTransient() "<< endmsg;
31 
32  // the use of auto pointers ensures that the persistent object is deleted
33  // using the correct persistent type pointer
34 
35  CscRawDataContainer * trans_cont = nullptr;
36 
37  static const pool::Guid p4_guid("F94905BF-D474-4453-B9D0-80ECB7BA4041");
38  static const pool::Guid p3_guid("A77330FB-BD12-4E50-829C-DADFBF556119");
39  static const pool::Guid p2_guid("19221A0D-4167-4A1C-BE2A-EE335D7C9D5F");
40  static const pool::Guid p1_guid("3586FE6B-0504-4E78-BD9F-AF839C50F931");
41  static const pool::Guid p0_guid("D7600810-31BC-4344-A3C6-9C59F47E5551");
42 
43  if( compareClassGuid(p4_guid) ) {
44  // from this version onwards, the CSC identifier hashes are actually the position of the identifiers in the vector of identifiers
45  // thus, no conversion inside CscRawDataCnv_p... is needed anymore
46  std::unique_ptr< CscRawDataContainer_p4 > col_vect( poolReadObject< CscRawDataContainer_p4 >() );
47  trans_cont = m_TPconverter.createTransient( col_vect.get(), log );
48  } else if( compareClassGuid(p3_guid) ) {
49  std::unique_ptr< CscRawDataContainer_p3 > col_vect( poolReadObject< CscRawDataContainer_p3 >() );
50  trans_cont = m_converter_p3.createTransient( col_vect.get(), log );
51  } else if( compareClassGuid(p2_guid) ) {
52  std::unique_ptr< CscRawDataContainer_p2 > col_vect( poolReadObject< CscRawDataContainer_p2 >() );
53  trans_cont = m_converter_p2.createTransient( col_vect.get(), log );
54  } else if( compareClassGuid(p1_guid) ) {
55  std::unique_ptr< CscRawDataContainer_p1 > col_vect( poolReadObject< CscRawDataContainer_p1 >() );
56  trans_cont = m_converter_p1.createTransient( col_vect.get(), log );
57  }
58  else if( compareClassGuid(p0_guid) ) {
59  // old version from before TP separation
60  std::unique_ptr< COLL_vector > col_vect( this->poolReadObject< COLL_vector >() );
61  trans_cont = createTransientFrom_p0( col_vect.get(), log );
62  }
63  else {
64  throw std::runtime_error("Unsupported persistent version of CSC RDO container");
65  }
66  return trans_cont;
67 }
TPCnvIDCont::m_elementCnv
CONV m_elementCnv
the TP converter used for vector elements
Definition: TPConverter.h:1348
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
MuonRdoContainerTPCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CscRawDataContainerCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: CscRawDataContainerCnv.cxx:8
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
CscRawDataContainerCnv::m_converter_p2
CscRawDataContainerCnv_p2 m_converter_p2
Definition: CscRawDataContainerCnv.h:38
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
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
CscRawDataContainerCnv::m_converter_p1
CscRawDataContainerCnv_p1 m_converter_p1
Definition: CscRawDataContainerCnv.h:37
CscRawDataContainerCnv::m_converter_p3
CscRawDataContainerCnv_p3 m_converter_p3
Definition: CscRawDataContainerCnv.h:39
MuonRdoContainerTPCnv::createTransientFrom_p0
virtual T * createTransientFrom_p0(COLL_vector *persObj, MsgStream &log)
CscRawDataContainerCnv::createTransient
virtual CscRawDataContainer * createTransient()
Definition: CscRawDataContainerCnv.cxx:27
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CscRawDataContainer
This container provides access to collections of CSC RDOs and a mechanism for recording them.
Definition: CscRawDataContainer.h:23
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:26
MuonRdoContainerTPCnv::m_TPconverter
CONV m_TPconverter
convertor
Definition: MuonRdoContainerTPCnv.h:45
T_AthenaPoolCustCnv< T, P >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
CscRawDataContainerCnv.h