ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
RegionSelector
src
RegSelectorMapElement.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
#include "
RegionSelector/RegSelectorMapElement.h
"
6
7
#include <stdio.h>
8
#include <iostream>
9
10
11
RegSelectorMapElement::RegSelectorMapElement
(){
12
m_position
= 0;
13
m_number
= 0;
14
m_etaminValue
= 1000;
15
m_etamaxValue
= -1000;
16
m_phiminValue
= 1000;
17
m_phimaxValue
= -1000;
18
}
19
20
int
RegSelectorMapElement::layerDiskPosition
(
void
)
const
{
21
return
m_position
;
22
}
23
24
int
RegSelectorMapElement::layerDiskNumber
(
void
)
const
{
25
return
m_number
;
26
}
27
28
const
std::vector<IdentifierHash>&
RegSelectorMapElement::hashId
()
const
{
29
return
m_hashId
;
30
}
31
32
void
RegSelectorMapElement::insertElementInVector
(
double
etaminIn,
double
etamaxIn,
double
phiminIn,
33
double
phimaxIn,
IdentifierHash
hashIdIn,
34
uint32_t robIdIn){
35
if
(etaminIn > etamaxIn){
36
m_etamin
.push_back(etamaxIn);
37
m_etamax
.push_back(etaminIn);
38
}
39
else
{
40
m_etamin
.push_back(etaminIn);
41
m_etamax
.push_back(etamaxIn);
42
}
43
44
m_phimin
.push_back(phiminIn);
45
m_phimax
.push_back(phimaxIn);
46
m_hashId
.push_back(hashIdIn);
47
m_robId
.push_back(robIdIn);
48
}
49
50
void
RegSelectorMapElement::insertNumberElement
(
int
numberIn){
51
m_number
= numberIn;
52
}
53
54
void
RegSelectorMapElement::insertPositionElement
(
int
positionIn){
55
m_position
= positionIn;
56
}
57
58
void
RegSelectorMapElement::findHash
(
double
etaminIn,
double
etamaxIn,
59
double
phiminIn,
double
phimaxIn,
60
std::set<IdentifierHash> &outset )
const
{
61
int
vecsize =
m_etamin
.size();
62
double
phiTmpMin =
phiminElem
();
63
double
phiTmpMax =
phimaxElem
();
64
65
for
(
int
i= 0; i < vecsize; i++){
66
if
( (etaminIn <=
m_etamax
[i]) && (etamaxIn >=
m_etamin
[i]) ){
67
if
(
m_phimin
[i] <
m_phimax
[i]){
68
if
( (phiminIn <=
m_phimax
[i]) && (phimaxIn >=
m_phimin
[i]) )
69
outset.insert(
m_hashId
[i]);
70
}
71
else
{
72
if
( ((phiminIn <=
m_phimax
[i]) && (phimaxIn >= phiTmpMin )) ||
73
((phiminIn <= phiTmpMax ) && (phimaxIn >=
m_phimin
[i])) )
74
outset.insert(
m_hashId
[i]);
75
}
76
}
77
}
78
}
79
80
void
RegSelectorMapElement::findRobId
(
double
etaminIn,
double
etamaxIn,
81
double
phiminIn,
double
phimaxIn,
82
std::set<uint32_t>& outset )
const
{
83
int
vecsize =
m_etamin
.size();
84
double
phiTmpMin =
phiminElem
();
85
double
phiTmpMax =
phimaxElem
();
86
87
for
(
int
i= 0; i < vecsize; i++){
88
if
( (etaminIn <=
m_etamax
[i]) && (etamaxIn >=
m_etamin
[i]) ){
89
if
(
m_phimin
[i] <
m_phimax
[i]){
90
if
( (phiminIn <=
m_phimax
[i]) && (phimaxIn >=
m_phimin
[i]) )
91
outset.insert(
m_robId
[i]);
92
}
93
else
{
94
if
( ((phiminIn <=
m_phimax
[i]) && (phimaxIn >= phiTmpMin )) ||
95
((phiminIn <= phiTmpMax ) && (phimaxIn >=
m_phimin
[i])) )
96
outset.insert(
m_robId
[i]);
97
}
98
}
99
}
100
}
101
102
double
RegSelectorMapElement::etaMin
(
const
IdentifierHash
hashId
)
const
{
103
return
m_etamin
[
hashId
];
104
}
105
106
double
RegSelectorMapElement::etaMax
(
IdentifierHash
hashId
)
const
{
107
return
m_etamax
[
hashId
];
108
}
109
110
double
RegSelectorMapElement::phiMin
(
IdentifierHash
hashId
)
const
{
111
return
m_phimin
[
hashId
];
112
}
113
114
double
RegSelectorMapElement::phiMax
(
IdentifierHash
hashId
)
const
{
115
return
m_phimax
[
hashId
];
116
}
117
118
double
RegSelectorMapElement::etaminElem
()
const
{
119
return
m_etaminValue
;
120
}
121
122
double
RegSelectorMapElement::etamaxElem
()
const
{
123
return
m_etamaxValue
;
124
}
125
143
144
double
RegSelectorMapElement::phiminElem
() {
145
if
(
m_phiminValue
< -
M_PI
/2)
146
m_phiminValue
= -
M_PI
;
147
else
148
m_phiminValue
= 0;
149
return
m_phiminValue
;
150
}
151
152
double
RegSelectorMapElement::phimaxElem
() {
153
if
(
m_phimaxValue
> (3*
M_PI
)/2)
154
m_phimaxValue
= 2*
M_PI
;
155
else
156
m_phimaxValue
=
M_PI
;
157
return
m_phimaxValue
;
158
}
159
160
double
RegSelectorMapElement::phiminElem
()
const
{
161
if
(
m_phiminValue
< -
M_PI
/2)
162
return
-
M_PI
;
163
else
164
return
0;
165
}
166
167
double
RegSelectorMapElement::phimaxElem
()
const
{
168
if
(
m_phimaxValue
> (3*
M_PI
)/2)
169
return
2*
M_PI
;
170
else
171
return
M_PI
;
172
}
173
174
175
void
RegSelectorMapElement::findMaxMinElem
(
void
){
176
m_etaminValue
= 1000;
m_etamaxValue
= -1000;
177
m_phiminValue
= 1000;
m_phimaxValue
= -1000;
178
int
vecsize =
m_etamin
.size();
179
for
(
int
i = 0; i < vecsize; i++){
180
if
(
m_etamin
[i] <
m_etaminValue
)
181
m_etaminValue
=
m_etamin
[i];
182
if
(
m_etamax
[i] >
m_etamaxValue
)
183
m_etamaxValue
=
m_etamax
[i];
184
if
(
m_phimin
[i] <
m_phiminValue
)
185
m_phiminValue
=
m_phimin
[i];
186
if
(
m_phimax
[i] >
m_phimaxValue
)
187
m_phimaxValue
=
m_phimax
[i];
188
}
189
}
190
191
void
RegSelectorMapElement::additem
(
const
IdentifierHash
hashId
,
const
double
etaMin
,
192
const
double
etaMax
,
const
double
phiMin
,
const
double
phiMax
,
193
const
int
layerDiskNumber
,
const
int
layerDiskPosition
,
194
const
uint32_t robId){
195
196
insertElementInVector
(
etaMin
,
etaMax
,
phiMin
,
phiMax
,
hashId
, robId);
197
insertNumberElement
(
layerDiskNumber
);
198
insertPositionElement
(
layerDiskPosition
);
199
}
200
201
void
RegSelectorMapElement::selection
(
double
etaminIn,
double
etamaxIn,
202
double
phiminIn,
double
phimaxIn,
203
std::set<IdentifierHash> &outset)
const
{
204
if
(phiminIn > phimaxIn){
205
double
tmp =
phimaxElem
();
206
findHash
(etaminIn, etamaxIn, phiminIn, tmp, outset);
207
tmp =
phiminElem
();
208
findHash
(etaminIn, etamaxIn, tmp, phimaxIn, outset);
209
}
210
else
{
211
findHash
(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
212
}
213
}
214
215
void
RegSelectorMapElement::selectionRobIdUint
(
double
etaminIn,
double
etamaxIn,
216
double
phiminIn,
double
phimaxIn,
217
std::set<uint32_t> &outset )
const
{
218
if
(phiminIn > phimaxIn){
219
double
tmp =
phimaxElem
();
220
findRobId
(etaminIn, etamaxIn, phiminIn, tmp, outset);
221
tmp =
phiminElem
();
222
findRobId
(etaminIn, etamaxIn, tmp, phimaxIn, outset);
223
}
224
else
{
225
findRobId
(etaminIn, etamaxIn, phiminIn, phimaxIn, outset);
226
}
227
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
RegSelectorMapElement.h
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
RegSelectorMapElement::layerDiskPosition
int layerDiskPosition() const
Definition
RegSelectorMapElement.cxx:20
RegSelectorMapElement::etaminElem
double etaminElem() const
Definition
RegSelectorMapElement.cxx:118
RegSelectorMapElement::m_phimax
std::vector< double > m_phimax
Definition
RegSelectorMapElement.h:62
RegSelectorMapElement::layerDiskNumber
int layerDiskNumber() const
Definition
RegSelectorMapElement.cxx:24
RegSelectorMapElement::etamaxElem
double etamaxElem() const
Definition
RegSelectorMapElement.cxx:122
RegSelectorMapElement::m_hashId
std::vector< IdentifierHash > m_hashId
Definition
RegSelectorMapElement.h:63
RegSelectorMapElement::etaMin
double etaMin(const IdentifierHash hashId) const
Definition
RegSelectorMapElement.cxx:102
RegSelectorMapElement::etaMax
double etaMax(IdentifierHash hashId) const
Definition
RegSelectorMapElement.cxx:106
RegSelectorMapElement::m_phiminValue
double m_phiminValue
Definition
RegSelectorMapElement.h:66
RegSelectorMapElement::m_phimin
std::vector< double > m_phimin
Definition
RegSelectorMapElement.h:62
RegSelectorMapElement::hashId
const std::vector< IdentifierHash > & hashId() const
Definition
RegSelectorMapElement.cxx:28
RegSelectorMapElement::m_etaminValue
double m_etaminValue
Definition
RegSelectorMapElement.h:65
RegSelectorMapElement::m_phimaxValue
double m_phimaxValue
Definition
RegSelectorMapElement.h:66
RegSelectorMapElement::selection
void selection(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< IdentifierHash > &outset) const
Definition
RegSelectorMapElement.cxx:201
RegSelectorMapElement::phiMin
double phiMin(IdentifierHash hashId) const
Definition
RegSelectorMapElement.cxx:110
RegSelectorMapElement::selectionRobIdUint
void selectionRobIdUint(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< uint32_t > &outset) const
Definition
RegSelectorMapElement.cxx:215
RegSelectorMapElement::RegSelectorMapElement
RegSelectorMapElement()
Definition
RegSelectorMapElement.cxx:11
RegSelectorMapElement::phiMax
double phiMax(IdentifierHash hashId) const
Definition
RegSelectorMapElement.cxx:114
RegSelectorMapElement::phiminElem
double phiminElem() const
Definition
RegSelectorMapElement.cxx:160
RegSelectorMapElement::m_robId
std::vector< uint32_t > m_robId
Definition
RegSelectorMapElement.h:64
RegSelectorMapElement::m_etamax
std::vector< double > m_etamax
Definition
RegSelectorMapElement.h:61
RegSelectorMapElement::insertNumberElement
void insertNumberElement(int numberIn)
Definition
RegSelectorMapElement.cxx:50
RegSelectorMapElement::insertPositionElement
void insertPositionElement(int position)
Definition
RegSelectorMapElement.cxx:54
RegSelectorMapElement::findHash
void findHash(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< IdentifierHash > &outset) const
Definition
RegSelectorMapElement.cxx:58
RegSelectorMapElement::m_etamaxValue
double m_etamaxValue
Definition
RegSelectorMapElement.h:65
RegSelectorMapElement::findRobId
void findRobId(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, std::set< uint32_t > &outset) const
Definition
RegSelectorMapElement.cxx:80
RegSelectorMapElement::insertElementInVector
void insertElementInVector(double etaminIn, double etamaxIn, double phiminIn, double phimaxIn, IdentifierHash hashIdIn, uint32_t robIdIn)
Definition
RegSelectorMapElement.cxx:32
RegSelectorMapElement::phimaxElem
double phimaxElem() const
Definition
RegSelectorMapElement.cxx:167
RegSelectorMapElement::m_position
int m_position
Definition
RegSelectorMapElement.h:59
RegSelectorMapElement::m_etamin
std::vector< double > m_etamin
Definition
RegSelectorMapElement.h:61
RegSelectorMapElement::findMaxMinElem
void findMaxMinElem(void)
Definition
RegSelectorMapElement.cxx:175
RegSelectorMapElement::m_number
int m_number
Definition
RegSelectorMapElement.h:60
RegSelectorMapElement::additem
void additem(const IdentifierHash hashId, const double etaMin, const double etaMax, const double phiMin, const double phiMax, const int layerDiskNumber, const int layerDiskPosition, const uint32_t robId)
Definition
RegSelectorMapElement.cxx:191
Generated on
for ATLAS Offline Software by
1.17.0