ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEventTPCnv
src
ParticleBaseCnv_p1.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_p1.cxx
8
// Implementation file for class ParticleBaseCnv_p1
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_p1.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_p1.h
"
29
30
// internal: do not change
31
//#define PBC_P1_VERBOSE 1
32
//
33
34
typedef
ElementLinkCnv_p1<ElementLink<VxContainer>
>
VxLinkCnv_t
;
35
36
// pre-allocate converters
37
static
const
VxLinkCnv_t
vxCnv
;
38
static
const
AthenaBarCodeCnv_p1
s_abcCnv
;
39
42
ParticleBaseCnv_p1::~ParticleBaseCnv_p1
()
43
{}
44
46
// Non-Const methods:
48
49
void
ParticleBaseCnv_p1::persToTrans
(
const
ParticleBase_p1
* pers,
50
ParticleBase
*
trans
,
51
MsgStream&
msg
)
const
52
{
53
// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
54
// << endmsg;
55
56
ElementLink<VxContainer>
origin;
57
vxCnv
.persToTrans( &pers->
m_origin
, &origin,
msg
);
58
59
trans
->set_origin (origin);
60
if
(pers->
m_hasCharge
) {
61
trans
->set_charge (pers->
m_charge
);
62
}
63
else
{
64
trans
->reset_charge();
65
}
66
if
(pers->
m_hasPdgId
) {
67
trans
->set_pdgId (pers->
m_pdgId
);
68
}
69
else
{
70
trans
->reset_pdgId();
71
}
72
trans
->set_dataType (
static_cast<
ParticleDataType::DataType
>
( pers->
m_dataType
));
73
74
// msg << MSG::DEBUG << "Loaded ParticleBase from persistent state [OK]"
75
// << endmsg;
76
77
return
;
78
}
79
80
void
ParticleBaseCnv_p1::transToPers
(
const
ParticleBase
*
trans
,
81
ParticleBase_p1
* pers,
82
MsgStream&
msg
)
const
83
{
84
// msg << MSG::DEBUG << "Creating persistent state of ParticleBase..."
85
// << endmsg;
86
87
vxCnv
.transToPers( &
trans
->originLink(), &pers->
m_origin
,
msg
);
88
89
pers->
m_charge
=
trans
->charge();
90
pers->
m_hasCharge
=
trans
->hasCharge();
91
pers->
m_pdgId
=
trans
->pdgId();
92
pers->
m_hasPdgId
=
trans
->hasPdgId();
93
pers->
m_dataType
=
trans
->dataType();
94
95
// msg << MSG::DEBUG << "Created persistent state of ParticleBase [OK]"
96
// << endmsg;
97
return
;
98
}
99
100
101
void
ParticleBaseCnv_p1::persToTrans
(
const
ParticleBase_p1
* pers,
102
ParticleEvent::Base
*
trans
,
103
MsgStream&
msg
)
const
104
{
105
// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
106
// << endmsg;
107
108
ElementLink<VxContainer>
origin;
109
vxCnv
.persToTrans( &pers->
m_origin
, &origin,
msg
);
110
111
trans
->set_origin (origin);
112
if
(pers->
m_hasCharge
) {
113
trans
->set_charge (pers->
m_charge
);
114
}
115
else
{
116
trans
->reset_charge();
117
}
118
if
(pers->
m_hasPdgId
) {
119
trans
->set_pdgId (pers->
m_pdgId
);
120
}
121
else
{
122
trans
->reset_pdgId();
123
}
124
trans
->set_dataType (
static_cast<
ParticleDataType::DataType
>
( pers->
m_dataType
));
125
126
// convert AthenaBarCode
127
s_abcCnv
.persToTrans((
const
AthenaBarCode_p1
*)(&(pers->
m_athenabarcode
)),
128
&(
trans
->getAthenaBarCodeImpl()),
msg
);
129
130
131
// msg << MSG::DEBUG << "Loaded ParticleBase from persistent state [OK]"
132
// << endmsg;
133
134
return
;
135
}
136
137
void
ParticleBaseCnv_p1::transToPers
(
const
ParticleEvent::Base
*
trans
,
138
ParticleBase_p1
* pers,
139
MsgStream&
msg
)
const
140
{
141
// msg << MSG::DEBUG << "Creating persistent state of ParticleBase..."
142
// << endmsg;
143
144
#ifdef PBC_P1_VERBOSE
145
msg
<< MSG::WARNING
146
<<
"an old T->P ParticleBase converter is being called!"
147
// << endmsg
148
// << "consider migrating to ParticleBase(Cnv)_p2 !" << endmsg
149
// << "this method will be removed for 16.0.0"
150
<<
endmsg
;
151
#endif
152
153
154
vxCnv
.transToPers( &
trans
->originLink(), &pers->
m_origin
,
msg
);
155
156
pers->
m_charge
=
trans
->charge();
157
pers->
m_hasCharge
=
trans
->hasCharge();
158
pers->
m_pdgId
=
trans
->pdgId();
159
pers->
m_hasPdgId
=
trans
->hasPdgId();
160
pers->
m_dataType
=
trans
->dataType();
161
162
// convert AthenaBarCode
163
s_abcCnv
.transToPers(
static_cast<
const
AthenaBarCodeImpl
*
>
(&(
trans
->getAthenaBarCodeImpl())),
static_cast<
AthenaBarCode_p1
*
>
(&(pers->
m_athenabarcode
)),
msg
);
164
165
// msg << MSG::DEBUG << "Created persistent state of ParticleBase [OK]"
166
// << endmsg;
167
return
;
168
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
AthenaBarCodeCnv_p1.h
Base.h
ElementLinkCnv_p1.h
This file contains the class definition for the ElementLinkCnv_p1 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_p1.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_p1
Definition
ElementLinkCnv_p1.h:27
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
ParticleBaseCnv_p1::persToTrans
virtual void persToTrans(const ParticleBase_p1 *persObj, ParticleBase *transObj, MsgStream &msg) const final
Method creating the transient representation of ParticleBase from its persistent representation Parti...
Definition
ParticleBaseCnv_p1.cxx:49
ParticleBaseCnv_p1::transToPers
virtual void transToPers(const ParticleBase *transObj, ParticleBase_p1 *persObj, MsgStream &msg) const final
Method creating the persistent representation ParticleBase_p1 from its transient representation Parti...
Definition
ParticleBaseCnv_p1.cxx:80
ParticleBaseCnv_p1::~ParticleBaseCnv_p1
virtual ~ParticleBaseCnv_p1()
d-tor
Definition
ParticleBaseCnv_p1.cxx:42
ParticleBase_p1
Definition
ParticleBase_p1.h:26
ParticleBase_p1::m_athenabarcode
AthenaBarCode_p1 m_athenabarcode
athena barcode
Definition
ParticleBase_p1.h:72
ParticleBase_p1::m_hasPdgId
bool m_hasPdgId
switch to know if the particle has PDG Id informations
Definition
ParticleBase_p1.h:66
ParticleBase_p1::m_charge
float m_charge
Charge of the particle.
Definition
ParticleBase_p1.h:57
ParticleBase_p1::m_origin
ElementLinkInt_p1 m_origin
link to the particle's origin
Definition
ParticleBase_p1.h:54
ParticleBase_p1::m_pdgId
int m_pdgId
ParticleDataGroup Id of the particle.
Definition
ParticleBase_p1.h:63
ParticleBase_p1::m_dataType
int m_dataType
type of data (see IParticle for more infos)
Definition
ParticleBase_p1.h:69
ParticleBase_p1::m_hasCharge
bool m_hasCharge
switch to know if the particle has charge informations
Definition
ParticleBase_p1.h:60
ParticleBase
Definition
ParticleBase.h:17
ParticleEvent::Base
Definition
Base.h:34
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:185
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