5 #include "UCTGeometryExtended.hh"
6 using namespace l1tcalo;
8 UCTRegionIndex UCTGeometryExtended::getUCTRegionNorth(UCTRegionIndex center) {
9 int eta = center.first;
10 uint32_t
phi = center.second;
12 if (phi == MaxUCTRegionsPhi)
14 else if (phi > MaxUCTRegionsPhi)
16 return UCTRegionIndex(eta, phi);
19 UCTRegionIndex UCTGeometryExtended::getUCTRegionSouth(UCTRegionIndex center) {
20 int eta = center.first;
21 uint32_t phi = center.second;
23 phi = MaxUCTRegionsPhi - 1;
24 else if (phi < MaxUCTRegionsPhi)
28 return UCTRegionIndex(eta, phi);
31 UCTRegionIndex UCTGeometryExtended::getUCTRegionEast(UCTRegionIndex center) {
32 int eta = center.first;
33 uint32_t phi = center.second;
37 int etaMax = MaxUCTRegionsEta;
40 return UCTRegionIndex(eta, phi);
43 UCTRegionIndex UCTGeometryExtended::getUCTRegionWest(UCTRegionIndex center) {
44 int eta = center.first;
45 uint32_t phi = center.second;
49 int etaMin = -MaxUCTRegionsEta;
52 return UCTRegionIndex(eta, phi);
55 UCTRegionIndex UCTGeometryExtended::getUCTRegionNE(UCTRegionIndex center) {
56 int eta = center.first;
57 uint32_t phi = center.second;
59 if (phi == MaxUCTRegionsPhi)
61 else if (phi > MaxUCTRegionsPhi)
66 int etaMax = MaxUCTRegionsEta;
69 return UCTRegionIndex(eta, phi);
72 UCTRegionIndex UCTGeometryExtended::getUCTRegionNW(UCTRegionIndex center) {
73 int eta = center.first;
74 uint32_t phi = center.second;
76 if (phi == MaxUCTRegionsPhi)
78 else if (phi > MaxUCTRegionsPhi)
83 int etaMin = -MaxUCTRegionsEta;
86 return UCTRegionIndex(eta, phi);
89 UCTRegionIndex UCTGeometryExtended::getUCTRegionSE(UCTRegionIndex center) {
90 int eta = center.first;
91 uint32_t phi = center.second;
93 phi = MaxUCTRegionsPhi - 1;
94 else if (phi < MaxUCTRegionsPhi)
101 int etaMax = MaxUCTRegionsEta;
104 return UCTRegionIndex(eta, phi);
107 UCTRegionIndex UCTGeometryExtended::getUCTRegionSW(UCTRegionIndex center) {
108 int eta = center.first;
109 uint32_t phi = center.second;
111 phi = MaxUCTRegionsPhi - 1;
112 else if (phi < MaxUCTRegionsPhi)
119 int etaMin = -MaxUCTRegionsEta;
122 return UCTRegionIndex(eta, phi);
125 bool UCTGeometryExtended::areNeighbors(UCTTowerIndex
a, UCTTowerIndex
b) {
126 int diffEta =
std::abs(a.first - b.first);
127 int diffPhi =
std::abs(((
int)a.second - (
int)b.second));
128 if ((diffEta <= 1 || (a.first == -1 && b.first == 1) || (a.first == 1 && b.first == -1)) &&
129 (diffPhi <= 1 || diffPhi == 71))
134 bool UCTGeometryExtended::isEdgeTower(UCTTowerIndex a) {
136 int etaMin = -MaxUCTRegionsEta;
137 int etaMax = MaxUCTRegionsEta;
138 if (eta == etaMin || eta == etaMax)
Abs< T >::type abs(const T &t)