ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEventTPCnv
src
ParticleBaseCnv_p2.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// ParticleBaseCnv_p2.cxx
8
// Implementation file for class ParticleBaseCnv_p2
9
// Author: K.Cranmer<cranmer@cern.ch>
10
// Author: S.Binet<binet@cern.ch>
12
13
14
// STL includes
15
16
// DataModelAthenaPool includes
17
#include "
DataModelAthenaPool/ElementLinkCnv_p3.h
"
18
#include "
DataModelAthenaPool/AthenaBarCodeCnv_p1.h
"
19
20
// VxVertex includes
21
#include "
VxVertex/VxContainer.h
"
22
23
// ParticleEvent includes
24
#include "
ParticleEvent/ParticleBase.h
"
25
#include "
ParticleEvent/Lib/Base.h
"
26
27
// ParticleEventTPCnv includes
28
#include "
ParticleEventTPCnv/ParticleBaseCnv_p2.h
"
29
30
typedef
ElementLinkCnv_p3<ElementLink<VxContainer>
>
VxLinkCnv_t
;
31
32
// pre-allocate converters
33
static
const
VxLinkCnv_t
vxCnv
;
34
static
const
AthenaBarCodeCnv_p1
s_abcCnv
;
35
38
ParticleBaseCnv_p2::~ParticleBaseCnv_p2
()
39
{}
40
41
42
void
ParticleBaseCnv_p2::persToTrans
(
const
ParticleBase_p2
* pers,
43
ParticleBase
*
trans
,
44
MsgStream&
msg
)
const
45
{
46
// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
47
// << endmsg;
48
49
ElementLink<VxContainer>
origin;
50
vxCnv
.persToTrans( &pers->
m_origin
, &origin,
msg
);
51
52
trans
->set_origin (origin);
53
if
(pers->
m_hasCharge
) {
54
trans
->set_charge (pers->
m_charge
);
55
}
56
else
{
57
trans
->reset_charge();
58
}
59
if
(pers->
m_hasPdgId
) {
60
trans
->set_pdgId (pers->
m_pdgId
);
61
}
62
else
{
63
trans
->reset_pdgId();
64
}
65
trans
->set_dataType (
static_cast<
ParticleDataType::DataType
>
( pers->
m_dataType
));
66
67
// msg << MSG::DEBUG << "Loaded ParticleBase from persistent state [OK]"
68
// << endmsg;
69
70
return
;
71
}
72
73
void
ParticleBaseCnv_p2::transToPers
(
const
ParticleBase
*
trans
,
74
ParticleBase_p2
* pers,
75
MsgStream&
msg
)
const
76
{
77
// msg << MSG::DEBUG << "Creating persistent state of ParticleBase..."
78
// << endmsg;
79
80
vxCnv
.transToPers( &
trans
->originLink(), &pers->
m_origin
,
msg
);
81
82
pers->
m_charge
=
trans
->charge();
83
pers->
m_hasCharge
=
trans
->hasCharge();
84
pers->
m_pdgId
=
trans
->pdgId();
85
pers->
m_hasPdgId
=
trans
->hasPdgId();
86
pers->
m_dataType
=
trans
->dataType();
87
88
// msg << MSG::DEBUG << "Created persistent state of ParticleBase [OK]"
89
// << endmsg;
90
return
;
91
}
92
93
94
void
ParticleBaseCnv_p2::persToTrans
(
const
ParticleBase_p2
* pers,
95
ParticleEvent::Base
*
trans
,
96
MsgStream&
msg
)
const
97
{
98
// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
99
// << endmsg;
100
101
ElementLink<VxContainer>
origin;
102
vxCnv
.persToTrans( &pers->
m_origin
, &origin,
msg
);
103
104
trans
->set_origin (origin);
105
if
(pers->
m_hasCharge
) {
106
trans
->set_charge (pers->
m_charge
);
107
}
108
else
{
109
trans
->reset_charge();
110
}
111
if
(pers->
m_hasPdgId
) {
112
trans
->set_pdgId (pers->
m_pdgId
);
113
}
114
else
{
115
trans
->reset_pdgId();
116
}
117
trans
->set_dataType (
static_cast<
ParticleDataType::DataType
>
( pers->
m_dataType
));
118
119
// convert AthenaBarCode
120
s_abcCnv
.persToTrans(
static_cast<
const
AthenaBarCode_p1
*
>
(&(pers->
m_athenabarcode
)),
121
&(
trans
->getAthenaBarCodeImpl()),
msg
);
122
123
124
// msg << MSG::DEBUG << "Loaded ParticleBase from persistent state [OK]"
125
// << endmsg;
126
127
return
;
128
}
129
130
void
ParticleBaseCnv_p2::transToPers
(
const
ParticleEvent::Base
*
trans
,
131
ParticleBase_p2
* pers,
132
MsgStream&
msg
)
const
133
{
134
// msg << MSG::DEBUG << "Creating persistent state of ParticleBase..."
135
// << endmsg;
136
137
vxCnv
.transToPers( &
trans
->originLink(), &pers->
m_origin
,
msg
);
138
139
pers->
m_charge
=
trans
->charge();
140
pers->
m_hasCharge
=
trans
->hasCharge();
141
pers->
m_pdgId
=
trans
->pdgId();
142
pers->
m_hasPdgId
=
trans
->hasPdgId();
143
pers->
m_dataType
=
trans
->dataType();
144
145
// convert AthenaBarCode
146
s_abcCnv
.transToPers(
static_cast<
const
AthenaBarCodeImpl
*
>
(&(
trans
->getAthenaBarCodeImpl())),
static_cast<
AthenaBarCode_p1
*
>
(&(pers->
m_athenabarcode
)),
msg
);
147
148
// msg << MSG::DEBUG << "Created persistent state of ParticleBase [OK]"
149
// << endmsg;
150
return
;
151
}
AthenaBarCodeCnv_p1.h
Base.h
ElementLinkCnv_p3.h
This file contains the class definition for the ElementLinkCnv_p3 class.
vxCnv
static const VxLinkCnv_t vxCnv
Definition
ParticleBaseCnv_p1.cxx:37
s_abcCnv
static const AthenaBarCodeCnv_p1 s_abcCnv
Definition
ParticleBaseCnv_p1.cxx:38
VxLinkCnv_t
ElementLinkCnv_p1< ElementLink< VxContainer > > VxLinkCnv_t
Definition
ParticleBaseCnv_p1.cxx:34
ParticleBaseCnv_p2.h
ParticleBase.h
VxContainer.h
AthenaBarCodeCnv_p1
Definition
AthenaBarCodeCnv_p1.h:20
AthenaBarCodeImpl
Definition
AthenaBarCodeImpl.h:37
AthenaBarCode_p1
Definition
AthenaBarCode_p1.h:10
ElementLinkCnv_p3
Definition
ElementLinkCnv_p3.h:27
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
ParticleBaseCnv_p2::persToTrans
virtual void persToTrans(const ParticleBase_p2 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition
ParticleBaseCnv_p2.cxx:42
ParticleBaseCnv_p2::transToPers
virtual void transToPers(const ParticleBase *transObj, ParticleBase_p2 *persObj, MsgStream &msg) const final
Method creating the persistent representation ParticleBase_p2 from its transient representation Parti...
Definition
ParticleBaseCnv_p2.cxx:73
ParticleBaseCnv_p2::~ParticleBaseCnv_p2
virtual ~ParticleBaseCnv_p2()
d-tor
Definition
ParticleBaseCnv_p2.cxx:38
ParticleBase_p2
Definition
ParticleBase_p2.h:26
ParticleBase_p2::m_pdgId
int m_pdgId
ParticleDataGroup Id of the particle.
Definition
ParticleBase_p2.h:63
ParticleBase_p2::m_hasCharge
bool m_hasCharge
switch to know if the particle has charge informations
Definition
ParticleBase_p2.h:57
ParticleBase_p2::m_dataType
int m_dataType
type of data (see IParticle for more infos)
Definition
ParticleBase_p2.h:66
ParticleBase_p2::m_athenabarcode
AthenaBarCode_p1 m_athenabarcode
athena barcode
Definition
ParticleBase_p2.h:72
ParticleBase_p2::m_hasPdgId
bool m_hasPdgId
switch to know if the particle has PDG Id informations
Definition
ParticleBase_p2.h:60
ParticleBase_p2::m_origin
ElementLinkInt_p3 m_origin
link to the particle's origin
Definition
ParticleBase_p2.h:69
ParticleBase_p2::m_charge
float m_charge
Charge of the particle.
Definition
ParticleBase_p2.h:54
ParticleBase
Definition
ParticleBase.h:17
ParticleEvent::Base
Definition
Base.h:34
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:199
ParticleDataType::DataType
DataType
Definition
Event/EventKernel/EventKernel/IParticle.h:36
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0