ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
TruthParticleID
McParticleEventTPCnv
src
TruthEtIsolationsCnv_p1.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
// TruthEtIsolationsCnv_p1.cxx
8
// Implementation file for class TruthEtIsolationsCnv_p1
9
// Author: S.Binet<binet@cern.ch>
11
12
13
// STL includes
14
15
// Framework includes
16
#include "GaudiKernel/MsgStream.h"
17
18
// HepMc includes
19
#include "
GeneratorObjects/McEventCollection.h
"
20
21
// McParticleEvent includes
22
#include "
McParticleEvent/TruthEtIsolations.h
"
23
24
// McParticleEventTPCnv includes
25
#include "
McParticleEventTPCnv/TruthEtIsolationsCnv_p1.h
"
26
27
28
typedef
TruthEtIsolations_p1::EtIsolMap_t
EtIsolMap_p
;
29
typedef
TruthEtIsolations_p1::EtIsolBc_t
EtIsolBc_p
;
30
typedef
TruthEtIsolations_p1::EtIsolations_t
EtIsolations_p
;
31
typedef
TruthEtIsolations::EtIsolMap_t
EtIsolMap_t
;
32
33
void
34
TruthEtIsolationsCnv_p1::persToTrans
(
const
TruthEtIsolations_p1
* pers,
35
TruthEtIsolations
*
trans
,
36
MsgStream&
msg
)
const
37
{
38
msg
<< MSG::DEBUG
39
<<
"Loading TruthEtIsolations from persistent state..."
40
<<
endmsg
;
41
42
if
(0==pers || 0==
trans
) {
43
msg
<< MSG::WARNING
44
<<
"null pointer(s) received ! trans=["
<<
trans
<<
"] pers=["
45
<< pers <<
"]"
46
<<
endmsg
;
47
return
;
48
}
49
50
// convert the ElementLink<McEventCollection>
51
m_genEvtCnv
.persToTrans( &pers->
m_genEvent
,
52
&
trans
->m_genEvtLink,
53
msg
);
54
55
const
McEventCollection
* evt=
trans
->m_genEvtLink.getStorableObjectPointer();
56
if
( 0 == evt ) {
57
const
std::string
error
(
"NULL pointer to McEventCollection !!"
);
58
msg
<< MSG::ERROR <<
error
59
<<
endmsg
;
60
throw
std::runtime_error(
error
);
61
}
62
63
for
( EtIsolMap_p::const_iterator
64
i = pers->
m_etIsolations
.begin(),
65
iEnd = pers->
m_etIsolations
.end();
66
i != iEnd;
67
++i ) {
68
McAod::EtIsolations
& etIsols =
trans
->m_etIsolations[i->first];
69
std::copy( i->second.begin(), i->second.end(),
70
etIsols.begin() );
71
}
72
73
msg
<< MSG::DEBUG
74
<<
"Loaded TruthEtIsolations from persistent state [OK]"
75
<<
endmsg
;
76
return
;
77
}
78
79
void
80
TruthEtIsolationsCnv_p1::transToPers
(
const
TruthEtIsolations
*
trans
,
81
TruthEtIsolations_p1
* pers,
82
MsgStream&
msg
)
const
83
{
84
msg
<< MSG::DEBUG
85
<<
"Creating persistent state of TruthEtIsolations..."
86
<<
endmsg
;
87
88
// convert the ElementLink<McEventCollection>
89
m_genEvtCnv
.transToPers( &
trans
->m_genEvtLink,
90
&pers->
m_genEvent
,
91
msg
);
92
93
if
( !
trans
->m_genEvtLink.isValid() ) {
94
msg
<< MSG::WARNING
95
<<
"Transient ElementLink to McEventCollection is NOT valid !!"
96
<<
endmsg
;
97
}
98
99
pers->
m_etIsolations
.reserve(
trans
->size() );
100
for
( EtIsolMap_t::const_iterator
101
i =
trans
->m_etIsolations.begin(),
102
iEnd =
trans
->m_etIsolations.end();
103
i != iEnd;
104
++i ) {
105
pers->
m_etIsolations
.push_back(
EtIsolBc_p
( i->first,
EtIsolations_p
() ) );
106
EtIsolations_p
& etIsols = pers->
m_etIsolations
.back().second;
107
std::copy( i->second.begin(),
108
i->second.end(),
109
etIsols.begin() );
110
}
111
return
;
112
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
McEventCollection.h
EtIsolMap_t
TruthEtIsolations::EtIsolMap_t EtIsolMap_t
Definition
TruthEtIsolationsCnv_p1.cxx:31
EtIsolBc_p
TruthEtIsolations_p1::EtIsolBc_t EtIsolBc_p
Definition
TruthEtIsolationsCnv_p1.cxx:29
EtIsolations_p
TruthEtIsolations_p1::EtIsolations_t EtIsolations_p
Definition
TruthEtIsolationsCnv_p1.cxx:30
EtIsolMap_p
TruthEtIsolations_p1::EtIsolMap_t EtIsolMap_p
Definition
TruthEtIsolationsCnv_p1.cxx:28
TruthEtIsolationsCnv_p1.h
TruthEtIsolations.h
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
TruthEtIsolationsCnv_p1::transToPers
virtual void transToPers(const TruthEtIsolations *transObj, TruthEtIsolations_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation TruthEtIsolations_p1 from its transient representation ...
Definition
TruthEtIsolationsCnv_p1.cxx:80
TruthEtIsolationsCnv_p1::persToTrans
virtual void persToTrans(const TruthEtIsolations_p1 *persObj, TruthEtIsolations *transObj, MsgStream &msg) const override
Method creating the transient representation of TruthEtIsolations from its persistent representation ...
Definition
TruthEtIsolationsCnv_p1.cxx:34
TruthEtIsolationsCnv_p1::m_genEvtCnv
ElementLinkCnv_p1< ElementLink< McEventCollection > > m_genEvtCnv
Converter for the ElementLink<McEventCollection> data member.
Definition
TruthEtIsolationsCnv_p1.h:62
TruthEtIsolations_p1
Definition
TruthEtIsolations_p1.h:31
TruthEtIsolations_p1::m_etIsolations
EtIsolMap_t m_etIsolations
The persistent representation of Et-isolations: a vector pairs (barcode, array-of-Et-isols).
Definition
TruthEtIsolations_p1.h:83
TruthEtIsolations_p1::EtIsolBc_t
std::pair< int, EtIsolations_t > EtIsolBc_t
Definition
TruthEtIsolations_p1.h:47
TruthEtIsolations_p1::m_genEvent
ElementLinkInt_p1 m_genEvent
The persistent pointer toward the McEventCollection the (transient) TruthEtIsolations has been comput...
Definition
TruthEtIsolations_p1.h:79
TruthEtIsolations_p1::EtIsolations_t
std::array< float, TruthParticleParameters::NbrOfCones > EtIsolations_t
Definition
TruthEtIsolations_p1.h:45
TruthEtIsolations_p1::EtIsolMap_t
std::vector< EtIsolBc_t > EtIsolMap_t
Definition
TruthEtIsolations_p1.h:48
TruthEtIsolations
container which holds isolation informations for a given HepMC::GenParticle (labelled by barcode) for...
Definition
TruthEtIsolations.h:40
TruthEtIsolations::EtIsolMap_t
std::unordered_map< int, EtIsol_t > EtIsolMap_t
The map of barcode-to-Et isolations.
Definition
TruthEtIsolations.h:55
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:199
McAod::EtIsolations
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
Definition
TruthParticleParamDefs.h:60
error
Definition
IImpactPoint3dEstimator.h:72
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0