ATLAS Offline Software
Loading...
Searching...
No Matches
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
19
20// VxVertex includes
22
23// ParticleEvent includes
26
27// ParticleEventTPCnv includes
29
31
32// pre-allocate converters
33static const VxLinkCnv_t vxCnv;
35
40
41
43 ParticleBase* trans,
44 MsgStream& msg ) const
45{
46// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
47// << endmsg;
48
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
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
95 ParticleEvent::Base* trans,
96 MsgStream& msg ) const
97{
98// msg << MSG::DEBUG << "Loading ParticleBase from persistent state..."
99// << endmsg;
100
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
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}
This file contains the class definition for the ElementLinkCnv_p3 class.
static const VxLinkCnv_t vxCnv
static const AthenaBarCodeCnv_p1 s_abcCnv
ElementLinkCnv_p1< ElementLink< VxContainer > > VxLinkCnv_t
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...
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...
virtual ~ParticleBaseCnv_p2()
d-tor
int m_pdgId
ParticleDataGroup Id of the particle.
bool m_hasCharge
switch to know if the particle has charge informations
int m_dataType
type of data (see IParticle for more infos)
AthenaBarCode_p1 m_athenabarcode
athena barcode
bool m_hasPdgId
switch to know if the particle has PDG Id informations
ElementLinkInt_p3 m_origin
link to the particle's origin
float m_charge
Charge of the particle.
void set_charge(ChargeType x)
void set_origin(const VxContainer *theContainer, int index)
virtual ParticleDataType::DataType dataType() const
Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the f...
void set_dataType(ParticleDataType::DataType x)
virtual ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
virtual bool hasCharge() const
method to check if charge information is available
void reset_pdgId()
virtual const ElementLink< VxContainer > & originLink() const
Return an ElementLink corresponding to particle's Origin.
virtual bool hasPdgId() const
method to check if particle id information is available
virtual int pdgId() const
Return particle id.
void set_pdgId(int x)
void reset_charge()
bool hasCharge() const
method to check if charge information is available
Definition Base.h:218
void set_charge(ChargeType x)
Definition Base.h:254
void set_dataType(ParticleDataType::DataType x)
Definition Base.h:247
ParticleDataType::DataType dataType() const
Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the f...
Definition Base.h:204
void set_origin(const VxContainer *theContainer, int index)
Definition Base.h:284
void reset_charge()
Definition Base.h:270
void set_pdgId(int x)
Definition Base.h:262
const AthenaBarCodeImpl & getAthenaBarCodeImpl() const
Definition Base.h:96
const ElementLink< VxContainer > & originLink() const
Return the ElementLink to particle Origin.
Definition Base.cxx:38
bool hasPdgId() const
method to check if particle id information is available
Definition Base.h:230
int pdgId() const
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....
Definition Base.h:236
void reset_pdgId()
Definition Base.h:277
ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
Definition Base.h:224
MsgStream & msg
Definition testRead.cxx:32