Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
L1Trigger
Phase2L1ParticleFlow
src
utils
Firmware2DiscretePF.h
Go to the documentation of this file.
1
#ifndef L1Trigger_Phase2L1ParticleFlow_FIRMWARE2DISCRETEPF_H
2
#define L1Trigger_Phase2L1ParticleFlow_FIRMWARE2DISCRETEPF_H
3
5
6
#include "../firmware/data.h"
7
#include <vector>
8
#include <cassert>
9
10
namespace
fw2dpf {
11
12
// convert inputs from discrete to firmware
13
inline
void
convert
(
const
PFChargedObj
&
src
,
14
const
l1tpf_impl::PropagatedTrack
&
track
,
15
std::vector<l1tpf_impl::PFParticle> &
out
) {
16
l1tpf_impl::PFParticle
pf;
17
pf.
hwPt
= src.
hwPt
;
18
pf.
hwEta
= src.
hwEta
;
19
pf.
hwPhi
= src.
hwPhi
;
20
pf.
hwVtxEta
= src.
hwEta
;
// FIXME: get from the track
21
pf.
hwVtxPhi
= src.
hwPhi
;
// before propagation
22
pf.
track
=
track
;
// FIXME: ok only as long as there is a 1-1 mapping
23
pf.
cluster
.
hwPt
= 0;
24
pf.
cluster
.
src
=
nullptr
;
25
pf.
muonsrc
=
nullptr
;
26
switch
(src.
hwId
) {
27
case
PID_Electron
:
28
pf.
hwId
= 1;
29
break
;
30
case
PID_Muon
:
31
pf.
hwId
= 4;
32
break
;
33
default
:
34
pf.
hwId
= 0;
35
break
;
36
};
37
pf.
hwStatus
= 0;
38
out.push_back(pf);
39
}
40
// convert inputs from discrete to firmware
41
inline
void
convert
(
const
TkObj
&
in
,
l1tpf_impl::PropagatedTrack
&
out
);
42
inline
void
convert
(
const
PFChargedObj
&
src
,
const
TkObj
&
track
, std::vector<l1tpf_impl::PFParticle> &
out
) {
43
l1tpf_impl::PFParticle
pf;
44
pf.
hwPt
= src.
hwPt
;
45
pf.
hwEta
= src.
hwEta
;
46
pf.
hwPhi
= src.
hwPhi
;
47
pf.
hwVtxEta
= src.
hwEta
;
// FIXME: get from the track
48
pf.
hwVtxPhi
= src.
hwPhi
;
// before propagation
49
convert
(track, pf.
track
);
// FIXME: ok only as long as there is a 1-1 mapping
50
pf.
cluster
.
hwPt
= 0;
51
pf.
cluster
.
src
=
nullptr
;
52
pf.
muonsrc
=
nullptr
;
53
switch
(src.
hwId
) {
54
case
PID_Electron
:
55
pf.
hwId
= 1;
56
break
;
57
case
PID_Muon
:
58
pf.
hwId
= 4;
59
break
;
60
default
:
61
pf.
hwId
= 0;
62
break
;
63
};
64
pf.
hwStatus
= 0;
65
out.push_back(pf);
66
}
67
inline
void
convert
(
const
PFNeutralObj
&
src
, std::vector<l1tpf_impl::PFParticle> &
out
) {
68
l1tpf_impl::PFParticle
pf;
69
pf.
hwPt
= src.
hwPt
;
70
pf.
hwEta
= src.
hwEta
;
71
pf.
hwPhi
= src.
hwPhi
;
72
pf.
hwVtxEta
= src.
hwEta
;
73
pf.
hwVtxPhi
= src.
hwPhi
;
74
pf.
track
.
hwPt
= 0;
75
pf.
track
.
src
=
nullptr
;
76
pf.
cluster
.
hwPt
= src.
hwPt
;
77
pf.
cluster
.
src
=
nullptr
;
78
pf.
muonsrc
=
nullptr
;
79
switch
(src.
hwId
) {
80
case
PID_Photon
:
81
pf.
hwId
= 3;
82
break
;
83
default
:
84
pf.
hwId
= 2;
85
break
;
86
}
87
pf.
hwStatus
= 0;
88
out.push_back(pf);
89
}
90
91
// convert inputs from discrete to firmware
92
inline
void
convert
(
const
TkObj
&
in
,
l1tpf_impl::PropagatedTrack
&
out
) {
93
out.
hwPt
= in.
hwPt
;
94
out.
hwCaloPtErr
= in.
hwPtErr
;
95
out.
hwEta
= in.
hwEta
;
// @calo
96
out.
hwPhi
= in.
hwPhi
;
// @calo
97
out.
hwZ0
= in.
hwZ0
;
98
out.
src
=
nullptr
;
99
}
100
inline
void
convert
(
const
HadCaloObj
&
in
,
l1tpf_impl::CaloCluster
&
out
) {
101
out.
hwPt
= in.
hwPt
;
102
out.
hwEmPt
= in.
hwEmPt
;
103
out.
hwEta
= in.
hwEta
;
104
out.
hwPhi
= in.
hwPhi
;
105
out.
isEM
= in.
hwIsEM
;
106
out.
src
=
nullptr
;
107
}
108
inline
void
convert
(
const
EmCaloObj
&
in
,
l1tpf_impl::CaloCluster
&
out
) {
109
out.
hwPt
= in.
hwPt
;
110
out.
hwPtErr
= in.
hwPtErr
;
111
out.
hwEta
= in.
hwEta
;
112
out.
hwPhi
= in.
hwPhi
;
113
out.
src
=
nullptr
;
114
}
115
inline
void
convert
(
const
MuObj
&
in
,
l1tpf_impl::Muon
&
out
) {
116
out.
hwPt
= in.
hwPt
;
117
out.
hwEta
= in.
hwEta
;
// @calo
118
out.
hwPhi
= in.
hwPhi
;
// @calo
119
out.
src
=
nullptr
;
120
}
121
122
template
<
unsigned
int
NMAX,
typename
In>
123
void
convert
(
const
In
in
[NMAX], std::vector<l1tpf_impl::PFParticle> &
out
) {
124
for
(
unsigned
int
i
= 0;
i
< NMAX; ++
i
) {
125
if
(
in
[
i
].hwPt > 0)
126
convert
(
in
[
i
], out);
127
}
128
}
129
template
<
typename
In>
130
void
convert
(
unsigned
int
NMAX,
const
In
in
[], std::vector<l1tpf_impl::PFParticle> &
out
) {
131
for
(
unsigned
int
i
= 0;
i
< NMAX; ++
i
) {
132
if
(in[
i
].hwPt > 0)
133
convert
(in[
i
], out);
134
}
135
}
136
template
<
unsigned
int
NMAX>
137
void
convert
(
const
PFChargedObj
in
[NMAX],
138
std::vector<l1tpf_impl::PropagatedTrack> srctracks,
139
std::vector<l1tpf_impl::PFParticle> &
out
) {
140
for
(
unsigned
int
i
= 0;
i
< NMAX; ++
i
) {
141
if
(
in
[
i
].hwPt > 0) {
142
assert
(
i
< srctracks.size());
143
convert
(
in
[
i
], srctracks[i], out);
144
}
145
}
146
}
147
inline
void
convert
(
unsigned
int
NMAX,
148
const
PFChargedObj
in
[],
149
std::vector<l1tpf_impl::PropagatedTrack> srctracks,
150
std::vector<l1tpf_impl::PFParticle> &
out
) {
151
for
(
unsigned
int
i
= 0;
i
< NMAX; ++
i
) {
152
if
(in[
i
].hwPt > 0) {
153
assert
(
i
< srctracks.size());
154
convert
(in[
i
], srctracks[i], out);
155
}
156
}
157
}
158
159
}
// namespace fw2dpf
160
161
#endif
MuObj
Definition:
data.h:158
l1tpf_impl::PFParticle::hwVtxPhi
int16_t hwVtxPhi
Definition:
DiscretePFInputs.h:190
mps_fire.i
i
Definition:
mps_fire.py:428
PFNeutralObj::hwEta
etaphi_t hwEta
Definition:
data.h:185
EmCaloObj::hwPt
pt_t hwPt
Definition:
data.h:133
l1tpf_impl::PFParticle::cluster
CaloCluster cluster
Definition:
DiscretePFInputs.h:192
PFChargedObj::hwEta
etaphi_t hwEta
Definition:
data.h:171
l1tpf_impl::PFParticle::track
PropagatedTrack track
Definition:
DiscretePFInputs.h:193
l1tpf_impl::CaloCluster::isEM
bool isEM
Definition:
DiscretePFInputs.h:32
l1tpf_impl::Muon::src
const l1t::Muon * src
Definition:
DiscretePFInputs.h:162
PFChargedObj::hwId
particleid_t hwId
Definition:
data.h:172
l1tpf_impl::InputTrack::hwZ0
int16_t hwZ0
Definition:
DiscretePFInputs.h:87
HLT_FULL_cff.track
tuple track
Definition:
HLT_FULL_cff.py:11953
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
HadCaloObj::hwIsEM
bool hwIsEM
Definition:
data.h:122
cms::cuda::assert
assert(be >=bs)
l1tpf_impl::PFParticle::hwPt
int16_t hwPt
Definition:
DiscretePFInputs.h:185
TkObj::hwPt
pt_t hwPt
Definition:
data.h:144
MuObj::hwEta
etaphi_t hwEta
Definition:
data.h:160
l1tpf_impl::PFParticle::hwVtxEta
int16_t hwVtxEta
Definition:
DiscretePFInputs.h:189
fw2dpf::convert
void convert(const PFChargedObj &src, const l1tpf_impl::PropagatedTrack &track, std::vector< l1tpf_impl::PFParticle > &out)
Definition:
Firmware2DiscretePF.h:13
l1tpf_impl::PFParticle
Definition:
DiscretePFInputs.h:184
EmCaloObj::hwEta
etaphi_t hwEta
Definition:
data.h:134
l1tpf_impl::PropagatedTrack
Definition:
DiscretePFInputs.h:119
HadCaloObj::hwEmPt
pt_t hwEmPt
Definition:
data.h:121
HadCaloObj
Definition:
data.h:120
PFNeutralObj::hwPt
pt_t hwPt
Definition:
data.h:184
PFChargedObj::hwPt
pt_t hwPt
Definition:
data.h:170
EmCaloObj::hwPtErr
pt_t hwPtErr
Definition:
data.h:133
PID_Photon
Definition:
data.h:16
PFNeutralObj::hwId
particleid_t hwId
Definition:
data.h:186
l1tpf_impl::CaloCluster
Definition:
DiscretePFInputs.h:25
PFNeutralObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:185
l1tpf_impl::InputTrack::src
const l1t::PFTrack * src
Definition:
DiscretePFInputs.h:90
MuObj::hwPt
pt_t hwPt
Definition:
data.h:159
alcazmumu_cfi.src
tuple src
Definition:
alcazmumu_cfi.py:30
l1tpf_impl::PFParticle::hwStatus
uint16_t hwStatus
Definition:
DiscretePFInputs.h:196
l1tpf_impl::CaloCluster::hwEmPt
int16_t hwEmPt
Definition:
DiscretePFInputs.h:27
l1tpf_impl::Muon::hwPt
int16_t hwPt
Definition:
DiscretePFInputs.h:157
CaloObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:118
l1tpf_impl::PropagatedTrack::hwPt
int16_t hwPt
Definition:
DiscretePFInputs.h:120
l1tpf_impl::CaloCluster::hwPhi
int16_t hwPhi
Definition:
DiscretePFInputs.h:30
l1tpf_impl::PFParticle::hwId
uint8_t hwId
Definition:
DiscretePFInputs.h:188
l1tpf_impl::Muon
Definition:
DiscretePFInputs.h:156
CaloObj::hwPt
pt_t hwPt
Definition:
data.h:117
EmCaloObj
Definition:
data.h:132
l1tpf_impl::CaloCluster::hwPtErr
int16_t hwPtErr
Definition:
DiscretePFInputs.h:28
PFChargedObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:171
TkObj::hwPtErr
pt_t hwPtErr
Definition:
data.h:144
l1tpf_impl::CaloCluster::hwEta
int16_t hwEta
Definition:
DiscretePFInputs.h:29
l1tpf_impl::PropagatedTrack::hwPhi
int16_t hwPhi
Definition:
DiscretePFInputs.h:124
PFNeutralObj
Definition:
data.h:183
TkObj::hwZ0
z0_t hwZ0
Definition:
data.h:146
l1tpf_impl::PropagatedTrack::hwCaloPtErr
int16_t hwCaloPtErr
Definition:
DiscretePFInputs.h:122
PFChargedObj
Definition:
data.h:169
EmCaloObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:134
l1tpf_impl::Muon::hwPhi
int16_t hwPhi
Definition:
DiscretePFInputs.h:159
CaloObj::hwEta
etaphi_t hwEta
Definition:
data.h:118
PID_Muon
Definition:
data.h:16
TkObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:145
l1tpf_impl::PFParticle::muonsrc
const l1t::Muon * muonsrc
Definition:
DiscretePFInputs.h:197
MuObj::hwPhi
etaphi_t hwPhi
Definition:
data.h:160
l1tpf_impl::Muon::hwEta
int16_t hwEta
Definition:
DiscretePFInputs.h:158
l1tpf_impl::PFParticle::hwPhi
int16_t hwPhi
Definition:
DiscretePFInputs.h:187
TkObj::hwEta
etaphi_t hwEta
Definition:
data.h:145
l1tpf_impl::PFParticle::hwEta
int16_t hwEta
Definition:
DiscretePFInputs.h:186
l1tpf_impl::CaloCluster::src
const l1t::PFCluster * src
Definition:
DiscretePFInputs.h:33
TkObj
Definition:
data.h:143
submitPVResolutionJobs.out
string out
Definition:
submitPVResolutionJobs.py:118
PID_Electron
Definition:
data.h:16
l1tpf_impl::PropagatedTrack::hwEta
int16_t hwEta
Definition:
DiscretePFInputs.h:123
l1tpf_impl::CaloCluster::hwPt
int16_t hwPt
Definition:
DiscretePFInputs.h:26
Generated for CMSSW Reference Manual by
1.8.5