CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 150 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

150  {
151  int newcrate(0),newcard(0),newregion(0);
152  std::vector<int> east(3);
153  if(crate < 9){
154  if(card != 0 && card != 1 && card != 6){
155  newcrate = crate;
156  if(region == 0){
157  newregion = region+1;
158  newcard = card-2;
159  }
160  else{
161  newregion = region-1;
162  newcard = card;
163  }
164  }
165  else if(card == 0 || card == 1){
166  newcard = card;
167  if(region == 0){
168  newcrate = crate+9;
169  newregion = region;
170  }
171  else {
172  newcrate = crate;
173  newregion = region-1;
174  }
175  }
176  else if(card == 6){
177  newcrate = crate;
178  newregion = 1;
179  if(region == 0)
180  newcard = 4;
181  else
182  newcard = 5;
183  }
184  }
185  else {
186  newcrate = crate;
187  if(card != 6){
188  if(region == 0){
189  newcard = card;
190  newregion = region+1;
191  }
192  else{
193  if(card != 4 && card != 5){
194  newcard = card+2;
195  newregion = region-1;
196  }
197  else if(card == 4){
198  newcard = 6;
199  newregion = 0;
200  }
201  else if(card == 5){
202  newcard = 6;
203  newregion = 1;
204  }
205  }
206  }
207  else{
208  newcrate = -1;
209  newcard = -1;
210  newregion = -1;
211  }
212  }
213  east.at(0) = newcrate;
214  east.at(1) = newcard;
215  east.at(2) = newregion;
216  return east;
217 }
std::vector< int > east(int crate, int card, int region)
vector< int > L1RCTNeighborMap::ne ( int  crate,
int  card,
int  region 
)

Definition at line 449 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

449  {
450  int newcrate(0),newcard(0),newregion(0);
451  std::vector<int> ne(3);
452  if(crate < 9){
453  if(card == 0){
454  newregion = 0;
455  newcard = 1;
456  if(region == 0){
457  if(crate != 0)
458  newcrate = crate +8;
459  else
460  newcrate = 17;
461  }
462  else{
463  if(crate != 0)
464  newcrate = crate-1;
465  else
466  newcrate = 8;
467  }
468  }
469  else if(card == 1){
470  newregion = 0;
471  newcard = 0;
472  if(region == 0)
473  newcrate = crate+9;
474  else
475  newcrate = crate;
476  }
477  else if(card == 2 || card == 4){
478  newregion = !region;
479  newcard = card-1+2*region;
480  if(crate != 0)
481  newcrate = crate-1;
482  else
483  newcrate = 8;
484  }
485  else if(card == 5 || card == 3){
486  newregion = !region;
487  newcard = card-3+2*region;
488  newcrate = crate;
489  }
490  else if(card == 6){
491  newregion = 1;
492  if(region==0){
493  newcard = 5;
494  if(crate != 0)
495  newcrate = crate-1;
496  else
497  newcrate = 8;
498  }
499  else {
500  newcard = 4;
501  newcrate = crate;
502  }
503  }
504  }
505  else {
506  if(card == 0 || card ==2){
507  newregion = !region;
508  newcard = card+1+2*region;
509  if(crate!=9)
510  newcrate = crate-1;
511  else
512  newcrate = 17;
513  }
514  else if(card == 1 || card == 3){
515  newregion = !region;
516  newcard = card-1+2*region;
517  newcrate = crate;
518  }
519  else if(card == 4){
520  newregion = 1;
521  if(crate != 9)
522  newcrate = crate-1;
523  else
524  newcrate = 17;
525  if(region == 0)
526  newcard = 5;
527  else
528  newcard = 6;
529  }
530  else if(card == 5){
531  newregion = !region;
532  newcrate = crate;
533  if(region == 0)
534  newcard = 4;
535  else
536  newcard = 6;
537  }
538  else if(card == 6){
539  newcrate = -1;
540  newcard = -1;
541  newregion = -1;
542  }
543  }
544  ne.at(0) = newcrate;
545  ne.at(1) = newcard;
546  ne.at(2) = newregion;
547  return ne;
548 }
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  }
17  else if(card == 1 || card == 3 || card == 5){
18  newcard = card-1;
19  newregion = region;
20  newcrate = crate;
21  }
22  else if(card == 6){
23  if(region == 0){
24  newcard = card;
25  newregion = region+1;
26  if(crate != 0 && crate != 9)
27  newcrate = crate-1;
28  else
29  newcrate = crate+8;
30  }
31  else {
32  newcard = card;
33  newregion = region-1;
34  newcrate = crate;
35  }
36  }
37  north.at(0) = newcrate;
38  north.at(1) = newcard;
39  north.at(2) = newregion;
40  return north;
41 }
std::vector< int > north(int crate, int card, int region)
vector< int > L1RCTNeighborMap::nw ( int  crate,
int  card,
int  region 
)

