ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
TruthParticleID
McParticleEventTPCnv
src
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
18
#include "
AtlasHepMC/GenParticle.h
"
19
#include "
GeneratorObjects/McEventCollection.h
"
20
21
// McParticleKernel includes
22
#include "
McParticleKernel/ITruthParticleCnvTool.h
"
23
24
// McParticleEvent includes
25
#include "
McParticleEvent/TruthParticle.h
"
26
#include "
McParticleEvent/TruthParticleContainer.h
"
27
#include "
McParticleEvent/TruthEtIsolationsContainer.h
"
28
29
// McParticleEventTPCnv includes
30
#include "
McParticleEventTPCnv/TruthParticleContainerCnv_p5.h
"
31
32
33
void
34
TruthParticleContainerCnv_p5::persToTrans
(
const
TruthParticleContainer_p5
* pers,
35
TruthParticleContainer
* trans,
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>
52
ElementLink<McEventCollection>
genEventEL;
53
m_genEvtCnv
.persToTrans( &pers->
m_genEvent
,
54
&genEventEL,
55
msg
);
56
trans->
setGenEvent
(genEventEL);
57
58
const
McEventCollection
* evt = trans->
genEventLink
().
getStorableObjectPointer
();
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,
67
pers->
m_genEvent
.
m_elementIndex
,
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 !!
86
ElementLink<TruthEtIsolationsContainer>
etIsolEL;
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
98
void
99
TruthParticleContainerCnv_p5::transToPers
(
const
TruthParticleContainer
*,
100
TruthParticleContainer_p5
*,
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
121
#include "
RootTruthParticleCnvTool.h
"
122
T_TPCnv<TruthParticleContainer, TruthParticleContainer_p5>::T_TPCnv
()
123
{
124
m_cnvTool
=
new
RootTruthParticleCnvTool
;
125
}
126
127
128
T_TPCnv<TruthParticleContainer, TruthParticleContainer_p5>::~T_TPCnv
()
129
{
130
delete
m_cnvTool
;
131
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
GenParticle.h
ITruthParticleCnvTool.h
McEventCollection.h
TruthParticleContainer.h
TruthParticle.h
RootTruthParticleCnvTool.h
TruthEtIsolationsContainer.h
TruthParticleContainerCnv_p5.h
ElementLink_p1::m_contName
std::string m_contName
Definition
ElementLink_p1.h:28
ElementLink_p1::m_elementIndex
INDEXTYPE m_elementIndex
Definition
ElementLink_p1.h:29
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
ElementLink::getStorableObjectPointer
BaseConstPointer getStorableObjectPointer() const
Retrieve storable object pointer.
ElementLink::isValid
bool isValid() const
Check if the element can be found.
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
RootTruthParticleCnvTool
Definition
RootTruthParticleCnvTool.h:15
T_TPCnv< TruthParticleContainer, TruthParticleContainer_p5 >::T_TPCnv
T_TPCnv()
Definition
TruthParticleContainerCnv_p5.cxx:122
TruthParticleContainerCnv_p5::transToPers
virtual void transToPers(const TruthParticleContainer *transObj, TruthParticleContainer_p5 *persObj, MsgStream &msg) const override
Method creating the persistent representation TruthParticleContainer_p5 from its transient representa...
Definition
TruthParticleContainerCnv_p5.cxx:99
TruthParticleContainerCnv_p5::m_cnvTool
ITruthParticleCnvTool * m_cnvTool
Pointer to the IAlgTool providing the conversion from a McEventCollection to a TruthParticleContainer...
Definition
TruthParticleContainerCnv_p5.h:75
TruthParticleContainerCnv_p5::m_etIsolCnv
ElementLinkCnv_p1< ElementLink< TruthEtIsolationsContainer > > m_etIsolCnv
Converter for the ElementLink<TruthEtIsolationsContainer> data member.
Definition
TruthParticleContainerCnv_p5.h:83
TruthParticleContainerCnv_p5::m_genEvtCnv
ElementLinkCnv_p1< ElementLink< McEventCollection > > m_genEvtCnv
Converter for the ElementLink<McEventCollection> data member.
Definition
TruthParticleContainerCnv_p5.h:79
TruthParticleContainerCnv_p5::persToTrans
virtual void persToTrans(const TruthParticleContainer_p5 *persObj, TruthParticleContainer *transObj, MsgStream &msg) const override
Method creating the transient representation of TruthParticleContainer from its persistent representa...
Definition
TruthParticleContainerCnv_p5.cxx:34
TruthParticleContainer_p5
Definition
TruthParticleContainer_p5.h:27
TruthParticleContainer_p5::m_etIsolations
ElementLinkInt_p1 m_etIsolations
The persistent pointer toward the TruthEtIsolations container the (transient) TruthParticleContainer ...
Definition
TruthParticleContainer_p5.h:51
TruthParticleContainer_p5::m_genEvent
ElementLinkInt_p1 m_genEvent
The persistent pointer toward the McEventCollection the (transient) TruthParticleContainer is proxyin...
Definition
TruthParticleContainer_p5.h:45
TruthParticleContainer
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:42
TruthParticleContainer::genEventLink
const ElementLink< McEventCollection > & genEventLink() const
Retrieve the HepMC::GenEvent this TruthParticleContainer is proxying, as a link.
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:237
TruthParticleContainer::setGenEvent
void setGenEvent(const ElementLink< McEventCollection > &genEvent)
Setup the persistent pointer toward the HepMC::GenEvent this TruthParticleContainer is proxying.
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:290
TruthParticleContainer::setEtIsolations
void setEtIsolations(const ElementLink< TruthEtIsolationsContainer > &etIsolations)
Setup the persistent pointer toward the TruthEtIsolations.
Definition
PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:307
error
Definition
IImpactPoint3dEstimator.h:72
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0