ATLAS Offline Software
InDetSimDataCnv_p3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "MsgUtil.h"
7 
8 // Persistent class and converter header file
10 #include "InDetSimDataCnv_p3.h"
12 
13 
14 using depositIterator = std::vector<InDetSimData::Deposit>::const_iterator;
15 
17  : m_sg(nullptr)
18 {
19 }
20 
21 
22 void
23 InDetSimDataCnv_p3::persToTrans(const InDetSimData_p3* persObj, InDetSimData* transObj, MsgStream &log)
24 {
25  MSG_VERBOSE(log,"InDetSimDataCnv_p3::persToTrans called ");
26  std::vector<InDetSimData::Deposit> deposits;
27  const unsigned int ndeposits = persObj->m_enDeposits.size();
28  deposits.reserve( ndeposits );
29  for (unsigned int icount=0; icount < ndeposits; icount++) {
30  HepMcParticleLink mcLink (m_sg);
31  HepMcPLCnv.persToTrans(&(persObj->m_links[icount]),&mcLink, log);
32  deposits.emplace_back (mcLink, persObj->m_enDeposits[icount]);
33  }
34 
35  *transObj = InDetSimData (std::move(deposits),
36  persObj->m_word);
37 }
38 
39 void
40 InDetSimDataCnv_p3::transToPers(const InDetSimData* transObj, InDetSimData_p3* persObj, MsgStream &log)
41 {
42  MSG_VERBOSE(log,"InDetSimDataCnv_p3::transToPers called ");
44 
45  persObj->m_word = transObj->word();
46  const std::vector<InDetSimData::Deposit> &dep(transObj->getdeposits());
47  const unsigned int ndeposits = dep.size();
48  persObj->m_links.resize(ndeposits);
49  persObj->m_enDeposits.resize(ndeposits);
50  for (unsigned int icount(0); icount < ndeposits; ++icount) {
51  HepMcPLCnv.transToPers(&(dep[icount].first), &(persObj->m_links[icount]), log);
52  persObj->m_enDeposits[icount] = dep[icount].second;
53  }
54 }
55 
57 {
58  m_sg = store;
59 }
HepMcParticleLinkCnv_p3
Definition: HepMcParticleLinkCnv_p3.h:29
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
InDetSimData_p3.h
depositIterator
std::vector< InDetSimData::Deposit >::const_iterator depositIterator
Definition: InDetSimDataCnv_p1.cxx:14
InDetSimData::getdeposits
const std::vector< Deposit > & getdeposits() const
Definition: InDetSimData.h:74
HepMcParticleLinkCnv_p3::persToTrans
virtual void persToTrans(const HepMcParticleLink_p3 *persObj, HepMcParticleLink *transObj, MsgStream &msg) const override
Method creating the transient representation of HepMcParticleLink from its persistent representation ...
Definition: HepMcParticleLinkCnv_p3.cxx:15
InDetSimDataCnv_p3::persToTrans
virtual void persToTrans(const InDetSimData_p3 *persObj, InDetSimData *transObj, MsgStream &log)
Definition: InDetSimDataCnv_p3.cxx:23
InDetSimData_p3::m_enDeposits
std::vector< float > m_enDeposits
Definition: InDetSimData_p3.h:19
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
InDetSimDataCnv_p3::HepMcPLCnv
HepMcParticleLinkCnv_p3 HepMcPLCnv
Definition: InDetSimDataCnv_p3.h:33
InDetSimData_p3
Definition: InDetSimData_p3.h:11
InDetSimDataCnv_p3::m_sg
IProxyDict * m_sg
Definition: InDetSimDataCnv_p3.h:32
InDetSimData
Definition: InDetSimData.h:42
InDetSimData.h
HepMcParticleLinkCnv_p3::transToPers
virtual void transToPers(const HepMcParticleLink *transObj, HepMcParticleLink_p3 *persObj, MsgStream &msg) const override
Method creating the persistent representation HepMcParticleLink_p3 from its transient representation ...
Definition: HepMcParticleLinkCnv_p3.cxx:33
InDetSimDataCnv_p3.h
InDetSimData_p3::m_word
unsigned int m_word
Definition: InDetSimData_p3.h:17
InDetSimData_p3::m_links
std::vector< HepMcParticleLink_p3 > m_links
Definition: InDetSimData_p3.h:18
InDetSimDataCnv_p3::setCurrentStore
void setCurrentStore(IProxyDict *store)
Definition: InDetSimDataCnv_p3.cxx:56
MSG_VERBOSE
#define MSG_VERBOSE(log, x)
Definition: MsgUtil.h:17
InDetSimData::word
int word() const
Definition: InDetSimData.h:69
DeMoScan.first
bool first
Definition: DeMoScan.py:536
AthMessaging.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
InDetSimDataCnv_p3::InDetSimDataCnv_p3
InDetSimDataCnv_p3()
Definition: InDetSimDataCnv_p3.cxx:16
InDetSimDataCnv_p3::transToPers
virtual void transToPers(const InDetSimData *transObj, InDetSimData_p3 *persObj, MsgStream &log)
Definition: InDetSimDataCnv_p3.cxx:40
MsgUtil.h