ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticleContainerCnv_p5.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5*/
6
7// TruthParticleContainerCnv_p5.cxx
8// Implementation file for class TruthParticleContainerCnv_p5
9// Author: S.Binet<binet@cern.ch>
11
12// STL includes
13
14// Framework includes
15#include "GaudiKernel/MsgStream.h"
16
17// HepMC includes
20
21// McParticleKernel includes
23
24// McParticleEvent includes
28
29// McParticleEventTPCnv includes
31
32
33void
36 MsgStream& msg ) const
37{
38 msg << MSG::DEBUG
39 << "Loading TruthParticleContainer from persistent state..."
40 << endmsg;
41
42 if ( 0 == m_cnvTool ) {
43 msg << MSG::ERROR
44 << "NULL pointer to ITruthParticleCnvTool !!"
45 << endmsg
46 << "Can't create *ANY* TruthParticleContainer !!"
47 << endmsg;
48 throw std::runtime_error("NULL pointer to ITruthParticleCnvTool !!");
49 }
50
51 // convert the ElementLink<McEventCollection>
53 m_genEvtCnv.persToTrans( &pers->m_genEvent,
54 &genEventEL,
55 msg );
56 trans->setGenEvent (genEventEL);
57
59 if ( 0 == evt ) {
60 const std::string error("NULL pointer to McEventCollection !!");
61 msg << MSG::ERROR << error
62 << endmsg;
63 throw std::runtime_error(error);
64 }
65
66 if ( !m_cnvTool->convert( evt,
68 trans ).isSuccess() ) {
69 msg << MSG::ERROR
70 << "Problem converting HepMC::GenEvent ["
71 << pers->m_genEvent.m_contName << "]["
72 << pers->m_genEvent.m_elementIndex << "]"
73 << " to TruthParticleContainer !"
74 << endmsg;
75 throw std::runtime_error("No TruthParticleContainer created !!");
76 }
77
78 if ( !trans->genEventLink().isValid() ) {
79 const std::string err = "ElementLink to McEventCollection is not valid !";
80 msg << MSG::ERROR << err << endmsg;
81 throw std::runtime_error(err);
82 }
83
84 // convert the ElementLink<TruthEtIsolationsContainer>
85 // this needs to be done *AFTER* the GenEvent->TPContainer conversion !!
87 m_etIsolCnv.persToTrans( &pers->m_etIsolations,
88 &etIsolEL,
89 msg );
90 trans->setEtIsolations (etIsolEL);
91
92 msg << MSG::DEBUG
93 << "Loaded TruthParticleContainer from persistent state [OK]"
94 << endmsg;
95 return;
96}
97
98void
101 MsgStream& msg ) const
102{
103 msg << MSG::DEBUG
104 << "Creating persistent state of TruthParticleContainer..."
105 << endmsg;
106
107 msg << MSG::ERROR
108 << "This transient-to-persistent converter method has been RETIRED !!"
109 << endmsg
110 << "You are not supposed to end-up here ! Go away !"
111 << endmsg;
112
113 throw std::runtime_error( "Retired TruthParticleContainerCnv_p5::transToPers() !!" );
114
115 return;
116}
117
118
119
120
126
127
#define endmsg
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual void transToPers(const TruthParticleContainer *transObj, TruthParticleContainer_p5 *persObj, MsgStream &msg) const override
Method creating the persistent representation TruthParticleContainer_p5 from its transient representa...
ITruthParticleCnvTool * m_cnvTool
Pointer to the IAlgTool providing the conversion from a McEventCollection to a TruthParticleContainer...
ElementLinkCnv_p1< ElementLink< TruthEtIsolationsContainer > > m_etIsolCnv
Converter for the ElementLink<TruthEtIsolationsContainer> data member.
ElementLinkCnv_p1< ElementLink< McEventCollection > > m_genEvtCnv
Converter for the ElementLink<McEventCollection> data member.
virtual void persToTrans(const TruthParticleContainer_p5 *persObj, TruthParticleContainer *transObj, MsgStream &msg) const override
Method creating the transient representation of TruthParticleContainer from its persistent representa...
ElementLinkInt_p1 m_etIsolations
The persistent pointer toward the TruthEtIsolations container the (transient) TruthParticleContainer ...
ElementLinkInt_p1 m_genEvent
The persistent pointer toward the McEventCollection the (transient) TruthParticleContainer is proxyin...
const ElementLink< McEventCollection > & genEventLink() const
Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying, as a link.
void setGenEvent(const ElementLink< McEventCollection > &genEvent)
Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying.
void setEtIsolations(const ElementLink< TruthEtIsolationsContainer > &etIsolations)
Setup the persistent pointer toward the TruthEtIsolations.
MsgStream & msg
Definition testRead.cxx:32