ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetSamplingCollectionCnv_p2.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_p2.cxx
8
// Implementation file for class JetSamplingCollectionCnv_p2
9
// Created by Belen.Salvachua@cern.ch based on JetSamplingCollectionCnv_p1.cxx from
10
// S.Binet<binet@cern.ch>
11
// Date: Dec 2008
13
14
// DataModel includes
15
#include "
AthAllocators/DataPool.h
"
16
17
// JetEvent includes
18
#include "
JetEvent/JetSampling.h
"
19
#include "
JetEvent/JetSamplingCollection.h
"
20
21
22
// JetEventTPCnv includes
23
#include "
JetEventTPCnv/JetSamplingCnv_p2.h
"
24
#include "
JetEventTPCnv/JetSamplingCollection_p2.h
"
25
#include "
JetEventTPCnv/JetSamplingCollectionCnv_p2.h
"
26
27
// preallocate converters
28
static
const
JetSamplingCnv_p2
jetSamplingCnv
;
29
30
31
void
32
JetSamplingCollectionCnv_p2::persToTrans
(
const
JetSamplingCollection_p2
* pers,
33
JetSamplingCollection
* trans,
34
MsgStream&
msg
)
const
35
{
36
// msg << MSG::DEBUG << "Loading JetSamplingCollection from persistent state..."
37
// << endmsg;
38
39
40
// elements are managed by DataPool
41
trans->
clear
(
SG::VIEW_ELEMENTS
);
42
43
DataPool<JetSampling>
pool
( 20 );
44
const
std::size_t nJetSampling = pers->size();
45
if
(
pool
.capacity() -
pool
.allocated() < nJetSampling ) {
46
pool
.reserve(
pool
.allocated() + nJetSampling );
47
}
48
49
trans->
reserve
( nJetSampling );
50
for
( JetSamplingCollection_p2::const_iterator
51
itr = pers->begin(),
52
itrEnd = pers->end();
53
itr != itrEnd;
54
++itr ) {
55
JetSampling
* jetSampling =
pool
.nextElementPtr();
56
jetSamplingCnv
.persToTrans( &(*itr), jetSampling,
msg
);
57
trans->
push_back
( jetSampling );
58
}
59
// msg << MSG::DEBUG << "Loading JetSamplingCollection from persistent state [OK]"
60
// << endmsg;
61
}
62
63
void
64
JetSamplingCollectionCnv_p2::transToPers
(
const
JetSamplingCollection
* trans,
65
JetSamplingCollection_p2
* pers,
66
MsgStream&
msg
)
const
67
{
68
// msg << MSG::DEBUG << "Creating persistent state of JetSamplingCollection..."
69
// << endmsg;
70
71
std::size_t
size
= trans->
size
();
72
pers->resize(
size
);
73
74
// convert vector entries one by one
75
JetSamplingCollection::const_iterator
transItr = trans->
begin
();
76
JetSamplingCollection_p2::iterator persItr = pers->begin();
77
while
(
size
) {
78
jetSamplingCnv
.transToPers( *transItr, &(*persItr),
msg
);
79
++persItr; ++transItr; --
size
;
80
}
81
82
// msg << MSG::DEBUG << "Creating persistent state of JetSamplingCollection [OK]"
83
// << endmsg;
84
}
DataPool.h
JetSamplingCnv_p2.h
jetSamplingCnv
static const JetSamplingCnv_p1 jetSamplingCnv
Definition
JetSamplingCollectionCnv_p1.cxx:26
JetSamplingCollectionCnv_p2.h
JetSamplingCollection.h
JetSamplingCollection_p2.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_p2
Definition
JetSamplingCnv_p2.h:33
JetSamplingCollectionCnv_p2::persToTrans
virtual void persToTrans(const JetSamplingCollection_p2 *pers, JetSamplingCollection *trans, MsgStream &msg) const override
Method creating the transient representation of JetSamplingCollection from its persistent representat...
Definition
JetSamplingCollectionCnv_p2.cxx:32
JetSamplingCollectionCnv_p2::transToPers
virtual void transToPers(const JetSamplingCollection *trans, JetSamplingCollection_p2 *pers, MsgStream &msg) const override
Method creating the persistent representation JetSamplingCollection_p2 from its transient representat...
Definition
JetSamplingCollectionCnv_p2.cxx:64
JetSamplingCollection_p2
Definition
JetSamplingCollection_p2.h:26
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