Definition at line 550 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

550  {
551  int newcrate(0),newcard(0),newregion(0);
552  std::vector<int> nw(3);
553  if(crate > 8){
554  if(card == 0){
555  newregion = 0;
556  newcard = 1;
557  if(region == 0){
558  if(crate != 9)
559  newcrate = crate -10;
560  else
561  newcrate = 8;
562  }
563  else{
564  if(crate != 9)
565  newcrate = crate-1;
566  else
567  newcrate = 17;
568  }
569  }
570  else if(card == 1){
571  newregion = 0;
572  newcard = 0;
573  if(region == 0)
574  newcrate = crate-9;
575  else
576  newcrate = crate;
577  }
578  else if(card == 2 || card == 4){
579  newregion = !region;
580  newcard = card-1+2*region;
581  if(crate != 9)
582  newcrate = crate-1;
583  else
584  newcrate = 17;
585  }
586  else if(card == 5 || card == 3){
587  newregion = !region;
588  newcard = card-3+2*region;
589  newcrate = crate;
590  }
591  else if(card == 6){
592  newregion = 1;
593  if(region==0){
594  newcard = 5;
595  if(crate != 9)
596  newcrate = crate-1;
597  else
598  newcrate = 17;
599  }
600  else {
601  newcard = 4;
602  newcrate = crate;
603  }
604  }
605  }
606  else {
607  if(card == 0 || card ==2){
608  newregion = !region;
609  newcard = card+1+2*region;
610  if(crate!=0)
611  newcrate = crate-1;
612  else
613  newcrate = 8;
614  }
615  else if(card == 1 || card == 3){
616  newregion = !region;
617  newcard = card-1+2*region;
618  newcrate = crate;
619  }
620  else if(card == 4){
621  newregion = 1;
622  if(crate != 0)
623  newcrate = crate-1;
624  else
625  newcrate = 8;
626  if(region == 0)
627  newcard = 5;
628  else
629  newcard = 6;
630  }
631  else if(card == 5){
632  newregion = !region;
633  newcrate = crate;
634  if(region == 0)
635  newcard = 4;
636  else
637  newcard = 6;
638  }
639  else if(card == 6){
640  newcrate = -1;
641  newcard = -1;
642  newregion = -1;
643  }
644  }
645  nw.at(0) = newcrate;
646  nw.at(1) = newcard;
647  nw.at(2) = newregion;
648  return nw;
649 }
std::vector< int > nw(int crate, int card, int region)
vector< int > L1RCTNeighborMap::se ( int  crate,
int  card,
int  region 
)

Definition at line 219 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

