ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonSimEventTPCnv
src
MDTSimHitCollectionCnv_p1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonSimEvent/MDTSimHit.h
"
6
#include "
MuonSimEventTPCnv/MDTSimHitCollectionCnv_p1.h
"
7
#include "
MuonSimEventTPCnv/MDTSimHitCollection_p1.h
"
8
#include "
GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h
"
9
10
//#include <cmath>
11
#include "
GeoPrimitives/GeoPrimitives.h
"
12
13
// Gaudi
14
#include "GaudiKernel/MsgStream.h"
15
// Athena
16
#include "
StoreGate/StoreGateSvc.h
"
17
18
void
MDTSimHitCollectionCnv_p1::transToPers
(
const
MDTSimHitCollection
* transCont,
Muon::MDTSimHitCollection_p1
* persCont, MsgStream &log)
19
{
20
// for reasons of efficiency, set size before hand
21
unsigned
int
size
=transCont->
size
();
22
persCont->
m_MDTid
.reserve(
size
);
23
persCont->
m_globalTime
.reserve(
size
);
24
persCont->
m_driftRadius
.reserve(
size
);
25
persCont->
m_stX
.reserve(
size
);
26
persCont->
m_stY
.reserve(
size
);
27
persCont->
m_stZ
.reserve(
size
);
28
// persCont->m_meanTime.reserve(size);
29
persCont->
m_partLink
.reserve(
size
);
30
31
// make convertor to handle HepMcParticleLinks
32
HepMcParticleLinkCnv_p1
hepMcPLCnv;
33
HepMcParticleLink_p1
persLink;
// will use this as a temp object inside the loop
34
35
// loop through container, filling pers object
36
MDTSimHitCollection::const_iterator
it = transCont->
begin
(), itEnd = transCont->
end
();
37
for
(; it != itEnd; ++it) {
38
persCont->
m_MDTid
.push_back(it->MDTid());
39
persCont->
m_globalTime
.push_back(it->globalTime());
40
persCont->
m_driftRadius
.push_back(it->driftRadius());
41
persCont->
m_stX
.push_back(it->localPosition().x());
42
persCont->
m_stY
.push_back(it->localPosition().y());
43
persCont->
m_stZ
.push_back(it->localPosition().z());
44
// persCont->m_meanTime.push_back(hit->m_meanTime);
45
46
hepMcPLCnv.
transToPers
(&it->particleLink(),&persLink, log);
47
persCont->
m_partLink
.push_back(persLink);
48
}
49
}
50
51
52
MDTSimHitCollection
*
MDTSimHitCollectionCnv_p1::createTransient
(
const
Muon::MDTSimHitCollection_p1
* persObj, MsgStream &log) {
53
std::unique_ptr<MDTSimHitCollection> trans(
new
MDTSimHitCollection
(
"DefaultCollectionName"
,persObj->
m_globalTime
.size()));
54
persToTrans
(persObj, trans.get(), log);
55
return
(trans.release());
56
}
57
58
59
void
MDTSimHitCollectionCnv_p1::persToTrans
(
const
Muon::MDTSimHitCollection_p1
* persCont,
MDTSimHitCollection
* transCont, MsgStream &log)
60
{
61
HepMcParticleLinkCnv_p1
hepMcPLCnv;
62
63
//transCont->reserve(persCont->m_MDTid.size());//done in createTransient
64
for
(
unsigned
int
i = 0; i < persCont->
m_MDTid
.size(); i++) {
65
Amg::Vector3D
position(persCont->
m_stX
[i], persCont->
m_stY
[i], persCont->
m_stZ
[i]);
66
67
HepMcParticleLink
link;
68
hepMcPLCnv.
persToTrans
(&persCont->
m_partLink
[i],&link, log);
69
70
transCont->
Emplace
(persCont->
m_MDTid
[i], persCont->
m_globalTime
[i], persCont->
m_driftRadius
[i], position,
71
link,-9999999.,-1.,0,-1.);
72
}
73
}
74
GeoPrimitives.h
HepMcParticleLinkCnv_p1.h
MDTSimHitCollectionCnv_p1.h
MDTSimHitCollection
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
Definition
MDTSimHitCollection.h:14
MDTSimHitCollection_p1.h
MDTSimHit.h
StoreGateSvc.h
size
size_t size() const
Number of registered mappings.
AtlasHitsVector< MDTSimHit >::const_iterator
CONT::const_iterator const_iterator
Definition
AtlasHitsVector.h:42
AtlasHitsVector::begin
const_iterator begin() const
Definition
AtlasHitsVector.h:130
AtlasHitsVector::Emplace
void Emplace(Args &&... args)
Definition
AtlasHitsVector.h:80
AtlasHitsVector::size
size_type size() const
Definition
AtlasHitsVector.h:142
AtlasHitsVector::end
const_iterator end() const
Definition
AtlasHitsVector.h:133
HepMcParticleLinkCnv_p1
Definition
HepMcParticleLinkCnv_p1.h:33
HepMcParticleLinkCnv_p1::persToTrans
virtual void persToTrans(const HepMcParticleLink_p1 *persObj, HepMcParticleLink *transObj, MsgStream &msg) const override
Method creating the transient representation of HepMcParticleLink from its persistent representation ...
Definition
HepMcParticleLinkCnv_p1.cxx:31
HepMcParticleLinkCnv_p1::transToPers
virtual void transToPers(const HepMcParticleLink *transObj, HepMcParticleLink_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation HepMcParticleLink_p1 from its transient representation ...
Definition
HepMcParticleLinkCnv_p1.cxx:51
HepMcParticleLink_p1
Definition
HepMcParticleLink_p1.h:21
HepMcParticleLink
a link optimized in size for a GenParticle in a McEventCollection
Definition
HepMcParticleLink.h:72
MDTSimHitCollectionCnv_p1::persToTrans
virtual void persToTrans(const Muon::MDTSimHitCollection_p1 *persCont, MDTSimHitCollection *transCont, MsgStream &log)
Definition
MDTSimHitCollectionCnv_p1.cxx:59
MDTSimHitCollectionCnv_p1::transToPers
virtual void transToPers(const MDTSimHitCollection *transCont, Muon::MDTSimHitCollection_p1 *persCont, MsgStream &log)
Definition
MDTSimHitCollectionCnv_p1.cxx:18
MDTSimHitCollectionCnv_p1::createTransient
virtual MDTSimHitCollection * createTransient(const Muon::MDTSimHitCollection_p1 *persObj, MsgStream &log)
Definition
MDTSimHitCollectionCnv_p1.cxx:52
Muon::MDTSimHitCollection_p1
Definition
MDTSimHitCollection_p1.h:13
Muon::MDTSimHitCollection_p1::m_driftRadius
std::vector< float > m_driftRadius
Definition
MDTSimHitCollection_p1.h:17
Muon::MDTSimHitCollection_p1::m_stX
std::vector< float > m_stX
Definition
MDTSimHitCollection_p1.h:18
Muon::MDTSimHitCollection_p1::m_stY
std::vector< float > m_stY
Definition
MDTSimHitCollection_p1.h:18
Muon::MDTSimHitCollection_p1::m_partLink
std::vector< HepMcParticleLink_p1 > m_partLink
Definition
MDTSimHitCollection_p1.h:20
Muon::MDTSimHitCollection_p1::m_MDTid
std::vector< int > m_MDTid
Definition
MDTSimHitCollection_p1.h:15
Muon::MDTSimHitCollection_p1::m_stZ
std::vector< float > m_stZ
Represents m_localPosition in transient class.
Definition
MDTSimHitCollection_p1.h:18
Muon::MDTSimHitCollection_p1::m_globalTime
std::vector< float > m_globalTime
Definition
MDTSimHitCollection_p1.h:16
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Generated on
for ATLAS Offline Software by
1.17.0