CMS 3D CMS Logo

List of all members | Public Member Functions
L1RCTNeighborMap Class Reference

#include <L1RCTNeighborMap.h>

Public Member Functions

std::vector< int > east (int crate, int card, int region)
 
std::vector< int > ne (int crate, int card, int region)
 
std::vector< int > north (int crate, int card, int region)
 
std::vector< int > nw (int crate, int card, int region)
 
std::vector< int > se (int crate, int card, int region)
 
std::vector< int > south (int crate, int card, int region)
 
std::vector< int > sw (int crate, int card, int region)
 
std::vector< int > west (int crate, int card, int region)
 

Detailed Description

Definition at line 5 of file L1RCTNeighborMap.h.

Member Function Documentation

vector< int > L1RCTNeighborMap::east ( int  crate,
int  card,
int  region 
)

Definition at line 135 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

135  {
136  int newcrate(0), newcard(0), newregion(0);
137  std::vector<int> east(3);
138  if (crate < 9) {
139  if (card != 0 && card != 1 && card != 6) {
140  newcrate = crate;
141  if (region == 0) {
142  newregion = region + 1;
143  newcard = card - 2;
144  } else {
145  newregion = region - 1;
146  newcard = card;
147  }
148  } else if (card == 0 || card == 1) {
149  newcard = card;
150  if (region == 0) {
151  newcrate = crate + 9;
152  newregion = region;
153  } else {
154  newcrate = crate;
155  newregion = region - 1;
156  }
157  } else if (card == 6) {
158  newcrate = crate;
159  newregion = 1;
160  if (region == 0)
161  newcard = 4;
162  else
163  newcard = 5;
164  }
165  } else {
166  newcrate = crate;
167  if (card != 6) {
168  if (region == 0) {
169  newcard = card;
170  newregion = region + 1;
171  } else {
172  if (card != 4 && card != 5) {
173  newcard = card + 2;
174  newregion = region - 1;
175  } else if (card == 4) {
176  newcard = 6;
177  newregion = 0;
178  } else if (card == 5) {
179  newcard = 6;
180  newregion = 1;
181  }
182  }
183  } else {
184  newcrate = -1;
185  newcard = -1;
186  newregion = -1;
187  }
188  }
189  east.at(0) = newcrate;
190  east.at(1) = newcard;
191  east.at(2) = newregion;
192  return east;
193 }
std::vector< int > east(int crate, int card, int region)
vector< int > L1RCTNeighborMap::ne ( int  crate,
int  card,
int  region 
)

Definition at line 397 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

397  {
398  int newcrate(0), newcard(0), newregion(0);
399  std::vector<int> ne(3);
400  if (crate < 9) {
401  if (card == 0) {
402  newregion = 0;
403  newcard = 1;
404  if (region == 0) {
405  if (crate != 0)
406  newcrate = crate + 8;
407  else
408  newcrate = 17;
409  } else {
410  if (crate != 0)
411  newcrate = crate - 1;
412  else
413  newcrate = 8;
414  }
415  } else if (card == 1) {
416  newregion = 0;
417  newcard = 0;
418  if (region == 0)
419  newcrate = crate + 9;
420  else
421  newcrate = crate;
422  } else if (card == 2 || card == 4) {
423  newregion = !region;
424  newcard = card - 1 + 2 * region;
425  if (crate != 0)
426  newcrate = crate - 1;
427  else
428  newcrate = 8;
429  } else if (card == 5 || card == 3) {
430  newregion = !region;
431  newcard = card - 3 + 2 * region;
432  newcrate = crate;
433  } else if (card == 6) {
434  newregion = 1;
435  if (region == 0) {
436  newcard = 5;
437  if (crate != 0)
438  newcrate = crate - 1;
439  else
440  newcrate = 8;
441  } else {
442  newcard = 4;
443  newcrate = crate;
444  }
445  }
446  } else {
447  if (card == 0 || card == 2) {
448  newregion = !region;
449  newcard = card + 1 + 2 * region;
450  if (crate != 9)
451  newcrate = crate - 1;
452  else
453  newcrate = 17;
454  } else if (card == 1 || card == 3) {
455  newregion = !region;
456  newcard = card - 1 + 2 * region;
457  newcrate = crate;
458  } else if (card == 4) {
459  newregion = 1;
460  if (crate != 9)
461  newcrate = crate - 1;
462  else
463  newcrate = 17;
464  if (region == 0)
465  newcard = 5;
466  else
467  newcard = 6;
468  } else if (card == 5) {
469  newregion = !region;
470  newcrate = crate;
471  if (region == 0)
472  newcard = 4;
473  else
474  newcard = 6;
475  } else if (card == 6) {
476  newcrate = -1;
477  newcard = -1;
478  newregion = -1;
479  }
480  }
481  ne.at(0) = newcrate;
482  ne.at(1) = newcard;
483  ne.at(2) = newregion;
484  return ne;
485 }
std::vector< int > ne(int crate, int card, int region)
vector< int > L1RCTNeighborMap::north ( int  crate,
int  card,
int  region 
)

