ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonSimEventTPCnv
src
sTGCSimHitCollectionCnv_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/sTGCSimHit.h
"
6
#include "
MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p1.h
"
7
#include "
MuonSimEventTPCnv/sTGCSimHitCollection_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
sTGCSimHitCollectionCnv_p1::transToPers
(
const
sTGCSimHitCollection
* transCont,
Muon::sTGCSimHitCollection_p1
* persCont, MsgStream &log)
19
{
20
// for reasons of efficiency, set size before hand
21
unsigned
int
size
=transCont->
size
();
22
persCont->
m_sTGCId
.reserve(
size
);
23
persCont->
m_globalTime
.reserve(
size
);
24
// postStep Global
25
persCont->
m_stX
.reserve(
size
);
26
persCont->
m_stY
.reserve(
size
);
27
persCont->
m_stZ
.reserve(
size
);
28
// postStep Local
29
persCont->
m_particleEncoding
.reserve(
size
);
30
persCont->
m_ptX
.reserve(
size
);
31
persCont->
m_ptY
.reserve(
size
);
32
persCont->
m_ptZ
.reserve(
size
);
33
persCont->
m_depositEnergy
.reserve(
size
);
34
persCont->
m_partLink
.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
sTGCSimHitCollection::const_iterator
it = transCont->
begin
(), itEnd = transCont->
end
();
42
for
(; it != itEnd; ++it) {
43
persCont->
m_sTGCId
.push_back(it->sTGCId());
44
persCont->
m_globalTime
.push_back(it->globalTime());
45
// postStep Global
46
persCont->
m_stX
.push_back(it->globalPosition().x());
47
persCont->
m_stY
.push_back(it->globalPosition().y());
48
persCont->
m_stZ
.push_back(it->globalPosition().z());
49
// postStep Local
50
persCont->
m_particleEncoding
.push_back(it->particleEncoding());
51
persCont->
m_ptX
.push_back(it->globalDirection().x());
52
persCont->
m_ptY
.push_back(it->globalDirection().y());
53
persCont->
m_ptZ
.push_back(it->globalDirection().z());
54
persCont->
m_depositEnergy
.push_back(it->depositEnergy());
55
56
hepMcPLCnv.
transToPers
(&it->particleLink(),&persLink, log);
57
persCont->
m_partLink
.push_back(persLink);
58
59
}
60
}
61
62
63
sTGCSimHitCollection
*
sTGCSimHitCollectionCnv_p1::createTransient
(
const
Muon::sTGCSimHitCollection_p1
* persObj, MsgStream &log) {
64
std::unique_ptr<sTGCSimHitCollection> trans(
new
sTGCSimHitCollection
(
"DefaultCollectionName"
,persObj->
m_globalTime
.size()));
65
persToTrans
(persObj, trans.get(), log);
66
return
(trans.release());
67
}
68
69
70
void
sTGCSimHitCollectionCnv_p1::persToTrans
(
const
Muon::sTGCSimHitCollection_p1
* persCont,
sTGCSimHitCollection
* transCont, MsgStream &log)
71
{
72
HepMcParticleLinkCnv_p1
hepMcPLCnv;
73
74
//transCont->reserve(persCont->m_sTGCId.size());//done in createTransient
75
for
(
unsigned
int
i = 0; i < persCont->
m_sTGCId
.size(); i++) {
76
// post-step
77
Amg::Vector3D
position(persCont->
m_stX
[i], persCont->
m_stY
[i], persCont->
m_stZ
[i]);
78
Amg::Vector3D
direction(persCont->
m_ptX
[i], persCont->
m_ptY
[i], persCont->
m_ptZ
[i]);
79
80
HepMcParticleLink
link;
81
hepMcPLCnv.
persToTrans
(&persCont->
m_partLink
[i],&link, log);
82
83
// The _p1 class doesn't have kinetic energy and pre-step position.
84
// So, set kinectic energy to -1 and pre-step position to (0,0,0).
85
Amg::Vector3D
preposition(0., 0., 0.);
86
87
transCont->
Emplace
(persCont->
m_sTGCId
[i], persCont->
m_globalTime
[i], position, persCont->
m_particleEncoding
[i],
88
direction, persCont->
m_depositEnergy
[i], link, -1.0, preposition);
89
}
90
}
91
GeoPrimitives.h
HepMcParticleLinkCnv_p1.h
StoreGateSvc.h
size
size_t size() const
Number of registered mappings.
AtlasHitsVector< sTGCSimHit >::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::sTGCSimHitCollection_p1
Definition
sTGCSimHitCollection_p1.h:13
Muon::sTGCSimHitCollection_p1::m_partLink
std::vector< HepMcParticleLink_p1 > m_partLink
Definition
sTGCSimHitCollection_p1.h:23
Muon::sTGCSimHitCollection_p1::m_ptX
std::vector< float > m_ptX
Definition
sTGCSimHitCollection_p1.h:20
Muon::sTGCSimHitCollection_p1::m_sTGCId
std::vector< int > m_sTGCId
Definition
sTGCSimHitCollection_p1.h:15
Muon::sTGCSimHitCollection_p1::m_stZ
std::vector< float > m_stZ
Represents m_globalPosition in transient class.
Definition
sTGCSimHitCollection_p1.h:18
Muon::sTGCSimHitCollection_p1::m_depositEnergy
std::vector< float > m_depositEnergy
Definition
sTGCSimHitCollection_p1.h:21
Muon::sTGCSimHitCollection_p1::m_particleEncoding
std::vector< int > m_particleEncoding
Definition
sTGCSimHitCollection_p1.h:19
Muon::sTGCSimHitCollection_p1::m_ptZ
std::vector< float > m_ptZ
Definition
sTGCSimHitCollection_p1.h:20
Muon::sTGCSimHitCollection_p1::m_stX
std::vector< float > m_stX
Definition
sTGCSimHitCollection_p1.h:18
Muon::sTGCSimHitCollection_p1::m_ptY
std::vector< float > m_ptY
Definition
sTGCSimHitCollection_p1.h:20
Muon::sTGCSimHitCollection_p1::m_stY
std::vector< float > m_stY
Definition
sTGCSimHitCollection_p1.h:18
Muon::sTGCSimHitCollection_p1::m_globalTime
std::vector< float > m_globalTime
Definition
sTGCSimHitCollection_p1.h:16
sTGCSimHitCollectionCnv_p1::transToPers
virtual void transToPers(const sTGCSimHitCollection *transCont, Muon::sTGCSimHitCollection_p1 *persCont, MsgStream &log)
Definition
sTGCSimHitCollectionCnv_p1.cxx:18
sTGCSimHitCollectionCnv_p1::createTransient
virtual sTGCSimHitCollection * createTransient(const Muon::sTGCSimHitCollection_p1 *persObj, MsgStream &log)
Definition
sTGCSimHitCollectionCnv_p1.cxx:63
sTGCSimHitCollectionCnv_p1::persToTrans
virtual void persToTrans(const Muon::sTGCSimHitCollection_p1 *persCont, sTGCSimHitCollection *transCont, MsgStream &log)
Definition
sTGCSimHitCollectionCnv_p1.cxx:70
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
sTGCSimHitCollectionCnv_p1.h
sTGCSimHitCollection
AtlasHitsVector< sTGCSimHit > sTGCSimHitCollection
Definition
sTGCSimHitCollection.h:15
sTGCSimHitCollection_p1.h
sTGCSimHit.h
Generated on
for ATLAS Offline Software by
1.17.0