ATLAS Offline Software
Loading...
Searching...
No Matches
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
20
21// McParticleEvent includes
23
24// McParticleEventTPCnv includes
26
27
32
33void
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
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
79void
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}
#define endmsg
TruthEtIsolations::EtIsolMap_t EtIsolMap_t
TruthEtIsolations_p1::EtIsolBc_t EtIsolBc_p
TruthEtIsolations_p1::EtIsolations_t EtIsolations_p
TruthEtIsolations_p1::EtIsolMap_t EtIsolMap_p
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual void transToPers(const TruthEtIsolations *transObj, TruthEtIsolations_p1 *persObj, MsgStream &msg) const override
Method creating the persistent representation TruthEtIsolations_p1 from its transient representation ...
virtual void persToTrans(const TruthEtIsolations_p1 *persObj, TruthEtIsolations *transObj, MsgStream &msg) const override
Method creating the transient representation of TruthEtIsolations from its persistent representation ...
ElementLinkCnv_p1< ElementLink< McEventCollection > > m_genEvtCnv
Converter for the ElementLink<McEventCollection> data member.
EtIsolMap_t m_etIsolations
The persistent representation of Et-isolations: a vector pairs (barcode, array-of-Et-isols)
std::pair< int, EtIsolations_t > EtIsolBc_t
ElementLinkInt_p1 m_genEvent
The persistent pointer toward the McEventCollection the (transient) TruthEtIsolations has been comput...
std::array< float, TruthParticleParameters::NbrOfCones > EtIsolations_t
std::vector< EtIsolBc_t > EtIsolMap_t
container which holds isolation informations for a given HepMC::GenParticle (labelled by barcode) for...
std::unordered_map< int, EtIsol_t > EtIsolMap_t
The map of barcode-to-Et isolations.
std::size_t size() const
Return the number of HepMC::GenParticle for which Et isolations have been stored into this TruthEtIso...
GenEventLink_t m_genEvtLink
ElementLink to the HepMC::GenEvent from which the Et isolations have been (or will be) computed
EtIsolMap_t m_etIsolations
Holds transverse energy isolations for different isolation cones The key of this map is the barcode o...
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
MsgStream & msg
Definition testRead.cxx:32