ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetEventTPCnv
src
JetCnv_p3.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// JetCnv_p3.cxx
8
// Implementation file for class JetCnv_p3
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_p3.h
"
27
#include "
JetEventTPCnv/JetSignalStateCnv.h
"
28
29
using
NavigableCnv_t
=
NavigableCnv_p1<Navigable<INavigable4MomentumCollection, double>
>;
30
31
// pre-allocate converters
32
static
const
P4ImplPxPyPzECnv_p1
momCnv
;
33
static
const
NavigableCnv_t
navCnv
;
34
35
36
void
JetCnv_p3::persToTrans
(
const
Jet_p3
* pers,
37
Jet
*
trans
,
38
MsgStream&
msg
)
const
39
{
40
msg
<< MSG::DEBUG <<
"Loading Jet from persistent state... e = "
<< pers->
m_momentum
.
m_ene
41
<<
endmsg
;
42
43
navCnv
.persToTrans( &pers->
m_nav
,
44
&
trans
->navigableBase(),
msg
);
45
momCnv
.persToTrans( &pers->
m_momentum
, &
trans
->momentumBase(),
msg
);
46
47
msg
<< MSG::DEBUG <<
" after momCnv e="
<<
trans
->e() <<
endmsg
;
48
49
trans
->m_jetAuthor = pers->
m_author
;
50
51
// trans->m_combinedLikelihood = std::vector<double>( pers->m_combinedLikelihood );
52
// trans->setCombinedLikelihood(pers->m_combinedLikelihood);
53
54
55
56
JetKeyDescriptorInstance
* keydesc =
JetKeyDescriptorInstance::instance
();
57
std::vector<std::string> momentNames = keydesc->
getKeys
(
JetKeyConstants::ShapeCat
);
58
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
;
59
else
for
(
size_t
i=0;i<momentNames.size();i++){
60
trans
->setMoment(momentNames[i], (pers)->m_shapeStore[i],
true
);
61
}
62
63
if
(
trans
->m_tagInfoStore)
64
const_cast<
Jet_p3
*
>
(pers)->m_tagJetInfo.swap (*
trans
->m_tagInfoStore);
65
else
if
( !(pers)->m_tagJetInfo.empty() ) {
66
trans
->m_tagInfoStore =
new
Jet::tagstore_t
;
67
const_cast<
Jet_p3
*
>
(pers)->m_tagJetInfo.swap (*
trans
->m_tagInfoStore);
68
}
69
70
if
(
trans
->m_assocStore)
71
const_cast<
Jet_p3
*
>
(pers)->m_associations.swap (*
trans
->m_assocStore);
72
else
if
( !(pers)->m_associations.empty() ) {
73
trans
->m_assocStore =
new
Jet::assostore_t
;
74
const_cast<
Jet_p3
*
>
(pers)->m_associations.swap (*
trans
->m_assocStore);
75
}
76
77
// Avoid memory leaks.
78
for
(
size_t
i = 0; i < pers->
m_tagJetInfo
.size(); i++)
79
delete
pers->
m_tagJetInfo
[i];
80
for
(
size_t
i = 0; i < pers->
m_associations
.size(); i++)
81
delete
pers->
m_associations
[i];
82
83
84
const_cast<
Jet_p3
*
>
(pers)->m_shapeStore.clear();
85
const_cast<
Jet_p3
*
>
(pers)->m_tagJetInfo.clear();
86
const_cast<
Jet_p3
*
>
(pers)->m_associations.clear();
87
88
// default signal state
89
trans
->setSignalState(
P4SignalState::CALIBRATED
);
90
91
92
SignalStateCnv
statecnv;
93
94
trans
->setRawE( statecnv.
ratio_from_char
( pers->
m_ratioE
) *
trans
->e() ) ;
95
trans
->setRawPx( statecnv.
ratio_from_char
(pers->
m_ratioPx
) *
trans
->px() ) ;
96
trans
->setRawPy( statecnv.
ratio_from_char
(pers->
m_ratioPy
) *
trans
->py() ) ;
97
trans
->setRawPz( statecnv.
ratio_from_char
(pers->
m_ratioPz
) *
trans
->pz() ) ;
98
99
// Jet comes from a DataPool.
100
// So we need to be sure to re-initialize everything in the Jet.
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_p3::transToPers
(
const
Jet
*
trans
,
109
Jet_p3
* pers,
110
MsgStream&
msg
)
const
111
{
112
msg
<< MSG::DEBUG <<
"Creating persistent state of Jet... e="
<<
trans
->e() <<
" "
<<
trans
->momentumBase().e()
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 p3
124
//pers->m_combinedLikelihood = std::vector<double>( trans->m_combinedLikelihood );
125
126
if
(
bool
(
trans
->m_tagInfoStore) )
127
pers->
m_tagJetInfo
= *(
trans
->m_tagInfoStore);
128
else
129
pers->
m_tagJetInfo
.clear();
130
if
(
bool
(
trans
->m_assocStore) )
131
pers->
m_associations
= *(
trans
->m_assocStore);
132
else
133
pers->
m_associations
.clear();
134
135
136
137
SignalStateCnv
statecnv;
138
139
pers->
m_ratioE
= statecnv.
char_from_ratio
(
trans
->getRawE () /
trans
->e(
P4SignalState::CALIBRATED
) );
140
pers->
m_ratioPx
= statecnv.
char_from_ratio
(
trans
->getRawPx() /
trans
->px(
P4SignalState::CALIBRATED
));
141
pers->
m_ratioPy
= statecnv.
char_from_ratio
(
trans
->getRawPy() /
trans
->py(
P4SignalState::CALIBRATED
));
142
pers->
m_ratioPz
= statecnv.
char_from_ratio
(
trans
->getRawPz() /
trans
->pz(
P4SignalState::CALIBRATED
));
143
144
145
146
msg
<< MSG::DEBUG <<
"Created persistent state of Jet [OK] e="
<< pers->
m_momentum
.
m_ene
147
<<
endmsg
;
148
}
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_p3.h
JetSignalStateCnv.h
JetTagInfoBase.h
NavigableCnv_p1.h
This file contains the class definition for the NavigableCnv_p1 class.
P4ImplPxPyPzECnv_p1.h
Jet.h
JetCnv_p3::persToTrans
virtual void persToTrans(const Jet_p3 *persObj, Jet *transObj, MsgStream &msg) const override
Method creating the transient representation of Jet from its persistent representation Jet_p3.
Definition
JetCnv_p3.cxx:36
JetCnv_p3::transToPers
virtual void transToPers(const Jet *transObj, Jet_p3 *persObj, MsgStream &msg) const override
Method creating the persistent representation Jet_p3 from its transient representation Jet.
Definition
JetCnv_p3.cxx:108
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_p3
Definition
Jet_p3.h:33
Jet_p3::m_ratioPy
char m_ratioPy
ratio for uncalibrated p_x
Definition
Jet_p3.h:98
Jet_p3::m_ownPointers
bool m_ownPointers
True if we own the objects pointed to from the above collections.
Definition
Jet_p3.h:92
Jet_p3::m_ratioPx
char m_ratioPx
ratio for uncalibrated E
Definition
Jet_p3.h:97
Jet_p3::m_ratioE
char m_ratioE
Definition
Jet_p3.h:96
Jet_p3::m_momentum
P4PxPyPzE_p1 m_momentum
the 4-mom part
Definition
Jet_p3.h:71
Jet_p3::m_tagJetInfo
std::vector< const JetTagInfoBase * > m_tagJetInfo
JetTagInfoBase objects.
Definition
Jet_p3.h:82
Jet_p3::m_nav
Navigable_p1< uint32_t, double > m_nav
the navigable part
Definition
Jet_p3.h:68
Jet_p3::m_associations
std::vector< const JetAssociationBase * > m_associations
JetAssociationBase objects.
Definition
Jet_p3.h:85
Jet_p3::m_author
unsigned int m_author
Definition
Jet_p3.h:73
Jet_p3::m_ratioPz
char m_ratioPz
ratio for uncalibrated p_y
Definition
Jet_p3.h:99
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
NavigableCnv_p1
Definition
NavigableCnv_p1.h:29
P4ImplPxPyPzECnv_p1
Definition
P4ImplPxPyPzECnv_p1.h:38
P4PxPyPzE_p1::m_ene
float m_ene
Definition
P4PxPyPzE_p1.h:42
ParticleSigStateImpl::particleBase
const particle_type & particleBase() const
access to underlying base type (IParticle-like)
Definition
ParticleSigStateImpl.h:469
SignalStateCnv
Definition
JetSignalStateCnv.h:78
SignalStateCnv::ratio_from_char
double ratio_from_char(char c) const
Definition
JetSignalStateCnv.h:119
SignalStateCnv::char_from_ratio
char char_from_ratio(double r) const
Definition
JetSignalStateCnv.h:101
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