FastSimulation
CaloGeometryTools
src
CaloDirectionOperations.cc
Go to the documentation of this file.
1
#include "
FastSimulation/CaloGeometryTools/interface/CaloDirectionOperations.h
"
2
3
CaloDirection
CaloDirectionOperations::add2d
(
const
CaloDirection
&
dir1
,
const
CaloDirection
&
dir2
) {
4
// unsigned d1=Side(dir1);
5
// unsigned d2=Side(dir2);
6
constexpr
CaloDirection
tab[4][4] = {{
NORTH
,
NORTHEAST
,
NONE
,
NORTHWEST
},
7
{
NORTHEAST
,
EAST
,
SOUTHEAST
,
NONE
},
8
{
NONE
,
SOUTHEAST
,
SOUTH
,
SOUTHWEST
},
9
{
NORTHWEST
,
NONE
,
SOUTHWEST
,
WEST
}};
10
return
tab[
Side
(
dir1
)][
Side
(
dir2
)];
11
}
12
13
CaloDirection
CaloDirectionOperations::Side
(
unsigned
i
) {
14
constexpr
CaloDirection
sides[6] = {
NORTH
,
EAST
,
SOUTH
,
WEST
,
UP
,
DOWN
};
15
// if(i<0||i>5) return DOWN;
16
return
sides[
i
];
17
}
18
19
unsigned
CaloDirectionOperations::neighbourDirection
(
const
CaloDirection
& side) {
20
unsigned
result
;
21
switch
(side) {
22
case
NORTH
:
23
result
= 0;
24
break
;
25
case
EAST
:
26
result
= 1;
27
break
;
28
case
SOUTH
:
29
result
= 2;
30
break
;
31
case
WEST
:
32
result
= 3;
33
break
;
34
case
NORTHEAST
:
35
result
= 4;
36
break
;
37
case
SOUTHEAST
:
38
result
= 5;
39
break
;
40
case
SOUTHWEST
:
41
result
= 6;
42
break
;
43
case
NORTHWEST
:
44
result
= 7;
45
break
;
46
default
:
47
result
= 999;
48
}
49
return
result
;
50
}
51
52
// It should be merged with the previous one. But I am afraid to break something
53
CaloDirection
CaloDirectionOperations::neighbourDirection
(
unsigned
i
) {
54
constexpr
CaloDirection
sides[8] = {
NORTH
,
EAST
,
SOUTH
,
WEST
,
NORTHEAST
,
SOUTHEAST
,
SOUTHWEST
,
NORTHWEST
};
55
// if(i<0||i>7) return SOUTH;
56
return
sides[
i
];
57
}
58
59
unsigned
CaloDirectionOperations::Side
(
const
CaloDirection
& side) {
60
unsigned
result
;
61
switch
(side) {
62
case
NORTH
:
63
result
= 0;
64
break
;
65
case
EAST
:
66
result
= 1;
67
break
;
68
case
SOUTH
:
69
result
= 2;
70
break
;
71
case
WEST
:
72
result
= 3;
73
break
;
74
case
UP
:
75
result
= 4;
76
break
;
77
case
DOWN
:
78
result
= 5;
79
break
;
80
default
:
81
result
= 999;
82
}
83
return
result
;
84
}
85
86
CaloDirection
CaloDirectionOperations::oppositeSide
(
const
CaloDirection
& side) {
87
CaloDirection
result
;
88
switch
(side) {
89
case
UP
:
90
result
=
DOWN
;
91
break
;
92
case
DOWN
:
93
result
=
UP
;
94
break
;
95
case
EAST
:
96
result
=
WEST
;
97
break
;
98
case
WEST
:
99
result
=
EAST
;
100
break
;
101
case
NORTH
:
102
result
=
SOUTH
;
103
break
;
104
case
SOUTH
:
105
result
=
NORTH
;
106
break
;
107
case
NORTHEAST
:
108
result
=
SOUTHWEST
;
109
break
;
110
case
NORTHWEST
:
111
result
=
SOUTHEAST
;
112
break
;
113
case
SOUTHEAST
:
114
result
=
NORTHWEST
;
115
break
;
116
case
SOUTHWEST
:
117
result
=
NORTHEAST
;
118
break
;
119
120
default
:
121
result
=
NONE
;
122
}
123
return
result
;
124
}
125
126
unsigned
CaloDirectionOperations::oppositeDirection
(
unsigned
iside) {
127
constexpr
unsigned
od
[8] = {2, 3, 0, 1, 6, 7, 4, 5};
128
return
od
[iside];
129
// if(iside>=0&&iside<8) return od[iside];
130
// return 999;
131
}
L1TDiffHarvesting_cfi.dir2
dir2
Definition:
L1TDiffHarvesting_cfi.py:12
mps_fire.i
i
Definition:
mps_fire.py:429
Variation::UP
CaloDirectionOperations::add2d
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
Definition:
CaloDirectionOperations.cc:3
mps_fire.result
result
Definition:
mps_fire.py:311
CaloDirectionOperations::oppositeSide
static CaloDirection oppositeSide(const CaloDirection &side)
Definition:
CaloDirectionOperations.cc:86
CaloDirectionOperations::oppositeDirection
static unsigned oppositeDirection(unsigned iside)
Definition:
CaloDirectionOperations.cc:126
NORTHEAST
Definition:
CaloDirection.h:16
SOUTHEAST
Definition:
CaloDirection.h:12
CaloDirectionOperations::neighbourDirection
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -> Direction for the neighbours
Definition:
CaloDirectionOperations.cc:19
L1TDiffHarvesting_cfi.dir1
dir1
Definition:
L1TDiffHarvesting_cfi.py:10
EAST
Definition:
CaloDirection.h:14
SOUTHWEST
Definition:
CaloDirection.h:13
WEST
Definition:
CaloDirection.h:15
CaloDirectionOperations::Side
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
Definition:
CaloDirectionOperations.cc:13
NORTH
Definition:
CaloDirection.h:18
CaloDirectionOperations.h
Variation::DOWN
SOUTH
Definition:
CaloDirection.h:11
CaloDirection
CaloDirection
Codes the local directions in the cell lattice.
Definition:
CaloDirection.h:9
submitPVValidationJobs.od
od
Definition:
submitPVValidationJobs.py:898
NORTHWEST
Definition:
CaloDirection.h:17
NONE
Definition:
TkAlStyle.cc:47
Generated for CMSSW Reference Manual by
1.8.14