ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetCnv_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
// JetCnv_p1.cxx
8
// Implementation file for class JetCnv_p2
9
// Author: R.Seuster<seuster@cern.ch>
11
12
// STL includes
13
14
// JetEvent includes
15
#include "
JetEvent/Jet.h
"
16
#include "
JetEvent/JetTagInfoBase.h
"
17
#include "
JetEvent/JetAssociationBase.h
"
18
19
// DataModelAthenaPool includes
20
#include "
DataModelAthenaPool/NavigableCnv_p1.h
"
21
22
// EventCommonTPCnv includes
23
#include "
EventCommonTPCnv/P4ImplPxPyPzECnv_p1.h
"
24
25
// JetEventTPCnv includes
26
#include "
JetEventTPCnv/JetCnv_p2.h
"
27
28
using
NavigableCnv_t
=
NavigableCnv_p1<Navigable<INavigable4MomentumCollection, double>
>;
29
30
// pre-allocate converters
31
static
const
P4ImplPxPyPzECnv_p1
momCnv
;
32
static
const
NavigableCnv_t
navCnv
;
33
34
35
void
JetCnv_p2::persToTrans
(
const
Jet_p2
* pers,
36
Jet
*
trans
,
37
MsgStream&
msg
)
const
38
{
39
msg
<< MSG::DEBUG <<
"Loading Jet from persistent state..."
40
<<
endmsg
;
41
42
navCnv
.persToTrans( &pers->
m_nav
,
43
&
trans
->navigableBase(),
msg
);
44
momCnv
.persToTrans( &pers->
m_momentum
, &
trans
->momentumBase(),
msg
);
45
46
trans
->m_jetAuthor = pers->
m_author
;
47
48
//trans->m_combinedLikelihood = std::vector<double>( pers->m_combinedLikelihood );
49
trans
->setCombinedLikelihood(pers->
m_combinedLikelihood
);
50
trans
->m_jetId =
Jet::s_defaultJetId
;
51
52
// use swap() to avoid copying vector contents.
53
//const_cast<Jet_p2*>(pers)->m_shapeStore.swap ( *trans->m_shapeStore);
54
55
// create the store only if non-zero size (waste of space for constituents)
56
57
// Use swap to avoid copying the vector contents.
58
59
JetKeyDescriptorInstance
* keydesc =
JetKeyDescriptorInstance::instance
();
60
std::vector<std::string> momentNames = keydesc->
getKeys
(
JetKeyConstants::ShapeCat
);
61
if
( momentNames.size() != (pers)->m_shapeStore.size() )
msg
<< MSG::ERROR <<
" JEtCnv_p2 can't convert moments ! expected moment n= "
<< momentNames.size() <<
" persistatn has "
<< (pers)->m_shapeStore.size() <<
endmsg
;
62
else
for
(
size_t
i=0;i<momentNames.size();i++){
63
trans
->setMoment(momentNames[i], (pers)->m_shapeStore[i],
true
);
64
}
65
66
67
if
(
trans
->m_tagInfoStore)
68
const_cast<
Jet_p2
*
>
(pers)->m_tagJetInfo.swap (*
trans
->m_tagInfoStore);
69
else
if
( !(pers)->m_tagJetInfo.empty() ) {
70
trans
->m_tagInfoStore =
new
Jet::tagstore_t
;
71
const_cast<
Jet_p2
*
>
(pers)->m_tagJetInfo.swap (*
trans
->m_tagInfoStore);
72
}
73
74
if
(
trans
->m_assocStore)
75
const_cast<
Jet_p2
*
>
(pers)->m_associations.swap (*
trans
->m_assocStore);
76
else
if
( !(pers)->m_associations.empty() ) {
77
trans
->m_assocStore =
new
Jet::assostore_t
;
78
const_cast<
Jet_p2
*
>
(pers)->m_associations.swap (*
trans
->m_assocStore);
79
}
80
81
// Avoid memory leaks.
82
for
(
size_t
i = 0; i < pers->
m_tagJetInfo
.size(); i++)
83
delete
pers->
m_tagJetInfo
[i];
84
for
(
size_t
i = 0; i < pers->
m_associations
.size(); i++)
85
delete
pers->
m_associations
[i];
86
87
const_cast<
Jet_p2
*
>
(pers)->m_shapeStore.clear();
88
const_cast<
Jet_p2
*
>
(pers)->m_tagJetInfo.clear();
89
const_cast<
Jet_p2
*
>
(pers)->m_associations.clear();
90
91
// default signal state
92
trans
->setSignalState(
P4SignalState::CALIBRATED
);
93
94
// Jet comes from a DataPool.
95
// So we need to be sure to re-initialize everything in the Jet.
96
trans
->setRawE(
trans
->e() ) ;
97
trans
->setRawPx(
trans
->px() ) ;
98
trans
->setRawPy(
trans
->py() ) ;
99
trans
->setRawPz(
trans
->pz() ) ;
100
101
static
const
Jet
jtmp;
102
trans
->particleBase() = jtmp.
particleBase
();
103
104
msg
<< MSG::DEBUG <<
"Loaded Jet from persistent state [OK]"
105
<<
endmsg
;
106
}
107
108
void
JetCnv_p2::transToPers
(
const
Jet
*
/*trans*/
,
109
Jet_p2
*
/*pers*/
,
110
MsgStream&
msg
)
const
111
{
112
msg
<< MSG::ERROR <<
" Don't write Jet_p2 anymore"
113
<<
endmsg
;
114
115
// pers->m_ownPointers = false;
116
117
// navCnv.transToPers( &trans->navigableBase(), &pers->m_nav, msg );
118
// momCnv.transToPers( &trans->momentumBase(), &pers->m_momentum, msg );
119
120
121
// pers->m_author = trans->m_jetAuthor;
122
123
// // no more needed : we don't save nomore to p2
124
// //pers->m_combinedLikelihood = std::vector<double>( trans->m_combinedLikelihood );
125
126
127
// if ( bool(trans->m_tagInfoStore) )
128
// pers->m_tagJetInfo = *(trans->m_tagInfoStore);
129
// else
130
// pers->m_tagJetInfo.clear();
131
// if ( bool(trans->m_assocStore) )
132
// pers->m_associations = *(trans->m_assocStore);
133
// else
134
// pers->m_associations.clear();
135
136
// msg << MSG::DEBUG << "Created persistent state of Jet [OK]"
137
// << endmsg;
138
// return;
139
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
NavigableCnv_t
NavigableCnv_p1< Navigable< INavigable4MomentumCollection, double > > NavigableCnv_t
Definition
CompositeParticleCnv_p1.cxx:30
JetAssociationBase.h
navCnv
static const NavigableCnv_t navCnv
Definition
JetCnv_p1.cxx:31
momCnv
static const P4ImplPxPyPzECnv_p1 momCnv
Definition
JetCnv_p1.cxx:30
JetCnv_p2.h
JetTagInfoBase.h
NavigableCnv_p1.h
This file contains the class definition for the NavigableCnv_p1 class.
P4ImplPxPyPzECnv_p1.h
Jet.h
JetCnv_p2::transToPers
virtual void transToPers(const Jet *transObj, Jet_p2 *persObj, MsgStream &msg) const override
Method creating the persistent representation Jet_p2 from its transient representation Jet.
Definition
JetCnv_p2.cxx:108
JetCnv_p2::persToTrans
virtual void persToTrans(const Jet_p2 *persObj, Jet *transObj, MsgStream &msg) const override
Method creating the transient representation of Jet from its persistent representation Jet_p2.
Definition
JetCnv_p2.cxx:35
JetKeyDescriptorInstance
Theses classes implement a mapping between string and index used by jets.
Definition
JetKeyDescriptor.h:100
JetKeyDescriptorInstance::getKeys
const std::vector< key_t > & getKeys(const category_t &cat) const
Definition
JetKeyDescriptor.cxx:178
JetKeyDescriptorInstance::instance
static JetKeyDescriptorInstance * instance()
Definition
JetKeyDescriptor.h:123
Jet_p2
Definition
Jet_p2.h:33
Jet_p2::m_nav
Navigable_p1< uint32_t, double > m_nav
the navigable part
Definition
Jet_p2.h:68
Jet_p2::m_associations
std::vector< const JetAssociationBase * > m_associations
JetAssociationBase objects.
Definition
Jet_p2.h:85
Jet_p2::m_author
unsigned int m_author
Definition
Jet_p2.h:73
Jet_p2::m_tagJetInfo
std::vector< const JetTagInfoBase * > m_tagJetInfo
JetTagInfoBase objects.
Definition
Jet_p2.h:82
Jet_p2::m_combinedLikelihood
std::vector< double > m_combinedLikelihood
combined likelihoods
Definition
Jet_p2.h:76
Jet_p2::m_momentum
P4PxPyPzE_p1 m_momentum
the 4-mom part
Definition
Jet_p2.h:71
Jet
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
Jet::assostore_t
std::vector< const assoc_t * > assostore_t
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:126
Jet::tagstore_t
std::vector< const taginfo_t * > tagstore_t
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:130
Jet::s_defaultJetId
static const size_t s_defaultJetId
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:670
NavigableCnv_p1
Definition
NavigableCnv_p1.h:29
P4ImplPxPyPzECnv_p1
Definition
P4ImplPxPyPzECnv_p1.h:38
ParticleSigStateImpl::particleBase
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
Definition
ParticleSigStateImpl.h:469
trans
TH1F * trans(TH1F *h, bool t=false)
Definition
comparitor.cxx:199
JetKeyConstants::ShapeCat
static const key_t ShapeCat
Index category for jet shapes.
Definition
JetKeyDescriptor.h:88
P4SignalState::CALIBRATED
@ CALIBRATED
Definition
ISignalState.h:31
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0