ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonSimEventTPCnv
src
TGCSimHitCollectionCnv_p3.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/TGCSimHit.h
"
6
#include "
MuonSimEventTPCnv/TGCSimHitCollectionCnv_p3.h
"
7
#include "
MuonSimEventTPCnv/TGCSimHitCollection_p3.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
TGCSimHitCollectionCnv_p3::transToPers
(
const
TGCSimHitCollection
* transCont,
Muon::TGCSimHitCollection_p3
* persCont, MsgStream &log)
19
{
20
// for reasons of efficiency, set size before hand
21
unsigned
int
size
=transCont->
size
();
22
persCont->
m_TGCid
.reserve(
size
);
23
persCont->
m_globalTime
.reserve(
size
);
24
persCont->
m_stX
.reserve(
size
);
25
persCont->
m_stY
.reserve(
size
);
26
persCont->
m_stZ
.reserve(
size
);
27
persCont->
m_enX
.reserve(
size
);
28
persCont->
m_enY
.reserve(
size
);
29
persCont->
m_enZ
.reserve(
size
);
30
persCont->
m_partLink
.reserve(
size
);
31
persCont->
m_energyDeposit
.reserve(
size
);
32
persCont->
m_stepLength
.reserve(
size
);
33
persCont->
m_particleEncoding
.reserve(
size
);
34
persCont->
m_kineticEnergy
.reserve(
size
);
35
36
// make convertor to handle HepMcParticleLinks
37
HepMcParticleLinkCnv_p1
hepMcPLCnv;
38
HepMcParticleLink_p1
persLink;
// will use this as a temp object inside the loop
39
40
// loop through container, filling pers object
41
TGCSimHitCollection::const_iterator
it = transCont->
begin
(), itEnd = transCont->
end
();
42
for
(; it != itEnd; ++it) {
43
persCont->
m_TGCid
.push_back(it->TGCid());
44
persCont->
m_globalTime
.push_back(it->globalTime());
45
persCont->
m_stX
.push_back(it->localPosition().x());
46
persCont->
m_stY
.push_back(it->localPosition().y());
47
persCont->
m_stZ
.push_back(it->localPosition().z());
48
persCont->
m_enX
.push_back(it->localDireCos().x());
49
persCont->
m_enY
.push_back(it->localDireCos().y());
50
persCont->
m_enZ
.push_back(it->localDireCos().z());
51
persCont->
m_energyDeposit
.push_back(it->energyDeposit());
52
persCont->
m_stepLength
.push_back(it->stepLength());
53
persCont->
m_particleEncoding
.push_back(it->particleEncoding());
54
persCont->
m_kineticEnergy
.push_back(it->kineticEnergy());
55
56
hepMcPLCnv.
transToPers
(&it->particleLink(),&persLink, log);
57
persCont->
m_partLink
.push_back(persLink);
58
}
59
}
60
61
62
TGCSimHitCollection
*
TGCSimHitCollectionCnv_p3::createTransient
(
const
Muon::TGCSimHitCollection_p3
* persObj, MsgStream &log) {
63
std::unique_ptr<TGCSimHitCollection> trans(
new
TGCSimHitCollection
(
"DefaultCollectionName"
,persObj->
m_globalTime
.size()));
64
persToTrans
(persObj, trans.get(), log);
65
return
(trans.release());
66
}
67
68
69
void
TGCSimHitCollectionCnv_p3::persToTrans
(
const
Muon::TGCSimHitCollection_p3
* persCont,
TGCSimHitCollection
* transCont, MsgStream &log)
70
{
71
HepMcParticleLinkCnv_p1
hepMcPLCnv;
72
73
//transCont->reserve(persCont->m_TGCid.size()); //done in createTransient
74
for
(
unsigned
int
i = 0; i < persCont->
m_TGCid
.size(); i++) {
75
Amg::Vector3D
position(persCont->
m_stX
[i], persCont->
m_stY
[i], persCont->
m_stZ
[i]);
76
Amg::Vector3D
localDireCos(persCont->
m_enX
[i], persCont->
m_enY
[i], persCont->
m_enZ
[i]);
77
78
HepMcParticleLink
link;
79
hepMcPLCnv.
persToTrans
(&persCont->
m_partLink
[i],&link, log);
80
81
transCont->
Emplace
(persCont->
m_TGCid
[i], persCont->
m_globalTime
[i], position, localDireCos,
82
link,
83
persCont->
m_energyDeposit
[i], persCont->
m_stepLength
[i],
84
persCont->
m_particleEncoding
[i], persCont->
m_kineticEnergy
[i]);
85
}
86
}
87
GeoPrimitives.h
HepMcParticleLinkCnv_p1.h
StoreGateSvc.h
size
size_t size() const
Number of registered mappings.
TGCSimHitCollectionCnv_p3.h
TGCSimHitCollection
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
Definition
TGCSimHitCollection.h:15
TGCSimHitCollection_p3.h
TGCSimHit.h
AtlasHitsVector< TGCSimHit >::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
Muon::TGCSimHitCollection_p3
Definition
TGCSimHitCollection_p3.h:13
Muon::TGCSimHitCollection_p3::m_enY
std::vector< float > m_enY
Definition
TGCSimHitCollection_p3.h:18
Muon::TGCSimHitCollection_p3::m_stX
std::vector< float > m_stX
Definition
TGCSimHitCollection_p3.h:17
Muon::TGCSimHitCollection_p3::m_kineticEnergy
std::vector< float > m_kineticEnergy
Definition
TGCSimHitCollection_p3.h:23
Muon::TGCSimHitCollection_p3::m_globalTime
std::vector< float > m_globalTime
Definition
TGCSimHitCollection_p3.h:16
Muon::TGCSimHitCollection_p3::m_enX
std::vector< float > m_enX
Definition
TGCSimHitCollection_p3.h:18
Muon::TGCSimHitCollection_p3::m_TGCid
std::vector< int > m_TGCid
Definition
TGCSimHitCollection_p3.h:15
Muon::TGCSimHitCollection_p3::m_stepLength
std::vector< float > m_stepLength
Definition
TGCSimHitCollection_p3.h:21
Muon::TGCSimHitCollection_p3::m_stZ
std::vector< float > m_stZ
Represents m_localPosition in transient class.
Definition
TGCSimHitCollection_p3.h:17
Muon::TGCSimHitCollection_p3::m_energyDeposit
std::vector< float > m_energyDeposit
Definition
TGCSimHitCollection_p3.h:20
Muon::TGCSimHitCollection_p3::m_enZ
std::vector< float > m_enZ
Represents m_localDireCos in transient class.
Definition
TGCSimHitCollection_p3.h:18
Muon::TGCSimHitCollection_p3::m_stY
std::vector< float > m_stY
Definition
TGCSimHitCollection_p3.h:17
Muon::TGCSimHitCollection_p3::m_particleEncoding
std::vector< int > m_particleEncoding
Definition
TGCSimHitCollection_p3.h:22
Muon::TGCSimHitCollection_p3::m_partLink
std::vector< HepMcParticleLink_p1 > m_partLink
Definition
TGCSimHitCollection_p3.h:19
TGCSimHitCollectionCnv_p3::persToTrans
virtual void persToTrans(const Muon::TGCSimHitCollection_p3 *persCont, TGCSimHitCollection *transCont, MsgStream &log)
Definition
TGCSimHitCollectionCnv_p3.cxx:69
TGCSimHitCollectionCnv_p3::createTransient
virtual TGCSimHitCollection * createTransient(const Muon::TGCSimHitCollection_p3 *persObj, MsgStream &log)
Definition
TGCSimHitCollectionCnv_p3.cxx:62
TGCSimHitCollectionCnv_p3::transToPers
virtual void transToPers(const TGCSimHitCollection *transCont, Muon::TGCSimHitCollection_p3 *persCont, MsgStream &log)
Definition
TGCSimHitCollectionCnv_p3.cxx:18
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Generated on
for ATLAS Offline Software by
1.17.0