ATLAS Offline Software
MdtCsmCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRDO/MdtCsm.h"
6 #include "GaudiKernel/MsgStream.h"
7 #include "GaudiKernel/ISvcLocator.h"
9 
10 
11 #include "MdtCsmCnv_p1.h"
12 #include <sstream>
13 
15  StoreGateSvc* detStore = nullptr;
16  if (!Gaudi::svcLocator()->existsService("DetectorStore")) return;
17  StatusCode sc = Gaudi::svcLocator()->service("DetectorStore", detStore);
18  if (sc != StatusCode::SUCCESS) { return;}
19  sc = detStore->retrieve(m_idHelper, "MDTIDHELPER");
20  if (sc != StatusCode::SUCCESS) {return; }
21  m_2CSM_Mod = m_idHelper->stationNameIndex("BME") != -1;
22 }
23 void
24 MdtCsmCnv_p1::persToTrans(const MdtCsm_p1* persColl, MdtCsm* transColl, MsgStream &log)
25 {
26  const Identifier mod_id{Identifier32(persColl->m_Id)};
27  IdentifierHash mod_hash{persColl->m_idHash};
28  if (m_idHelper) {
29  if (m_2CSM_Mod) m_idHelper->get_detectorElement_hash(mod_id,mod_hash);
30  else m_idHelper->get_module_hash(mod_id,mod_hash);
31  }
32  *transColl = MdtCsm (mod_id,
33  mod_hash,
34  persColl->m_SubDetId,
35  persColl->m_MrodId,
36  persColl->m_CsmId);
37  // The assignment above will leave *transColl as a view container.
38  // But it should own it's elements, so convert it back
39  // to an owning container.
40  transColl->clear (SG::OWN_ELEMENTS);
41 
42  // Invoke vector converter from the base template
43  MdtCsm_Cnvp1_base_t::persToTrans( persColl, transColl, log );
44 }
45 
46 
47 void
48 MdtCsmCnv_p1::transToPers(const MdtCsm* transColl, MdtCsm_p1* persColl, MsgStream &log)
49 {
50  // log << MSG::DEBUG << " *** Writing out MdtCsm" << endmsg;
51 
52  persColl->m_Id = transColl->identify().get_identifier32().get_compact();
53  persColl->m_idHash = transColl->identifyHash();
54 
55  persColl->m_SubDetId = transColl->SubDetId();
56  persColl->m_MrodId = transColl->MrodId();
57  persColl->m_CsmId = transColl->CsmId();
58 
59  // Invoke vector converter from the base template
60  MdtCsm_Cnvp1_base_t::transToPers( transColl, persColl, log );
61 
62 }
63 
64 
65 
66 
67 
68 
MdtCsm_p1::m_idHash
uint32_t m_idHash
Definition: MdtCsm_p1.h:25
MuonIdHelper::stationNameIndex
int stationNameIndex(const std::string &name) const
Definition: MuonIdHelper.cxx:846
MdtCsm::CsmId
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD)
Definition: MdtCsm.h:61
Identifier32
Definition: Identifier32.h:25
MdtCsm_p1::m_Id
uint32_t m_Id
Definition: MdtCsm_p1.h:24
MdtCsm
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current MdtCsm
Definition: MuonEventAthenaPoolTPCnv.cxx:123
MdtCsm_p1::m_MrodId
uint16_t m_MrodId
Definition: MdtCsm_p1.h:28
MdtCsm_p1::m_CsmId
uint16_t m_CsmId
Definition: MdtCsm_p1.h:29
TPCnvVector::persToTrans
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
MdtCsm::identify
Identifier identify() const
Returns the CSM offline identifier (chamber offline id)
Definition: MdtCsm.h:51
MdtCsmCnv_p1::m_2CSM_Mod
bool m_2CSM_Mod
Definition: MdtCsmCnv_p1.h:30
MdtCsm::SubDetId
uint16_t SubDetId() const
Returns the sub-detector Id.
Definition: MdtCsm.h:57
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition: MdtCsm.h:19
MdtCsmCnv_p1.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MdtCsm::MrodId
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Definition: MdtCsm.h:59
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
MdtCsm_p1
Definition: MdtCsm_p1.h:17
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
TPCnvVector::transToPers
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MdtCsmCnv_p1::MdtCsmCnv_p1
MdtCsmCnv_p1()
Definition: MdtCsmCnv_p1.cxx:14
MdtCsmCnv_p1::m_idHelper
const MdtIdHelper * m_idHelper
Definition: MdtCsmCnv_p1.h:29
DataVector::clear
void clear()
Erase all the elements in the collection.
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MdtCsm::identifyHash
IdentifierHash identifyHash() const
Returns the CSM offline identifier hash (chamber offline id)
Definition: MdtCsm.h:54
MdtCsmCnv_p1::persToTrans
virtual void persToTrans(const MdtCsm_p1 *persColl, MdtCsm *transColl, MsgStream &log)
Definition: MdtCsmCnv_p1.cxx:24
MdtCsm.h
MdtCsmCnv_p1::transToPers
virtual void transToPers(const MdtCsm *transColl, MdtCsm_p1 *persColl, MsgStream &log)
Definition: MdtCsmCnv_p1.cxx:48
MdtIdHelper::get_detectorElement_hash
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: MdtIdHelper.cxx:325
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MdtCsm_p1::m_SubDetId
uint16_t m_SubDetId
Definition: MdtCsm_p1.h:27
MdtIdHelper::get_module_hash
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: MdtIdHelper.cxx:318
IdentifierHash
Definition: IdentifierHash.h:38
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
StoreGateSvc.h