CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloDirectionOperations.cc
Go to the documentation of this file.
2 
4  // unsigned d1=Side(dir1);
5  // unsigned d2=Side(dir2);
6  constexpr CaloDirection tab[4][4] = {{NORTH, NORTHEAST, NONE, NORTHWEST},
10  return tab[Side(dir1)][Side(dir2)];
11 }
12 
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 
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
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 
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 
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 
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 }
static CaloDirection add2d(const CaloDirection &dir1, const CaloDirection &dir2)
static CaloDirection oppositeSide(const CaloDirection &side)
static unsigned oppositeDirection(unsigned iside)
static unsigned neighbourDirection(const CaloDirection &side)
unsigned int -&gt; Direction for the neighbours
tuple result
Definition: mps_fire.py:311
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9