ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetCollectionCnv_p6.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// JetCollectionCnv_p6.cxx
8
// Implementation file for class JetCollectionCnv_p6
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_p6.h
"
22
#include "
JetEventTPCnv/JetCollection_p6.h
"
23
#include "
JetEventTPCnv/JetCollectionCnv_p6.h
"
24
#include "
JetEventTPCnv/JetKeyDescriptorCnv_p1.h
"
25
26
// DataModelAthenaPool includes
27
#include "
DataModelAthenaPool/DataLinkCnv_p2.h
"
28
29
// preallocate converters
30
static
const
JetCnv_p6
jetCnv
;
31
static
const
JetKeyDescriptorCnv_p1
jetkeyCnv
;
32
33
34
void
35
JetCollectionCnv_p6::persToTrans
(
const
JetCollection_p6
* pers,
36
JetCollection
*
trans
,
37
MsgStream&
msg
)
const
38
{
39
msg
<< MSG::DEBUG <<
"Loading JetCollection from persistent state..."
40
<<
endmsg
;
41
42
// make sure to first read the JetKeyDescriptor
43
DataLinkCnv_p2<DataLink<JetKeyDescriptor>
> JetKeyStoreCnv;
44
JetKeyStoreCnv.
persToTrans
( &pers->
m_keyStore
, &
trans
->m_keyStore,
msg
);
45
// link the JetKeyDescriptorInstance to the store:
46
if
(
trans
->m_keyStore.isValid() ){
47
trans
->keyDesc()->m_Stores =
nullptr
;
48
trans
->keyDesc()->m_ConstStores =
trans
->m_keyStore.cptr();
49
// make sure the global instance is pointing to this jetkey store
50
JetKeyDescriptorInstance::instance
()->
m_Stores
=
nullptr
;
51
JetKeyDescriptorInstance::instance
()->
m_ConstStores
=
trans
->keyDesc()->m_ConstStores;
52
}
53
else
if
(
trans
->m_keyStore.isDefault()) {
54
DataLink<JetKeyDescriptor>
dl (
"JetKeyMap"
);
55
if
(dl.isValid()) {
56
trans
->keyDesc()->m_Stores =
nullptr
;
57
trans
->keyDesc()->m_ConstStores = dl.cptr();
58
// make sure the global instance is pointing to this jetkey store
59
JetKeyDescriptorInstance::instance
()->
m_Stores
=
nullptr
;
60
JetKeyDescriptorInstance::instance
()->
m_ConstStores
=
trans
->keyDesc()->m_ConstStores;
61
}
62
else
{
63
trans
->keyDesc()->m_Stores =
64
JetKeyDescriptorInstance::instance
()->
m_Stores
;
65
trans
->keyDesc()->m_ConstStores =
66
JetKeyDescriptorInstance::instance
()->
m_ConstStores
;
67
}
68
}
69
else
{
70
trans
->keyDesc()->m_Stores =
JetKeyDescriptorInstance::instance
()->
m_Stores
;
71
trans
->keyDesc()->m_ConstStores =
JetKeyDescriptorInstance::instance
()->
m_ConstStores
;
72
}
73
74
msg
<< MSG::DEBUG <<
"attached JetKeyDescriptor to its instance"
<<
endmsg
;
75
77
78
trans
->setOrdered (
static_cast<
JetCollection::OrderedVar
>
(pers->
m_ordered
));
79
// not used any more ... trans->m_ROIauthor = //pers->m_roiAuthor;
80
82
83
for
(
Jet
*
jet
: *
trans
) {
84
jet
->setJetId(
Jet::s_defaultJetId
);
85
}
86
87
trans
->clear();
88
trans
->reserve(pers->size());
89
90
trans
->m_jetAuthor = pers->
m_jetAuthor
;
91
trans
->m_ownMap = 0;
92
93
// std::cout << " JetCollectionCnv_p6 Converting "<< trans->author() << std::endl;
94
// std::cout << " JetCollectionCnv_p6 dalink "<< trans->m_momentMapLink.isValid() << " "<< trans->m_momentMapLink.dataID() << std::endl;
95
96
for
(
const
TPObjRef
&
ref
: *pers) {
97
Jet
* j =
createTransFromPStore
((
ITPConverterFor<Jet>
**)
nullptr
,
ref
,
msg
);
98
size_t
id
= j->m_jetId;
99
trans
->push_back(j);
100
//std::cout << " reading jet "<< id << " "<< pers->m_jetIdBugFixed << std::endl;
101
if
(pers->
m_jetIdBugFixed
) j->setJetId(
id
);
// when the bug wasn't fixed id is wrong, so don't set it.
102
// associate this collection to its jets :
103
trans
->back()->m_collection =
trans
;
104
}
105
//std::cout << " JetCollectionCnv_p6 dalink "<< trans->m_momentMapLink.isValid() << " "<< trans->m_momentMapLink.dataID() << std::endl;
106
107
108
// Force PseudoJet pointer to null
109
trans
->setFastjetClustSeq(
nullptr
);
110
111
msg
<< MSG::DEBUG <<
"Loading JetCollection from persistent state [OK]"
112
<<
endmsg
;
113
}
114
115
void
116
JetCollectionCnv_p6::transToPers
(
const
JetCollection
*
trans
,
117
JetCollection_p6
* pers,
118
MsgStream&
msg
)
const
119
{
120
// msg << MSG::DEBUG << "Creating persistent state of JetCollection..."
121
// << endmsg;
122
123
pers->
m_ordered
=
static_cast<
short
>
(
trans
->ordered());
124
// not used any more ... //pers->m_roiAuthor = trans->m_ROIauthor;
125
pers->
m_jetAuthor
=
trans
->m_jetAuthor ;
126
127
pers->
m_jetIdBugFixed
=
true
;
// the bug is now fixed
128
129
pers->clear();
130
pers->reserve(
trans
->size());
131
132
for
(
const
Jet
*
jet
: *
trans
) {
133
pers->push_back(
toPersistent
((
ITPConverterFor<Jet>
**)
nullptr
,
jet
,
msg
));
134
}
135
136
// RS now deal with the JetKeyDescriptor
137
DataLinkCnv_p2<DataLink<JetKeyDescriptor>
> JetKeyStoreCnv;
138
JetKeyStoreCnv.
transToPers
( &
trans
->m_keyStore, &pers->
m_keyStore
,
msg
);
139
}
ref
const std::regex ref(r_ef)
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
DataLinkCnv_p2.h
This file contains the class definition for the DataLinkCnv_p2 class and DataLinkVectorCnv_p2 class.
DataPool.h
JetCnv_p6.h
JetCnv_p6
JetConverterBase< Jet_p6 > JetCnv_p6
Definition
JetCnv_p6.h:86
jetCnv
static const JetCnv_p1 jetCnv
Definition
JetCollectionCnv_p1.cxx:28
jetkeyCnv
static const JetKeyDescriptorCnv_p1 jetkeyCnv
Definition
JetCollectionCnv_p2.cxx:33
JetCollectionCnv_p6.h
JetCollection.h
JetCollection_p6.h
JetKeyDescriptorCnv_p1.h
Jet.h
DataLinkCnv_p2
Definition
DataLinkCnv_p2.h:23
DataLinkCnv_p2::transToPers
virtual void transToPers(const DLink_t &trans, PersDLink_t &pers, MsgStream &log) const
DataLinkCnv_p2::persToTrans
virtual void persToTrans(const PersDLink_t &pers, DLink_t &trans, MsgStream &log) const
DataLink
Object reference supporting deferred reading from StoreGate.
Definition
AthLinks/DataLink.h:93
ITPConverterFor
Common base class for all TP converters, specialized for a given transient type.
Definition
TPConverter.h:37
TPPolyCnvBase< TRANS, TRANS, PERS >::createTransFromPStore
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Definition
TPConverter.h:172
TPPolyCnvBase< TRANS, TRANS, PERS >::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Definition
TPConverter.h:119
JetCollectionCnv_p6::persToTrans
virtual void persToTrans(const JetCollection_p6 *pers, JetCollection *trans, MsgStream &msg) const override
Method creating the transient representation of JetCollection from its persistent representation JetC...
Definition
JetCollectionCnv_p6.cxx:35
JetCollectionCnv_p6::transToPers
virtual void transToPers(const JetCollection *trans, JetCollection_p6 *pers, MsgStream &msg) const override
Method creating the persistent representation JetCollection_p1 from its transient representation JetC...
Definition
JetCollectionCnv_p6.cxx:116
JetCollection_p6
Definition
JetCollection_p6.h:29
JetCollection_p6::m_ordered
short m_ordered
Definition
JetCollection_p6.h:42
JetCollection_p6::m_jetIdBugFixed
bool m_jetIdBugFixed
Definition
JetCollection_p6.h:47
JetCollection_p6::m_jetAuthor
unsigned short m_jetAuthor
Definition
JetCollection_p6.h:45
JetCollection_p6::m_keyStore
DataLink_p2 m_keyStore
Definition
JetCollection_p6.h:43
JetCollection
Definition
JetCollection.h:30
JetCollection::OrderedVar
OrderedVar
Definition
JetCollection.h:35
JetKeyDescriptorCnv_p1
Definition
JetKeyDescriptorCnv_p1.h:17
JetKeyDescriptorInstance::m_ConstStores
const JetKeyDescriptor * m_ConstStores
Definition
JetKeyDescriptor.h:156
JetKeyDescriptorInstance::m_Stores
JetKeyDescriptor * m_Stores
Definition
JetKeyDescriptor.h:155
JetKeyDescriptorInstance::instance
static JetKeyDescriptorInstance * instance()
Definition
JetKeyDescriptor.h:123
Jet
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
Jet::s_defaultJetId
static const size_t s_defaultJetId
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:670
TPObjRef
This class is an object reference used in Athena persistent data model.
Definition
TPObjRef.h:20
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:185
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0