Definition at line 6 of file L1RCTNeighborMap.cc.

References north().

Referenced by north(), and L1RCT::shareNeighbors().

6  {
7  std::vector<int> north(3);
8  int newregion(0), newcard(0), newcrate(0);
9  if (card == 0 || card == 2 || card == 4) {
10  newcard = card + 1;
11  newregion = region;
12  if (crate != 0 && crate != 9)
13  newcrate = crate - 1;
14  else
15  newcrate = crate + 8;
16  } else if (card == 1 || card == 3 || card == 5) {
17  newcard = card - 1;
18  newregion = region;
19  newcrate = crate;
20  } else if (card == 6) {
21  if (region == 0) {
22  newcard = card;
23  newregion = region + 1;
24  if (crate != 0 && crate != 9)
25  newcrate = crate - 1;
26  else
27  newcrate = crate + 8;
28  } else {
29  newcard = card;
30  newregion = region - 1;
31  newcrate = crate;
32  }
33  }
34  north.at(0) = newcrate;
35  north.at(1) = newcard;
36  north.at(2) = newregion;
37  return north;
38 }
std::vector< int > north(int crate, int card, int region)
vector< int > L1RCTNeighborMap::nw ( int  crate,
int  card,
int  region 
)

Definition at line 487 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

487  {
488  int newcrate(0), newcard(0), newregion(0);
489  std::vector<int> nw(3);
490  if (crate > 8) {
491  if (card == 0) {
492  newregion = 0;
493  newcard = 1;
494  if (region == 0) {
495  if (crate != 9)
496  newcrate = crate - 10;
497  else
498  newcrate = 8;
499  } else {
500  if (crate != 9)
501  newcrate = crate - 1;
502  else
503  newcrate = 17;
504  }
505  } else if (card == 1) {
506  newregion = 0;
507  newcard = 0;
508  if (region == 0)
509  newcrate = crate - 9;
510  else
511  newcrate = crate;
512  } else if (card == 2 || card == 4) {
513  newregion = !region;
514  newcard = card - 1 + 2 * region;
515  if (crate != 9)
516  newcrate = crate - 1;
517  else
518  newcrate = 17;
519  } else if (card == 5 || card == 3) {
520  newregion = !region;
521  newcard = card - 3 + 2 * region;
522  newcrate = crate;
523  } else if (card == 6) {
524  newregion = 1;
525  if (region == 0) {
526  newcard = 5;
527  if (crate != 9)
528  newcrate = crate - 1;
529  else
530  newcrate = 17;
531  } else {
532  newcard = 4;
533  newcrate = crate;
534  }
535  }
536  } else {
537  if (card == 0 || card == 2) {
538  newregion = !region;
539  newcard = card + 1 + 2 * region;
540  if (crate != 0)
541  newcrate = crate - 1;
542  else
543  newcrate = 8;
544  } else if (card == 1 || card == 3) {
545  newregion = !region;
546  newcard = card - 1 + 2 * region;
547  newcrate = crate;
548  } else if (card == 4) {
549  newregion = 1;
550  if (crate != 0)
551  newcrate = crate - 1;
552  else
553  newcrate = 8;
554  if (region == 0)
555  newcard = 5;
556  else
557  newcard = 6;
558  } else if (card == 5) {
559  newregion = !region;
560  newcrate = crate;
561  if (region == 0)
562  newcard = 4;
563  else
564  newcard = 6;
565  } else if (card == 6) {
566  newcrate = -1;
567  newcard = -1;
568  newregion = -1;
569  }
570  }
571  nw.at(0) = newcrate;
572  nw.at(1) = newcard;
573  nw.at(2) = newregion;
574  return nw;
575 }
std::vector< int > nw(int crate, int card, int region)
vector< int > L1RCTNeighborMap::se ( int  crate,
int  card,
int  region 
)

