ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetCollectionCnv_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
// JetCollectionCnv_p1.cxx
8
// Implementation file for class JetCollectionCnv_p1
9
// Author: S.Binet<binet@cern.ch>
11
12
// DataModel includes
13
#include "
AthAllocators/DataPool.h
"
14
15
// JetEvent includes
16
#include "
JetEvent/Jet.h
"
17
#include "
JetEvent/JetCollection.h
"
18
19
20
// JetEventTPCnv includes
21
#include "
JetEventTPCnv/JetCnv_p1.h
"
22
#include "
JetEventTPCnv/JetCollection_p1.h
"
23
#include "
JetEventTPCnv/JetCollectionCnv_p1.h
"
24
25
#include <sstream>
26
27
// preallocate converters
28
static
const
JetCnv_p1
jetCnv
;
29
30
31
void
32
JetCollectionCnv_p1::persToTrans
(
const
JetCollection_p1
* pers,
33
JetCollection
* trans,
34
MsgStream&
msg
)
const
35
{
36
// msg << MSG::DEBUG << "Loading JetCollection from persistent state..."
37
// << endmsg;
38
39
// elements are managed by DataPool
40
trans->
clear
(
SG::VIEW_ELEMENTS
);
41
42
DataPool<Jet>
pool
( 20 );
43
const
std::size_t nJets = pers->size();
44
if
(
pool
.capacity() -
pool
.allocated() < nJets ) {
45
pool
.reserve(
pool
.allocated() + nJets );
46
}
47
48
trans->
setOrdered
(
static_cast<
JetCollection::OrderedVar
>
(pers->
m_ordered
));
49
// the transient version does not have this data member any more,
50
// each jet knows its ROI
51
// trans->m_ROIauthor = //pers->m_roiAuthor;
52
53
trans->
reserve
( nJets );
54
for
( JetCollection_p1::const_iterator
55
itr = pers->begin(),
56
itrEnd = pers->end();
57
itr != itrEnd;
58
++itr ) {
59
Jet
*
jet
=
pool
.nextElementPtr();
60
jetCnv
.persToTrans( &(*itr),
jet
,
msg
);
61
trans->
push_back
(
jet
);
62
}
63
64
// now each jet knows its ROI
65
unsigned
int
RoIWord;
66
std::stringstream strm(pers->
m_roiAuthor
);
67
strm >> RoIWord;
68
if
( strm.good() )
69
{
70
msg
<< MSG::DEBUG <<
"Note: This jet collection uses RoIWords!"
<<
endmsg
;
71
for
(
JetCollection::iterator
itr = trans->
begin
(); itr != trans->
end
(); ++itr )
72
(*itr)->set_RoIword( RoIWord );
73
}
74
// msg << MSG::DEBUG << "Loading JetCollection from persistent state [OK]"
75
// << endmsg;
76
}
77
78
void
79
JetCollectionCnv_p1::transToPers
(
const
JetCollection
* trans,
80
JetCollection_p1
* pers,
81
MsgStream&
msg
)
const
82
{
83
// msg << MSG::DEBUG << "Creating persistent state of JetCollection..."
84
// << endmsg;
85
86
pers->
m_ordered
=
static_cast<
short
>
(trans->
ordered
());
87
//pers->m_roiAuthor = trans->m_ROIauthor;
88
89
std::size_t
size
= trans->
size
();
90
pers->resize(
size
);
91
92
// convert vector entries one by one
93
JetCollection::const_iterator
transItr = trans->
begin
();
94
JetCollection_p1::iterator persItr = pers->begin();
95
while
(
size
) {
96
jetCnv
.transToPers( *transItr, &(*persItr),
msg
);
97
++persItr; ++transItr; --
size
;
98
}
99
100
// msg << MSG::DEBUG << "Creating persistent state of JetCollection [OK]"
101
// << endmsg;
102
}
103
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
DataPool.h
JetCnv_p1.h
jetCnv
static const JetCnv_p1 jetCnv
Definition
JetCollectionCnv_p1.cxx:28
JetCollectionCnv_p1.h
JetCollection.h
JetCollection_p1.h
Jet.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< Jet >::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::end
const_iterator end() const noexcept
Return a const_iterator pointing past 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.
JetCnv_p1
Definition
JetCnv_p1.h:27
JetCollectionCnv_p1::transToPers
virtual void transToPers(const JetCollection *trans, JetCollection_p1 *pers, MsgStream &msg) const override
Method creating the persistent representation JetCollection_p1 from its transient representation JetC...
Definition
JetCollectionCnv_p1.cxx:79
JetCollectionCnv_p1::persToTrans
virtual void persToTrans(const JetCollection_p1 *pers, JetCollection *trans, MsgStream &msg) const override
Method creating the transient representation of JetCollection from its persistent representation JetC...
Definition
JetCollectionCnv_p1.cxx:32
JetCollection_p1
Definition
JetCollection_p1.h:26
JetCollection_p1::m_ordered
short m_ordered
Definition
JetCollection_p1.h:39
JetCollection_p1::m_roiAuthor
std::string m_roiAuthor
Definition
JetCollection_p1.h:38
JetCollection
Definition
JetCollection.h:30
JetCollection::OrderedVar
OrderedVar
Definition
JetCollection.h:35
JetCollection::ordered
JetCollection::OrderedVar ordered() const
Definition
JetCollection.h:68
JetCollection::setOrdered
void setOrdered(JetCollection::OrderedVar ordered)
Definition
JetCollection.h:65
JetCollection::clear
void clear()
Definition
JetCollection.cxx:96
JetCollection::iterator
DataVector< Jet >::iterator iterator
Definition
JetCollection.h:34
JetCollection::push_back
void push_back(Jet *j)
Definition
JetCollection.cxx:85
Jet
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
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