ATLAS Offline Software
ParticleBaseCnv_p2.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2019 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
21 #include "VxVertex/VxContainer.h"
22 
23 // ParticleEvent includes
25 #include "ParticleEvent/Lib/Base.h"
26 
27 // ParticleEventTPCnv includes
29 
31 
32 // pre-allocate converters
33 static const VxLinkCnv_t vxCnv;
34 static const AthenaBarCodeCnv_p1 s_abcCnv;
35 
39 {}
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((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((const AthenaBarCodeImpl*)(&(trans->getAthenaBarCodeImpl())), (AthenaBarCode_p1*)(&(pers->m_athenabarcode)),msg);
147 
148 // msg << MSG::DEBUG << "Created persistent state of ParticleBase [OK]"
149 // << endmsg;
150  return;
151 }
ParticleEvent::Base::reset_charge
void reset_charge()
Definition: Base.h:270
ParticleBase_p2::m_dataType
int m_dataType
type of data (see IParticle for more infos)
Definition: ParticleBase_p2.h:66
ElementLinkCnv_p3
Definition: ElementLinkCnv_p3.h:27
ElementLinkCnv_p3.h
This file contains the class definition for the ElementLinkCnv_p3 class.
ParticleEvent::Base::set_dataType
void set_dataType(ParticleDataType::DataType x)
Definition: Base.h:247
AthenaBarCodeImpl
Definition: AthenaBarCodeImpl.h:37
AthenaBarCodeCnv_p1
Definition: AthenaBarCodeCnv_p1.h:20
ParticleEvent::Base::reset_pdgId
void reset_pdgId()
Definition: Base.h:277
ParticleBase
Definition: ParticleBase.h:17
ParticleBase::dataType
virtual ParticleDataType::DataType dataType() const
Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the f...
Definition: ParticleBase.h:93
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
ParticleBase::reset_charge
void reset_charge()
Definition: ParticleBase.h:64
ParticleBase_p2::m_athenabarcode
AthenaBarCode_p1 m_athenabarcode
athena barcode
Definition: ParticleBase_p2.h:72
ParticleEvent::Base::hasCharge
bool hasCharge() const
method to check if charge information is available
Definition: Base.h:218
ParticleBase.h
ParticleBase_p2::m_hasCharge
bool m_hasCharge
switch to know if the particle has charge informations
Definition: ParticleBase_p2.h:57
ParticleEvent::Base::charge
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
ParticleDataType::DataType
DataType
Definition: Event/EventKernel/EventKernel/IParticle.h:36
AthenaBarCodeCnv_p1::transToPers
virtual void transToPers(const AthenaBarCodeImpl *transObj, AthenaBarCode_p1 *persObj, MsgStream &) const override
Definition: AthenaBarCodeCnv_p1.h:36
AthenaBarCodeCnv_p1::persToTrans
virtual void persToTrans(const AthenaBarCode_p1 *persObj, AthenaBarCodeImpl *transObj, MsgStream &) const override
Definition: AthenaBarCodeCnv_p1.h:43
ParticleEvent::Base::set_charge
void set_charge(ChargeType x)
Definition: Base.h:254
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
ParticleBase_p2::m_hasPdgId
bool m_hasPdgId
switch to know if the particle has PDG Id informations
Definition: ParticleBase_p2.h:60
ParticleBase::pdgId
virtual int pdgId() const
Return particle id.
Definition: ParticleBase.h:100
Base.h
ParticleBase::hasCharge
virtual bool hasCharge() const
method to check if charge information is available
Definition: ParticleBase.h:97
ParticleBase::hasPdgId
virtual bool hasPdgId() const
method to check if particle id information is available
Definition: ParticleBase.h:99
ParticleEvent::Base::pdgId
int pdgId() const
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....
Definition: Base.h:236
ParticleBase_p2::m_pdgId
int m_pdgId
ParticleDataGroup Id of the particle.
Definition: ParticleBase_p2.h:63
ParticleBaseCnv_p2.h
ParticleBase::originLink
virtual const ElementLink< VxContainer > & originLink() const
Return an ElementLink corresponding to particle's Origin.
Definition: ParticleBase.h:44
ParticleEvent::Base
Definition: Base.h:34
ElementLinkCnv_p1::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
VxContainer.h
VxLinkCnv_t
ElementLinkCnv_p3< ElementLink< VxContainer > > VxLinkCnv_t
Definition: ParticleBaseCnv_p2.cxx:30
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
ElementLinkCnv_p1< ElementLink< VxContainer > >
ParticleBase::reset_pdgId
void reset_pdgId()
Definition: ParticleBase.h:65
ParticleEvent::Base::getAthenaBarCodeImpl
const AthenaBarCodeImpl & getAthenaBarCodeImpl() const
Definition: Base.h:96
ElementLinkCnv_p1::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
ParticleEvent::Base::hasPdgId
bool hasPdgId() const
method to check if particle id information is available
Definition: Base.h:230
ParticleBase::set_dataType
void set_dataType(ParticleDataType::DataType x)
Definition: ParticleBase.h:61
ParticleBase::set_charge
void set_charge(ChargeType x)
Definition: ParticleBase.h:62
AthenaBarCode_p1
Definition: AthenaBarCode_p1.h:10
ParticleBase::charge
virtual ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
Definition: ParticleBase.h:98
ParticleBaseCnv_p2::~ParticleBaseCnv_p2
virtual ~ParticleBaseCnv_p2()
d-tor
Definition: ParticleBaseCnv_p2.cxx:38
ParticleEvent::Base::dataType
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
ParticleEvent::Base::set_origin
void set_origin(const VxContainer *theContainer, int index)
Definition: Base.h:284
AthenaBarCodeCnv_p1.h
ParticleBase::set_origin
void set_origin(const VxContainer *theContainer, int index)
Definition: ParticleBase.h:81
ParticleBase::set_pdgId
void set_pdgId(int x)
Definition: ParticleBase.h:63
ParticleBase_p2
Definition: ParticleBase_p2.h:26
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
ParticleEvent::Base::set_pdgId
void set_pdgId(int x)
Definition: Base.h:262
ParticleEvent::Base::originLink
const ElementLink< VxContainer > & originLink() const
Return the ElementLink to particle Origin
Definition: Base.cxx:38