219  {
220  int newcrate(0),newcard(0),newregion(0);
221  std::vector<int> se(3);
222  if(crate < 9){
223  if(card == 0){
224  if(region == 0){
225  newcrate = crate+9;
226  newregion = region;
227  newcard = 1;
228  }
229  else{
230  newcrate = crate;
231  newregion = 0;
232  newcard = 1;
233  }
234  }
235  else if(card == 1){
236  if(region == 0){
237  if(crate != 8)
238  newcrate = crate+10;
239  else
240  newcrate = 9;
241  newregion = 0;
242  newcard = 0;
243  }
244  else {
245  if(crate != 8)
246  newcrate = crate+1;
247  else
248  newcrate = 0;
249  newregion = 0;
250  newcard = 0;
251  }
252  }
253  else if(card == 2 || card == 4){
254  newcrate = crate;
255  newregion = !region;
256  newcard = card-1+2*region;
257  }
258  else if(card == 5 || card == 3){
259  newregion = !region;
260  newcard = card-3+2*region;
261  if(crate != 8)
262  newcrate = crate+1;
263  else
264  newcrate = 0;
265  }
266  else if(card == 6){
267  if(region == 0){
268  newcard = 5;
269  newregion = 1;
270  newcrate = crate;
271  }
272  else{
273  newcard = 4;
274  newregion = 1;
275  if(crate != 8)
276  newcrate = crate+1;
277  else
278  newcrate = 0;
279  }
280  }
281  }
282  else{
283  if(card == 0 || card == 2){
284  newregion = !region;
285  newcrate = crate;
286  newcard = card+2*region+1;
287  }
288  else if(card == 1 || card == 3){
289  newregion = !region;
290  newcard = card-1+2*region;
291  if(crate != 17)
292  newcrate = crate+1;
293  else
294  newcrate = 9;
295  }
296  else if(card == 4){
297  newcrate = crate;
298  if(region == 0){
299  newregion = 1;
300  newcard = 5;
301  }
302  else{
303  newregion = 1;
304  newcard = 6;
305  }
306  }
307  else if(card == 5){
308  if(region == 0){
309  newcard = 4;
310  newregion = 1;
311  }
312  else{
313  newcard = 6;
314  newregion = 0;
315  }
316  if(crate != 17)
317  newcrate = crate+1;
318  else
319  newcrate = 9;
320  }
321  else if(card == 6){
322  newcard = -1;
323  newregion = -1;
324  newcrate = -1;
325  }
326  }
327 
328  se.at(0) = newcrate;
329  se.at(1) = newcard;
330  se.at(2) = newregion;
331  return se;
332 }
std::vector< int > se(int crate, int card, int region)
vector< int > L1RCTNeighborMap::south ( int  crate,
int  card,
int  region 
)

Definition at line 43 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

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

Definition at line 334 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

334  {
335  int newcrate(0),newcard(0),newregion(0);
336  std::vector<int> sw(3);
337  if(crate > 8){
338  if(card == 0){
339  if(region == 0){
340  newcrate = crate-9;
341  newregion = region;
342  newcard = 1;
343  }
344  else{
345  newcrate = crate;
346  newregion = 0;
347  newcard = 1;
348  }
349  }
350  else if(card == 1){
351  if(region == 0){
352  if(crate != 17)
353  newcrate = crate-8;
354  else
355  newcrate = 0;
356  newregion = 0;
357  newcard = 0;
358  }
359  else {
360  if(crate != 17)
361  newcrate = crate+1;
362  else
363  newcrate = 9;
364  newregion = 0;
365  newcard = 0;
366  }
367  }
368  else if(card == 2 || card == 4){
369  newcrate = crate;
370  newregion = !region;
371  newcard = card-1+2*region;
372  }
373  else if(card == 5 || card == 3){
374  newregion = !region;
375  newcard = card-3+2*region;
376  if(crate != 17)
377  newcrate = crate+1;
378  else
379  newcrate = 9;
380  }
381  else if(card == 6){
382  if(region == 0){
383  newcard = 5;
384  newregion = 1;
385  newcrate = crate;
386  }
387  else{
388  newcard = 4;
389  newregion = 1;
390  if(crate != 17)
391  newcrate = crate+1;
392  else
393  newcrate = 9;
394  }
395  }
396  }
397  else{
398  if(card == 0 || card == 2){
399  newregion = !region;
400  newcrate = crate;
401  newcard = card+1+2*region;
402  }
403  else if(card == 1 || card == 3){
404  newregion = !region;
405  newcard = card-1+2*region;
406  if(crate != 8)
407  newcrate = crate+1;
408  else
409  newcrate = 0;
410  }
411  else if(card == 4){
412  newcrate = crate;
413  if(region == 0){
414  newregion = 1;
415  newcard = 5;
416  }
417  else{
418  newregion = 1;
419  newcard = 6;
420  }
421  }
422  else if(card == 5){
423  if(region == 0){
424  newcard = 4;
425  newregion = 1;
426  }
427  else{
428  newcard = 6;
429  newregion = 0;
430  }
431  if(crate != 8)
432  newcrate = crate+1;
433  else
434  newcrate = 0;
435  }
436  else if(card == 6){
437  newcard = -1;
438  newregion = -1;
439  newcrate = -1;
440  }
441  }
442 
443  sw.at(0) = newcrate;
444  sw.at(1) = newcard;
445  sw.at(2) = newregion;
446  return sw;
447 }
std::vector< int > sw(int crate, int card, int region)
vector< int > L1RCTNeighborMap::west ( int  crate,
int  card,
int  region 
)

Definition at line 80 of file L1RCTNeighborMap.cc.

Referenced by L1RCT::shareNeighbors().

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