Definition at line 195 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

195  {
196  int newcrate(0), newcard(0), newregion(0);
197  std::vector<int> se(3);
198  if (crate < 9) {
199  if (card == 0) {
200  if (region == 0) {
201  newcrate = crate + 9;
202  newregion = region;
203  newcard = 1;
204  } else {
205  newcrate = crate;
206  newregion = 0;
207  newcard = 1;
208  }
209  } else if (card == 1) {
210  if (region == 0) {
211  if (crate != 8)
212  newcrate = crate + 10;
213  else
214  newcrate = 9;
215  newregion = 0;
216  newcard = 0;
217  } else {
218  if (crate != 8)
219  newcrate = crate + 1;
220  else
221  newcrate = 0;
222  newregion = 0;
223  newcard = 0;
224  }
225  } else if (card == 2 || card == 4) {
226  newcrate = crate;
227  newregion = !region;
228  newcard = card - 1 + 2 * region;
229  } else if (card == 5 || card == 3) {
230  newregion = !region;
231  newcard = card - 3 + 2 * region;
232  if (crate != 8)
233  newcrate = crate + 1;
234  else
235  newcrate = 0;
236  } else if (card == 6) {
237  if (region == 0) {
238  newcard = 5;
239  newregion = 1;
240  newcrate = crate;
241  } else {
242  newcard = 4;
243  newregion = 1;
244  if (crate != 8)
245  newcrate = crate + 1;
246  else
247  newcrate = 0;
248  }
249  }
250  } else {
251  if (card == 0 || card == 2) {
252  newregion = !region;
253  newcrate = crate;
254  newcard = card + 2 * region + 1;
255  } else if (card == 1 || card == 3) {
256  newregion = !region;
257  newcard = card - 1 + 2 * region;
258  if (crate != 17)
259  newcrate = crate + 1;
260  else
261  newcrate = 9;
262  } else if (card == 4) {
263  newcrate = crate;
264  if (region == 0) {
265  newregion = 1;
266  newcard = 5;
267  } else {
268  newregion = 1;
269  newcard = 6;
270  }
271  } else if (card == 5) {
272  if (region == 0) {
273  newcard = 4;
274  newregion = 1;
275  } else {
276  newcard = 6;
277  newregion = 0;
278  }
279  if (crate != 17)
280  newcrate = crate + 1;
281  else
282  newcrate = 9;
283  } else if (card == 6) {
284  newcard = -1;
285  newregion = -1;
286  newcrate = -1;
287  }
288  }
289 
290  se.at(0) = newcrate;
291  se.at(1) = newcard;
292  se.at(2) = newregion;
293  return se;
294 }
std::vector< int > se(int crate, int card, int region)
vector< int > L1RCTNeighborMap::south ( int  crate,
int  card,
int  region 
)

Definition at line 40 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

40  {
41  int newcrate(0), newcard(0), newregion(0);
42  std::vector<int> south(3);
43  if (card == 0 || card == 2 || card == 4) {
44  newcard = card + 1;
45  newregion = region;
46  newcrate = crate;
47  } else if (card == 1 || card == 3 || card == 5) {
48  newcard = card - 1;
49  newregion = region;
50  if (crate != 8 && crate != 17)
51  newcrate = crate + 1;
52  else
53  newcrate = crate - 8;
54  } else if (card == 6) {
55  if (region == 0) {
56  newcrate = crate;
57  newcard = card;
58  newregion = region + 1;
59  } else {
60  newcard = card;
61  newregion = region - 1;
62  if (crate != 8 && crate != 17)
63  newcrate = crate + 1;
64  else
65  newcrate = crate - 8;
66  }
67  }
68  south.at(0) = newcrate;
69  south.at(1) = newcard;
70  south.at(2) = newregion;
71  return south;
72 }
std::vector< int > south(int crate, int card, int region)
vector< int > L1RCTNeighborMap::sw ( int  crate,
int  card,
int  region 
)

Definition at line 296 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

