ATLAS Offline Software
Loading...
Searching...
No Matches
Tracking
TrkEventCnv
TrkTruthTPCnv
src
PRD_MultiTruthCollectionCnv_p1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// T/P converter for PRD_MultiTruthCollection.
6
// Andrei Gaponenko <agaponenko@lbl.gov>, 2007
7
8
#include "
TrkTruthTPCnv/PRD_MultiTruthCollectionCnv_p1.h
"
9
10
#include "
TrkTruthTPCnv/PRD_MultiTruthCollection_p1.h
"
11
#include "
TrkTruthData/PRD_MultiTruthCollection.h
"
12
13
#include "
AthenaKernel/errorcheck.h
"
14
#include "
GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h
"
15
16
17
namespace
{
18
const
HepMcParticleLinkCnv_p1
particleLinkConverter;
19
}
20
21
22
23
void
PRD_MultiTruthCollectionCnv_p1::persToTrans
(
const
Trk::PRD_MultiTruthCollection_p1
* pers,
24
PRD_MultiTruthCollection
* trans,
25
MsgStream&
msg
)
26
{
27
msg
<<MSG::DEBUG<<
"PRD_MultiTruthCollectionCnv_p1::persToTrans()"
<<
endmsg
;
28
29
for
(
const
Trk::PRD_MultiTruthCollection_p1::Entry
& ent : pers->
m_entries
) {
30
HepMcParticleLink
link;
31
particleLinkConverter.persToTrans(&ent.
particle
, &link,
msg
);
32
33
if
(!
m_isInitialized
) {
34
if
(this->
initialize
(msg) != StatusCode::SUCCESS) {
35
msg
<< MSG::FATAL <<
"Could not initialize PRD_MultiTruthCollectionCnv_p1 "
<<
endmsg
;
36
}
37
}
38
39
Identifier
chanId;
40
if
(
m_pixId
->is_shortened_pixel_id(ent.
id
)) {
41
chanId =
m_pixId
->pixel_id_from_shortened(ent.
id
);
42
}
43
else
{
44
chanId = ent.
id
;
45
}
46
trans->insert(trans->end(), std::make_pair(chanId, link) );
47
}
48
49
msg
<<MSG::DEBUG<<
"PRD_MultiTruthCollectionCnv_p1::persToTrans() DONE"
<<
endmsg
;
50
}
51
52
void
PRD_MultiTruthCollectionCnv_p1::transToPers
(
const
PRD_MultiTruthCollection
* trans,
53
Trk::PRD_MultiTruthCollection_p1
* pers,
54
MsgStream&
msg
)
55
{
56
msg
<<MSG::DEBUG<<
"PRD_MultiTruthCollectionCnv_p1::transToPers()"
<<
endmsg
;
57
58
pers->
m_entries
.reserve(trans->size());
59
60
for
(
const
auto
& p : *trans) {
61
HepMcParticleLink_p1
link;
62
particleLinkConverter.transToPers(&p.second, &link,
msg
);
63
pers->
m_entries
.push_back(
Trk::PRD_MultiTruthCollection_p1::Entry
(p.first.get_compact(), link));
64
}
65
66
msg
<<MSG::DEBUG<<
"PRD_MultiTruthCollectionCnv_p1::transToPers() DONE"
<<
endmsg
;
67
}
68
69
StatusCode
PRD_MultiTruthCollectionCnv_p1::initialize
(MsgStream &
/*log*/
) {
70
// Do not initialize again:
71
m_isInitialized
=
true
;
72
73
SmartIF<StoreGateSvc> detStore(Gaudi::svcLocator()->service(
"DetectorStore"
));
74
CHECK
( detStore.isValid() );
75
76
// Get the sct helper from the detector store
77
CHECK
( detStore->retrieve(
m_pixId
,
"PixelID"
) );
78
79
return
StatusCode::SUCCESS;
80
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:63
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
HepMcParticleLinkCnv_p1.h
PRD_MultiTruthCollectionCnv_p1.h
PRD_MultiTruthCollection.h
PRD_MultiTruthCollection_p1.h
HepMcParticleLinkCnv_p1
Definition
HepMcParticleLinkCnv_p1.h:33
HepMcParticleLink_p1
Definition
HepMcParticleLink_p1.h:21
HepMcParticleLink
a link optimized in size for a GenParticle in a McEventCollection
Definition
HepMcParticleLink.h:72
PRD_MultiTruthCollectionCnv_p1::transToPers
virtual void transToPers(const PRD_MultiTruthCollection *transObj, Trk::PRD_MultiTruthCollection_p1 *persObj, MsgStream &msg)
Method creating the persistent representation PRD_MultiTruthCollection_p1 from its transient represen...
Definition
PRD_MultiTruthCollectionCnv_p1.cxx:52
PRD_MultiTruthCollectionCnv_p1::initialize
StatusCode initialize(MsgStream &log)
Definition
PRD_MultiTruthCollectionCnv_p1.cxx:69
PRD_MultiTruthCollectionCnv_p1::persToTrans
virtual void persToTrans(const Trk::PRD_MultiTruthCollection_p1 *persObj, PRD_MultiTruthCollection *transObj, MsgStream &msg)
Definition
PRD_MultiTruthCollectionCnv_p1.cxx:23
PRD_MultiTruthCollectionCnv_p1::m_isInitialized
bool m_isInitialized
Definition
PRD_MultiTruthCollectionCnv_p1.h:48
PRD_MultiTruthCollectionCnv_p1::m_pixId
const PixelID * m_pixId
Definition
PRD_MultiTruthCollectionCnv_p1.h:47
PRD_MultiTruthCollection
A PRD is mapped onto all contributing particles.
Definition
PRD_MultiTruthCollection.h:24
Trk::PRD_MultiTruthCollection_p1
Definition
PRD_MultiTruthCollection_p1.h:22
Trk::PRD_MultiTruthCollection_p1::m_entries
CollectionType m_entries
Definition
PRD_MultiTruthCollection_p1.h:43
Identifier
Definition
IdentifierFieldParser.cxx:14
initialize
void initialize()
Definition
run_EoverP.cxx:894
Trk::PRD_MultiTruthCollection_p1::Entry
Definition
PRD_MultiTruthCollection_p1.h:25
Trk::PRD_MultiTruthCollection_p1::Entry::id
unsigned int id
Definition
PRD_MultiTruthCollection_p1.h:35
Trk::PRD_MultiTruthCollection_p1::Entry::particle
HepMcParticleLink_p1 particle
Definition
PRD_MultiTruthCollection_p1.h:36
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.14.0