ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
FPGATrackSim
FPGATrackSimObjects
src
FPGATrackSimHit.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
FPGATrackSimObjects/FPGATrackSimHit.h
"
7
8
#include <stdexcept>
9
10
11
12
13
bool
FPGATrackSimHit::isMapped
()
const
14
{
15
if
(
m_layer
>=0){
16
return
true
;
17
}
18
return
false
;
19
}
20
bool
FPGATrackSimHit::isRemapped
()
const
21
{
22
return
m_isRemapped
;
23
}
24
void
FPGATrackSimHit::setRemap
()
25
{
26
m_isRemapped
=
true
;
27
}
28
bool
FPGATrackSimHit::isClustered
()
const
29
{
30
switch
(
m_hitType
)
31
{
32
case
HitType::clustered
:
// TODO do wildcard and guessed hits have cluster info too?
33
case
HitType::spacepoint
:
34
return
true
;
35
default
:
36
return
false
;
37
}
38
}
39
40
bool
FPGATrackSimHit::isReal
()
const
41
{
42
switch
(
m_hitType
)
43
{
44
case
HitType::unmapped
:
45
case
HitType::mapped
:
46
case
HitType::clustered
:
47
case
HitType::spacepoint
:
48
return
true
;
49
default
:
50
return
false
;
51
}
52
}
53
54
// Sets using the physical layer index as defined by FPGATrackSimPlaneMap
55
void
FPGATrackSimHit::setPhysLayer
(
unsigned
v)
56
{
57
if
(
m_detType
==
SiliconTech::strip
)
58
{
59
m_layer_disk_old
=
m_layer_disk
;
60
m_side_old
=
m_side
;
61
m_layer_disk
= v / 2;
62
m_side
= v % 2;
63
}
64
else
65
{
66
m_layer_disk_old
=
m_layer_disk
;
67
m_layer_disk
= v;
68
}
69
}
70
71
// Returns the physical layer index as defined by FPGATrackSimPlaneMap
72
unsigned
FPGATrackSimHit::getPhysLayer
(
bool
old)
const
73
{
74
if
(old &&
isRemapped
()) {
75
if
(
m_detType
==
SiliconTech::strip
)
76
return
2 *
m_layer_disk_old
+
m_side_old
;
77
return
m_layer_disk_old
;
78
}
79
else
{
80
if
(
m_detType
==
SiliconTech::strip
)
81
return
2 *
m_layer_disk
+
m_side
;
82
return
m_layer_disk
;
83
}
84
}
85
86
87
int
FPGATrackSimHit::getLayer
()
const
88
{
89
return
m_layer
;
90
}
91
92
unsigned
FPGATrackSimHit::getSection
()
const
93
{
94
if
(
isMapped
())
return
m_section
;
95
throw
std::domain_error(
"FPGATrackSimHit::getSection() called on a hit with invalid type"
);
96
}
97
98
void
FPGATrackSimHit::makeSpacepoint
(
float
x
,
float
y
,
float
z
,
float
window,
FPGATrackSimHit
& other,
FPGATrackSimMultiTruth
& new_truth) {
99
// Update coordinates. This keeps a copy of the old ones.
100
setX
(
x
);
101
setY
(
y
);
102
setZ
(
z
);
103
104
// Store the phi window.
105
m_phiWindow
= window;
106
107
// Update the truth, so we can do truth matching.
108
setTruth
(new_truth);
109
110
// Store the local coordinates of the inner hit.
111
// the need for a subclass in the futer should be considered.
112
const
FPGATrackSimHit
* inner = ((
getPhysLayer
() % 2) == 0) ?
this
: &other;
113
m_pairedEtaModule
= inner->
getEtaModule
();
114
m_pairedPhiModule
= inner->
getPhiModule
();
115
116
// If the hit is unmapped we need to store the physical
117
// layer coordinates, and when the hit *becomes* mapped, update the paired logical layer too.
118
if
(
isMapped
()) {
119
m_pairedSection
= inner->
getSection
();
120
m_pairedLayer
= inner->
getLayer
();
121
}
122
if
(
m_hitType
==
HitType::spacepoint
)
m_layer
= inner->
getLayer
();
123
m_pairedDetZone
= inner->
getDetectorZone
();
124
m_pairedDetType
= inner->
getDetType
();
125
m_pairedPhysLayer
= inner->
getPhysLayer
();
126
127
// Update the type.
128
setHitType
(
HitType::spacepoint
);
129
}
130
131
const
FPGATrackSimHit
FPGATrackSimHit::getOriginalHit
()
const
{
132
// Only works for spacepoints. TODO: subclass...
133
FPGATrackSimHit
original = *(
this
);
134
if
(
getHitType
() !=
HitType::spacepoint
) {
135
return
*
this
;
136
}
137
138
// Restore the x/y/z coordinates. That should be all we have to do!
139
original.
setX
(
m_originalX
);
140
original.
setY
(
m_originalY
);
141
original.
setZ
(
m_originalZ
);
142
143
// Change the type... is "clustered" the right type?
144
original.
setHitType
(
HitType::clustered
);
145
146
// Technically, we could also restore the original truth.
147
148
return
original;
149
}
150
151
std::ostream&
operator<<
(std::ostream& out,
const
FPGATrackSimHit
&
hit
)
152
{
153
out <<
"type="
<<
hit
.m_hitType
154
<<
" tech="
<<
hit
.m_detType
155
<<
" zone="
<<
hit
.m_detectorZone
156
<<
" etamod="
<<
hit
.getEtaModule()
157
<<
" phimod="
<<
hit
.getPhiModule()
158
<<
" physLayer="
<<
hit
.getPhysLayer()
159
<<
" eta="
<<
hit
.getEtaCoord()
160
<<
" phi="
<<
hit
.getPhiCoord();
161
162
return
out;
163
}
164
165
166
std::string
to_string
(
HitType
t)
167
{
168
switch
(t)
169
{
170
case
HitType::unmapped
:
return
"unmapped"
;
171
case
HitType::mapped
:
return
"mapped"
;
172
case
HitType::clustered
:
return
"clustered"
;
173
case
HitType::wildcard
:
return
"wildcard"
;
174
case
HitType::guessed
:
return
"guessed"
;
175
case
HitType::extrapolated
:
return
"extrapolated"
;
176
case
HitType::spacepoint
:
return
"spacepoint"
;
177
default
:
return
"undefined"
;
178
}
179
}
180
181
182
std::ostream&
operator<<
(std::ostream& os,
HitType
t)
183
{
184
return
(os <<
to_string
(t));
185
}
186
187
to_string
std::string to_string(HitType t)
Definition
FPGATrackSimHit.cxx:166
operator<<
std::ostream & operator<<(std::ostream &out, const FPGATrackSimHit &hit)
Definition
FPGATrackSimHit.cxx:151
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
HitType
HitType
Definition
FPGATrackSimHit.h:39
HitType::extrapolated
@ extrapolated
Definition
FPGATrackSimHit.h:39
HitType::mapped
@ mapped
Definition
FPGATrackSimHit.h:39
HitType::spacepoint
@ spacepoint
Definition
FPGATrackSimHit.h:39
HitType::unmapped
@ unmapped
Definition
FPGATrackSimHit.h:39
HitType::clustered
@ clustered
Definition
FPGATrackSimHit.h:39
HitType::wildcard
@ wildcard
Definition
FPGATrackSimHit.h:39
HitType::guessed
@ guessed
Definition
FPGATrackSimHit.h:39
SiliconTech::strip
@ strip
Definition
FPGATrackSimTypes.h:25
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
y
#define y
x
#define x
z
#define z
FPGATrackSimHit::makeSpacepoint
void makeSpacepoint(float x, float y, float z, float window, FPGATrackSimHit &other, FPGATrackSimMultiTruth &new_truth)
Definition
FPGATrackSimHit.cxx:98
FPGATrackSimHit::m_pairedPhysLayer
unsigned m_pairedPhysLayer
Definition
FPGATrackSimHit.h:278
FPGATrackSimHit::m_pairedSection
unsigned m_pairedSection
Definition
FPGATrackSimHit.h:281
FPGATrackSimHit::m_pairedDetZone
DetectorZone m_pairedDetZone
Definition
FPGATrackSimHit.h:276
FPGATrackSimHit::m_pairedDetType
SiliconTech m_pairedDetType
Definition
FPGATrackSimHit.h:277
FPGATrackSimHit::m_pairedPhiModule
unsigned m_pairedPhiModule
Definition
FPGATrackSimHit.h:272
FPGATrackSimHit::getLayer
int getLayer() const
Definition
FPGATrackSimHit.cxx:87
FPGATrackSimHit::m_originalX
float m_originalX
Definition
FPGATrackSimHit.h:264
FPGATrackSimHit::m_pairedEtaModule
int m_pairedEtaModule
Definition
FPGATrackSimHit.h:273
FPGATrackSimHit::m_originalY
float m_originalY
Definition
FPGATrackSimHit.h:265
FPGATrackSimHit::m_originalZ
float m_originalZ
Definition
FPGATrackSimHit.h:266
FPGATrackSimHit::m_layer_disk_old
unsigned m_layer_disk_old
Definition
FPGATrackSimHit.h:228
FPGATrackSimHit::m_section
int m_section
Definition
FPGATrackSimHit.h:240
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition
FPGATrackSimHit.h:55
FPGATrackSimHit::setRemap
void setRemap()
Definition
FPGATrackSimHit.cxx:24
FPGATrackSimHit::m_layer
int m_layer
Definition
FPGATrackSimHit.h:239
FPGATrackSimHit::getEtaModule
int getEtaModule(bool old=false) const
Definition
FPGATrackSimHit.h:90
FPGATrackSimHit::m_layer_disk
unsigned m_layer_disk
Definition
FPGATrackSimHit.h:227
FPGATrackSimHit::getPhiModule
unsigned getPhiModule() const
Definition
FPGATrackSimHit.h:91
FPGATrackSimHit::setZ
void setZ(float v)
Definition
FPGATrackSimHit.h:151
FPGATrackSimHit::FPGATrackSimHit
FPGATrackSimHit()=default
FPGATrackSimHit::m_phiWindow
float m_phiWindow
Definition
FPGATrackSimHit.h:269
FPGATrackSimHit::isClustered
bool isClustered() const
Definition
FPGATrackSimHit.cxx:28
FPGATrackSimHit::getPhysLayer
unsigned getPhysLayer(bool old=false) const
Definition
FPGATrackSimHit.cxx:72
FPGATrackSimHit::m_side_old
unsigned m_side_old
Definition
FPGATrackSimHit.h:230
FPGATrackSimHit::isMapped
bool isMapped() const
Definition
FPGATrackSimHit.cxx:13
FPGATrackSimHit::setX
void setX(float v)
Definition
FPGATrackSimHit.h:149
FPGATrackSimHit::isReal
bool isReal() const
Definition
FPGATrackSimHit.cxx:40
FPGATrackSimHit::setPhysLayer
void setPhysLayer(unsigned v)
Definition
FPGATrackSimHit.cxx:55
FPGATrackSimHit::m_detType
SiliconTech m_detType
Definition
FPGATrackSimHit.h:221
FPGATrackSimHit::m_hitType
HitType m_hitType
Definition
FPGATrackSimHit.h:219
FPGATrackSimHit::getOriginalHit
const FPGATrackSimHit getOriginalHit() const
Definition
FPGATrackSimHit.cxx:131
FPGATrackSimHit::getDetType
SiliconTech getDetType() const
Definition
FPGATrackSimHit.h:59
FPGATrackSimHit::setY
void setY(float v)
Definition
FPGATrackSimHit.h:150
FPGATrackSimHit::getDetectorZone
DetectorZone getDetectorZone() const
Definition
FPGATrackSimHit.h:60
FPGATrackSimHit::m_isRemapped
bool m_isRemapped
Definition
FPGATrackSimHit.h:243
FPGATrackSimHit::getSection
unsigned getSection() const
Definition
FPGATrackSimHit.cxx:92
FPGATrackSimHit::m_pairedLayer
unsigned m_pairedLayer
Definition
FPGATrackSimHit.h:282
FPGATrackSimHit::setTruth
void setTruth(const FPGATrackSimMultiTruth &v)
Definition
FPGATrackSimHit.h:166
FPGATrackSimHit::isRemapped
bool isRemapped() const
Definition
FPGATrackSimHit.cxx:20
FPGATrackSimHit::getHitType
HitType getHitType() const
Definition
FPGATrackSimHit.h:58
FPGATrackSimHit::m_side
unsigned m_side
Definition
FPGATrackSimHit.h:229
FPGATrackSimMultiTruth
Definition
FPGATrackSimMultiTruth.h:46
Generated on
for ATLAS Offline Software by
1.17.0