ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetSamplingCollectionCnv_p1.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// JetSamplingCollectionCnv_p1.cxx
8
// Implementation file for class JetSamplingCollectionCnv_p1
9
// Author: S.Binet<binet@cern.ch>
11
12
// DataModel includes
13
#include "
AthAllocators/DataPool.h
"
14
15
// JetEvent includes
16
#include "
JetEvent/JetSampling.h
"
17
#include "
JetEvent/JetSamplingCollection.h
"
18
19
20
// JetEventTPCnv includes
21
#include "
JetEventTPCnv/JetSamplingCnv_p1.h
"
22
#include "
JetEventTPCnv/JetSamplingCollection_p1.h
"
23
#include "
JetEventTPCnv/JetSamplingCollectionCnv_p1.h
"
24
25
// preallocate converters
26
static
const
JetSamplingCnv_p1
jetSamplingCnv
;
27
28
29
void
30
JetSamplingCollectionCnv_p1::persToTrans
(
const
JetSamplingCollection_p1
* pers,
31
JetSamplingCollection
* trans,
32
MsgStream&
msg
)
const
33
{
34
// msg << MSG::DEBUG << "Loading JetSamplingCollection from persistent state..."
35
// << endmsg;
36
37
38
// elements are managed by DataPool
39
trans->
clear
(
SG::VIEW_ELEMENTS
);
40
41
DataPool<JetSampling>
pool
( 20 );
42
const
std::size_t nJetSampling = pers->size();
43
if
(
pool
.capacity() -
pool
.allocated() < nJetSampling ) {
44
pool
.reserve(
pool
.allocated() + nJetSampling );
45
}
46
47
trans->
reserve
( nJetSampling );
48
for
( JetSamplingCollection_p1::const_iterator
49
itr = pers->begin(),
50
itrEnd = pers->end();
51
itr != itrEnd;
52
++itr ) {
53
JetSampling
* jetSampling =
pool
.nextElementPtr();
54
jetSamplingCnv
.persToTrans( &(*itr), jetSampling,
msg
);
55
trans->
push_back
( jetSampling );
56
}
57
// msg << MSG::DEBUG << "Loading JetSamplingCollection from persistent state [OK]"
58
// << endmsg;
59
}
60
61
void
62
JetSamplingCollectionCnv_p1::transToPers
(
const
JetSamplingCollection
* trans,
63
JetSamplingCollection_p1
* pers,
64
MsgStream&
msg
)
const
65
{
66
// msg << MSG::DEBUG << "Creating persistent state of JetSamplingCollection..."
67
// << endmsg;
68
69
std::size_t
size
= trans->
size
();
70
pers->resize(
size
);
71
72
// convert vector entries one by one
73
JetSamplingCollection::const_iterator
transItr = trans->
begin
();
74
JetSamplingCollection_p1::iterator persItr = pers->begin();
75
while
(
size
) {
76
jetSamplingCnv
.transToPers( *transItr, &(*persItr),
msg
);
77
++persItr; ++transItr; --
size
;
78
}
79
80
// msg << MSG::DEBUG << "Creating persistent state of JetSamplingCollection [OK]"
81
// << endmsg;
82
}
83
DataPool.h
JetSamplingCnv_p1.h
jetSamplingCnv
static const JetSamplingCnv_p1 jetSamplingCnv
Definition
JetSamplingCollectionCnv_p1.cxx:26
JetSamplingCollectionCnv_p1.h
JetSamplingCollection.h
JetSamplingCollection_p1.h
JetSampling.h
size
size_t size() const
Number of registered mappings.
DataPool
a typed memory pool that saves time spent allocation small object.
Definition
DataPool.h:63
DataVector< JetSampling >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::clear
void clear()
Erase all the elements in the collection.
JetSamplingCnv_p1
Definition
JetSamplingCnv_p1.h:31
JetSamplingCollectionCnv_p1::transToPers
virtual void transToPers(const JetSamplingCollection *trans, JetSamplingCollection_p1 *pers, MsgStream &msg) const override
Method creating the persistent representation JetSamplingCollection_p1 from its transient representat...
Definition
JetSamplingCollectionCnv_p1.cxx:62
JetSamplingCollectionCnv_p1::persToTrans
virtual void persToTrans(const JetSamplingCollection_p1 *pers, JetSamplingCollection *trans, MsgStream &msg) const override
Method creating the transient representation of JetSamplingCollection from its persistent representat...
Definition
JetSamplingCollectionCnv_p1.cxx:30
JetSamplingCollection_p1
Definition
JetSamplingCollection_p1.h:25
JetSamplingCollection
Definition
JetSamplingCollection.h:20
JetSampling
Definition
JetSampling.h:44
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
pool
Framework include files.
Definition
libname.h:15
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0