296  {
297  int newcrate(0), newcard(0), newregion(0);
298  std::vector<int> sw(3);
299  if (crate > 8) {
300  if (card == 0) {
301  if (region == 0) {
302  newcrate = crate - 9;
303  newregion = region;
304  newcard = 1;
305  } else {
306  newcrate = crate;
307  newregion = 0;
308  newcard = 1;
309  }
310  } else if (card == 1) {
311  if (region == 0) {
312  if (crate != 17)
313  newcrate = crate - 8;
314  else
315  newcrate = 0;
316  newregion = 0;
317  newcard = 0;
318  } else {
319  if (crate != 17)
320  newcrate = crate + 1;
321  else
322  newcrate = 9;
323  newregion = 0;
324  newcard = 0;
325  }
326  } else if (card == 2 || card == 4) {
327  newcrate = crate;
328  newregion = !region;
329  newcard = card - 1 + 2 * region;
330  } else if (card == 5 || card == 3) {
331  newregion = !region;
332  newcard = card - 3 + 2 * region;
333  if (crate != 17)
334  newcrate = crate + 1;
335  else
336  newcrate = 9;
337  } else if (card == 6) {
338  if (region == 0) {
339  newcard = 5;
340  newregion = 1;
341  newcrate = crate;
342  } else {
343  newcard = 4;
344  newregion = 1;
345  if (crate != 17)
346  newcrate = crate + 1;
347  else
348  newcrate = 9;
349  }
350  }
351  } else {
352  if (card == 0 || card == 2) {
353  newregion = !region;
354  newcrate = crate;
355  newcard = card + 1 + 2 * region;
356  } else if (card == 1 || card == 3) {
357  newregion = !region;
358  newcard = card - 1 + 2 * region;
359  if (crate != 8)
360  newcrate = crate + 1;
361  else
362  newcrate = 0;
363  } else if (card == 4) {
364  newcrate = crate;
365  if (region == 0) {
366  newregion = 1;
367  newcard = 5;
368  } else {
369  newregion = 1;
370  newcard = 6;
371  }
372  } else if (card == 5) {
373  if (region == 0) {
374  newcard = 4;
375  newregion = 1;
376  } else {
377  newcard = 6;
378  newregion = 0;
379  }
380  if (crate != 8)
381  newcrate = crate + 1;
382  else
383  newcrate = 0;
384  } else if (card == 6) {
385  newcard = -1;
386  newregion = -1;
387  newcrate = -1;
388  }
389  }
390 
391  sw.at(0) = newcrate;
392  sw.at(1) = newcard;
393  sw.at(2) = newregion;
394  return sw;
395 }
std::vector< int > sw(int crate, int card, int region)
vector< int > L1RCTNeighborMap::west ( int  crate,
int  card,
int  region 
)

Definition at line 74 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

74  {
75  int newcrate(0), newcard(0), newregion(0);
76  std::vector<int> west(3);
77  if (crate < 9) {
78  newcrate = crate;
79  if (card != 6) {
80  if (region == 0) {
81  newcard = card;
82  newregion = region + 1;
83  } else {
84  if (card != 4 && card != 5) {
85  newcard = card + 2;
86  newregion = region - 1;
87  } else if (card == 4) {
88  newcard = 6;
89  newregion = 0;
90  } else if (card == 5) {
91  newcard = 6;
92  newregion = 1;
93  }
94  }
95  } else {
96  newcrate = -1;
97  newcard = -1;
98  newregion = -1;
99  }
100  } else {
101  if (card == 0 || card == 1) {
102  if (region == 0) {
103  newcrate = crate - 9;
104  newregion = region;
105  newcard = card;
106  } else {
107  newcrate = crate;
108  newregion = region - 1;
109  newcard = card;
110  }
111  } else if (card != 6) {
112  newcrate = crate;
113  if (region == 0) {
114  newcard = card - 2;
115  newregion = region + 1;
116  } else {
117  newcard = card;
118  newregion = region - 1;
119  }
120  } else if (card == 6) {
121  newcrate = crate;
122  newregion = 1;
123  if (region == 0)
124  newcard = 4;
125  else
126  newcard = 5;
127  }
128  }
129  west.at(0) = newcrate;
130  west.at(1) = newcard;
131  west.at(2) = newregion;
132  return west;
133 }
std::vector< int > west(int crate, int card, int region)