CMS 3D CMS Logo

EcalDAQHandler.cc
Go to the documentation of this file.
3 
5 
6 #include <iostream>
7 
8 // maps from EcalElectronicsMapping
9 // iphiEB and ietaEB[FedId - 610][towerId - 1]
10 // ixx and iyy[FEDid][iTT - 1][3] where FEDid -= 601 if FEDid < 610, FEDid -= 637 else
11 // pos = 0/2 filled when needed. ixx/iyy = 0 if unused
12 
13 const int iphiEB[36][68] = {
14  {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2,
15  3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4},
16  {5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6,
17  7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8},
18  {9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11,
19  12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10,
20  11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12, 9, 10, 11, 12},
21  {13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15,
22  16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14,
23  15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16},
24  {17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19,
25  20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18,
26  19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20},
27  {21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23,
28  24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22,
29  23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24},
30  {25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27,
31  28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26,
32  27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28},
33  {29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31,
34  32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30,
35  31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32},
36  {33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35,
37  36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34,
38  35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36},
39  {37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39,
40  40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38,
41  39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40},
42  {41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43,
43  44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42,
44  43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44},
45  {45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47,
46  48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46,
47  47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48},
48  {49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51,
49  52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50,
50  51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52},
51  {53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55,
52  56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54,
53  55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56},
54  {57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59,
55  60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58,
56  59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60},
57  {61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63,
58  64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62,
59  63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64},
60  {65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67,
61  68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66,
62  67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68},
63  {69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71,
64  72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70,
65  71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72},
66  {4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3,
67  2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1},
68  {8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7,
69  6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5, 8, 7, 6, 5},
70  {12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10,
71  9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11,
72  10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9, 12, 11, 10, 9},
73  {16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14,
74  13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15,
75  14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13},
76  {20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18,
77  17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19,
78  18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17},
79  {24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22,
80  21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23,
81  22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21},
82  {28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26,
83  25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27,
84  26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25},
85  {32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30,
86  29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31,
87  30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29},
88  {36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34,
89  33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35,
90  34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33},
91  {40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38,
92  37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39,
93  38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37},
94  {44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42,
95  41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43,
96  42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41},
97  {48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46,
98  45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47,
99  46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45},
100  {52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50,
101  49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51,
102  50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49},
103  {56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54,
104  53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55,
105  54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53},
106  {60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58,
107  57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59,
108  58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57},
109  {64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62,
110  61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63,
111  62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61},
112  {68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66,
113  65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67,
114  66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65},
115  {72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70,
116  69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71,
117  70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69}};
118 const int ietaEB[36][68] = {{1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
119  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
120  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
121  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
122  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
123  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
124  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
125  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
126  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
127  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
128  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
129  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
130  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
131  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
132  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
133  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
134  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
135  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
136  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
137  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
138  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
139  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
140  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
141  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
142  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
143  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
144  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
145  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
146  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
147  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
148  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
149  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
150  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
151  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
152  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
153  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
154  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
155  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
156  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
157  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
158  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
159  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
160  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
161  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
162  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
163  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
164  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
165  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
166  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
167  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
168  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
169  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
170  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
171  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
172  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
173  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
174  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
175  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
176  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
177  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
178  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
179  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
180  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
181  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
182  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
183  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
184  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
185  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
186  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
187  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
188  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
189  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
190  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
191  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
192  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
193  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
194  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
195  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
196  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
197  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
198  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
199  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
200  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
201  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
202  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
203  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
204  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
205  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
206  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
207  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
208  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
209  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
210  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
211  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
212  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
213  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
214  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
215  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
216  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
217  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
218  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
219  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
220  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
221  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
222  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
223  {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
224  6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
225  12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17}};
226 const int ixx[18][41][3] = {
227  {{19, 0, 0}, {20, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0},
228  {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {14, 0, 0},
229  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0},
230  {18, 0, 0}, {19, 0, 0}, {19, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {0, 0, 0}, {0, 0, 0},
231  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
232  {{16, 0, 0}, {17, 0, 0}, {18, 17, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0},
233  {18, 0, 0}, {19, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {13, 0, 0},
234  {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {12, 20, 19}, {13, 0, 0}, {14, 0, 0},
235  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {13, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
236  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
237  {{11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0},
238  {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {13, 0, 0}, {14, 0, 0},
239  {15, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {13, 0, 0},
240  {14, 0, 0}, {15, 0, 0}, {16, 13, 0}, {13, 0, 0}, {14, 0, 0}, {13, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
241  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
242  {{10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {10, 0, 0},
243  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {7, 0, 0},
244  {6, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0},
245  {7, 0, 0}, {6, 0, 0}, {5, 8, 0}, {8, 0, 0}, {7, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
246  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
247  {{5, 0, 0}, {4, 0, 0}, {3, 4, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0},
248  {3, 0, 0}, {2, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0},
249  {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {9, 1, 2}, {8, 0, 0}, {7, 0, 0},
250  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
251  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
252  {{2, 0, 0}, {1, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0},
253  {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {7, 0, 0},
254  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0},
255  {3, 0, 0}, {2, 0, 0}, {2, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0},
256  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
257  {{8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0},
258  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {3, 2, 9}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0},
259  {4, 0, 0}, {3, 0, 0}, {5, 4, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {5, 0, 0},
260  {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0}, {9, 0, 0}, {9, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
261  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
262  {{8, 0, 0}, {8, 0, 0}, {8, 0, 0}, {9, 0, 0}, {9, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0},
263  {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {0, 0, 0},
264  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0},
265  {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0},
266  {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}},
267  {{13, 0, 0}, {13, 0, 0}, {14, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {13, 0, 0}, {14, 0, 0},
268  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {18, 19, 12}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0},
269  {17, 0, 0}, {18, 0, 0}, {16, 17, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {16, 0, 0},
270  {14, 0, 0}, {14, 0, 0}, {15, 0, 0}, {15, 0, 0}, {12, 0, 0}, {12, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
271  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
272  {{19, 0, 0}, {20, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0},
273  {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {14, 0, 0},
274  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0},
275  {18, 0, 0}, {19, 0, 0}, {19, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {20, 0, 0}, {0, 0, 0}, {0, 0, 0},
276  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
277  {{16, 0, 0}, {17, 0, 0}, {18, 17, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0},
278  {18, 0, 0}, {19, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {13, 0, 0},
279  {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {19, 0, 0}, {12, 20, 19}, {13, 0, 0}, {14, 0, 0},
280  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {13, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
281  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
282  {{11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0},
283  {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {13, 0, 0}, {14, 0, 0},
284  {15, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {13, 0, 0},
285  {14, 0, 0}, {15, 0, 0}, {16, 13, 0}, {13, 0, 0}, {14, 0, 0}, {13, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
286  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
287  {{10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {10, 0, 0},
288  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {7, 0, 0},
289  {6, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0},
290  {7, 0, 0}, {6, 0, 0}, {5, 8, 0}, {8, 0, 0}, {7, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
291  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
292  {{5, 0, 0}, {4, 0, 0}, {3, 4, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0},
293  {3, 0, 0}, {2, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0},
294  {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {9, 1, 2}, {8, 0, 0}, {7, 0, 0},
295  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
296  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
297  {{2, 0, 0}, {1, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0},
298  {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {7, 0, 0},
299  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0},
300  {3, 0, 0}, {2, 0, 0}, {2, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0},
301  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
302  {{8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0},
303  {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {3, 2, 9}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0},
304  {4, 0, 0}, {3, 0, 0}, {5, 4, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {5, 0, 0},
305  {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0}, {9, 0, 0}, {9, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
306  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
307  {{13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0},
308  {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {0, 0, 0},
309  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {8, 0, 0}, {8, 0, 0}, {8, 0, 0},
310  {9, 0, 0}, {9, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0},
311  {9, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}},
312  {{13, 0, 0}, {13, 0, 0}, {14, 0, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {13, 0, 0}, {14, 0, 0},
313  {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {18, 0, 0}, {18, 19, 12}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0},
314  {17, 0, 0}, {18, 0, 0}, {16, 17, 0}, {13, 0, 0}, {14, 0, 0}, {15, 0, 0}, {16, 0, 0}, {17, 0, 0}, {16, 0, 0},
315  {14, 0, 0}, {14, 0, 0}, {15, 0, 0}, {15, 0, 0}, {12, 0, 0}, {12, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
316  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}};
317 const int iyy[18][41][3] = {
318  {{12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0},
319  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0},
320  {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {8, 0, 0},
321  {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0},
322  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
323  {{17, 0, 0}, {17, 0, 0}, {17, 18, 0}, {16, 0, 0}, {16, 0, 0}, {16, 0, 0}, {15, 0, 0}, {15, 0, 0}, {15, 0, 0},
324  {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {13, 0, 0},
325  {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {12, 13, 16}, {12, 0, 0}, {12, 0, 0},
326  {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
327  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
328  {{20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {16, 0, 0},
329  {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {16, 0, 0}, {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {19, 0, 0}, {19, 0, 0},
330  {19, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {17, 0, 0}, {17, 0, 0}, {17, 0, 0}, {16, 0, 0},
331  {16, 0, 0}, {16, 0, 0}, {19, 20, 0}, {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
332  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
333  {{20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {16, 0, 0},
334  {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {16, 0, 0}, {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {19, 0, 0}, {19, 0, 0},
335  {19, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {17, 0, 0}, {17, 0, 0}, {17, 0, 0}, {16, 0, 0},
336  {16, 0, 0}, {16, 0, 0}, {19, 20, 0}, {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
337  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
338  {{17, 0, 0}, {17, 0, 0}, {17, 18, 0}, {16, 0, 0}, {16, 0, 0}, {16, 0, 0}, {15, 0, 0}, {15, 0, 0}, {15, 0, 0},
339  {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {13, 0, 0},
340  {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {12, 13, 16}, {12, 0, 0}, {12, 0, 0},
341  {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
342  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
343  {{12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0},
344  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0},
345  {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {8, 0, 0},
346  {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0},
347  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
348  {{9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0},
349  {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {4, 5, 9}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0},
350  {5, 0, 0}, {5, 0, 0}, {2, 3, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {3, 0, 0},
351  {3, 0, 0}, {2, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0}, {7, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
352  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
353  {{3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0},
354  {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {0, 0, 0},
355  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0},
356  {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0},
357  {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}},
358  {{9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0},
359  {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {4, 5, 9}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0},
360  {5, 0, 0}, {5, 0, 0}, {2, 3, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {3, 0, 0},
361  {3, 0, 0}, {2, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0}, {7, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
362  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
363  {{12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0},
364  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0},
365  {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {8, 0, 0},
366  {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0},
367  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
368  {{17, 0, 0}, {17, 0, 0}, {17, 18, 0}, {16, 0, 0}, {16, 0, 0}, {16, 0, 0}, {15, 0, 0}, {15, 0, 0}, {15, 0, 0},
369  {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {13, 0, 0},
370  {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {12, 13, 16}, {12, 0, 0}, {12, 0, 0},
371  {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
372  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
373  {{20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {16, 0, 0},
374  {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {16, 0, 0}, {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {19, 0, 0}, {19, 0, 0},
375  {19, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {17, 0, 0}, {17, 0, 0}, {17, 0, 0}, {16, 0, 0},
376  {16, 0, 0}, {16, 0, 0}, {19, 20, 0}, {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
377  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
378  {{20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {20, 0, 0}, {19, 0, 0}, {18, 0, 0}, {17, 0, 0}, {16, 0, 0},
379  {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {16, 0, 0}, {15, 0, 0}, {14, 0, 0}, {13, 0, 0}, {19, 0, 0}, {19, 0, 0},
380  {19, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {18, 0, 0}, {17, 0, 0}, {17, 0, 0}, {17, 0, 0}, {16, 0, 0},
381  {16, 0, 0}, {16, 0, 0}, {19, 20, 0}, {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
382  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
383  {{17, 0, 0}, {17, 0, 0}, {17, 18, 0}, {16, 0, 0}, {16, 0, 0}, {16, 0, 0}, {15, 0, 0}, {15, 0, 0}, {15, 0, 0},
384  {15, 0, 0}, {15, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {14, 0, 0}, {13, 0, 0},
385  {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {13, 0, 0}, {12, 13, 16}, {12, 0, 0}, {12, 0, 0},
386  {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
387  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
388  {{12, 0, 0}, {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0},
389  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {9, 0, 0},
390  {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {8, 0, 0},
391  {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {8, 0, 0}, {0, 0, 0}, {0, 0, 0},
392  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
393  {{9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0},
394  {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {4, 5, 9}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0},
395  {5, 0, 0}, {5, 0, 0}, {2, 3, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {3, 0, 0},
396  {3, 0, 0}, {2, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0}, {7, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
397  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
398  {{3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0},
399  {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}, {0, 0, 0},
400  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0},
401  {6, 0, 0}, {5, 0, 0}, {8, 0, 0}, {7, 0, 0}, {6, 0, 0}, {5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0},
402  {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}},
403  {{9, 0, 0}, {8, 0, 0}, {8, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {7, 0, 0}, {6, 0, 0}, {6, 0, 0},
404  {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {6, 0, 0}, {4, 5, 9}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0}, {5, 0, 0},
405  {5, 0, 0}, {5, 0, 0}, {2, 3, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {4, 0, 0}, {3, 0, 0},
406  {3, 0, 0}, {2, 0, 0}, {3, 0, 0}, {2, 0, 0}, {8, 0, 0}, {7, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
407  {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}};
408 
410  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalDAQHandler")) {
411  std::cout << "EcalDAQ Source handler constructor\n" << std::endl;
412  m_firstRun = (unsigned long)atoi(ps.getParameter<std::string>("firstRun").c_str());
413  m_lastRun = (unsigned long)atoi(ps.getParameter<std::string>("lastRun").c_str());
414  m_sid = ps.getParameter<std::string>("OnlineDBSID");
415  m_user = ps.getParameter<std::string>("OnlineDBUser");
416  m_pass = ps.getParameter<std::string>("OnlineDBPassword");
417  m_location = ps.getParameter<std::string>("location");
418  m_runtype = ps.getParameter<std::string>("runtype");
419  m_gentag = ps.getParameter<std::string>("gentag");
420  m_debug = ps.getParameter<bool>("debug");
421 
422  std::cout << m_sid << "/" << m_user << std::endl;
423 }
424 
426 
427 uint16_t popcon::EcalDAQHandler::OffDBStatus(uint16_t dbStatus, int pos) {
428  uint16_t hv_off_dbstatus = (dbStatus & (1 << pos));
429  if (hv_off_dbstatus > 0)
430  hv_off_dbstatus = 1;
431  return hv_off_dbstatus;
432 }
433 
435  if (m_debug)
436  std::cout << "------- Ecal DAQ - > getNewObjects\n";
437 
438  std::ostringstream ss;
439  ss << "ECAL ";
440 
441  unsigned long long max_since = 1;
442 
443  // this is the last inserted run
444  max_since = tagInfo().lastInterval.since;
445 
446  // this is the last object in the DB
447  std::cout << " max_since : " << max_since << std::endl;
448 
449  uint16_t oldEBStatus[72][17][2];
450  uint16_t newEBStatus[72][17][2];
451  uint16_t oldEEStatus[20][20][2];
452  uint16_t newEEStatus[20][20][2];
453 
454  // we copy the last valid record to a temporary object peds
455  EcalDAQTowerStatus* daq_temp = new EcalDAQTowerStatus();
456 
457  if (tagInfo().size) {
458  Ref daq_db = lastPayload();
459  if (m_debug)
460  std::cout << "retrieved last payload " << std::endl;
461 
462  // barrel
463  int iz = -1;
464  for (int k = 0; k < 2; k++) {
465  if (k == 1)
466  iz = 1;
467  for (int iphi = 1; iphi < 73; iphi++) {
468  for (int ieta = 1; ieta < 18; ieta++) {
471 
472  uint16_t dbStatus = 0;
473  dbStatus = (daq_db->barrel(ebid.hashedIndex())).getStatusCode();
474  oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
475 
476  EcalDAQTowerStatus::const_iterator it = daq_db->find(ebid.rawId());
477  if (it != daq_db->end()) {
478  } else {
479  std::cout << "*** error channel not found: eta/phi =" << ieta << "/" << iphi << std::endl;
480  }
481  daq_temp->setValue(ebid, dbStatus);
482  if (m_debug && dbStatus != 0)
483  std::cout << "barrel side " << k << " phi " << iphi << " eta " << ieta << " status " << dbStatus
484  << std::endl;
485  }
486  } // end loop over ieta
487  } // end loop over iphi
488 
489  // endcap
490  for (int ix = 1; ix < 21; ix++) {
491  for (int iy = 1; iy < 21; iy++) {
492  if (EcalScDetId::validDetId(ix, iy, iz)) {
493  EcalScDetId eeid(ix, iy, iz);
494 
495  EcalDAQTowerStatus::const_iterator it = daq_db->find(eeid.rawId());
496 
497  uint16_t dbStatus = 0;
498  if (it != daq_db->end()) {
499  dbStatus = it->getStatusCode();
500  }
501  oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
502  daq_temp->setValue(eeid, dbStatus);
503  if (m_debug && dbStatus != 0)
504  std::cout << "endcap side " << k << " x " << ix << " y " << iy << " status " << dbStatus << std::endl;
505  }
506  } // end loop over iy
507  } // end loop over ix
508  } // end loop over k (side)
509  } // check if there is already a payload
510  else {
511  if (m_debug)
512  std::cout << " No db found : set default values " << std::endl;
513  // barrel
514  int iz = -1;
515  for (int k = 0; k < 2; k++) {
516  if (k == 1)
517  iz = 1;
518  for (int iphi = 1; iphi < 73; iphi++) {
519  for (int ieta = 1; ieta < 18; ieta++) {
522 
523  uint16_t dbStatus = 0;
524  oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
525  daq_temp->setValue(ebid, dbStatus);
526  } // valid Id
527  } // end loop over ieta
528  } // end loop over iphi
529  // endcap
530  for (int ix = 1; ix < 21; ix++) {
531  for (int iy = 1; iy < 21; iy++) {
532  if (EcalScDetId::validDetId(ix, iy, iz)) {
533  EcalScDetId eeid(ix, iy, iz);
534  uint16_t dbStatus = 0;
535  oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
536  daq_temp->setValue(eeid, dbStatus);
537  } // valid Id
538  } // end loop over iy
539  } // end loop over ix
540  } // end loop over k (side)
541  } // no payload set default values
542 
543  // now read the actual status from the online DB
544 
545  if (m_debug)
546  std::cout << "Retrieving DAQ status from OMDS DB ... " << std::endl;
547  econn = new EcalCondDBInterface(m_sid, m_user, m_pass);
548  if (m_debug)
549  std::cout << "Connection done" << std::endl;
550 
551  if (!econn) {
552  std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
553  throw cms::Exception("OMDS not available");
554  }
555 
556  // code from EcalTPGBadTTHandler.cc
558  my_locdef.setLocation(m_location);
559 
561  my_rundef.setRunType(m_runtype);
562 
563  RunTag my_runtag;
564  my_runtag.setLocationDef(my_locdef);
565  my_runtag.setRunTypeDef(my_rundef);
566  my_runtag.setGeneralTag(m_gentag);
567 
568  // range of validity
569  int min_run = 0;
570  if (m_firstRun < (unsigned long)max_since) {
571  min_run = (int)max_since + 1; // we have to add 1 to the last transferred one
572  } else {
573  min_run = (int)m_firstRun;
574  }
575  int max_run = (int)m_lastRun;
576  std::cout << "min_run " << min_run << " max_run " << max_run << std::endl;
577 
578  RunList my_list;
579  my_list = econn->fetchRunListByLocation(my_runtag, min_run, max_run, my_locdef);
580 
581  std::vector<RunIOV> run_vec = my_list.getRuns();
582  int num_runs = run_vec.size();
583 
584  std::cout << " number of runs is : " << num_runs << std::endl;
585 
586  unsigned long irun = 0;
587  if (num_runs > 0) {
588  // char outfile[800];
589  //sprintf(outfile,"BadChannelsEB_run%d.txt",min_run);
590  //ofstream *daqFile;
591  //daqFile = new ofstream(outfile,ios::out);
592 
593  //hlt for(int kr = 0; kr < num_runs; kr++){
594  for (int kr = num_runs - 1; kr < num_runs; kr++) {
595  // int krmax = std::min(num_runs, 1000);
596  // for(int kr = 0; kr < krmax; kr++){
597  //hlt if(m_to_transfer.size() < 20 ) {
598 
599  if (run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL")
600  continue;
601  bool somediff = false;
602  // initialize this run status to all OK
603  irun = (unsigned long)run_vec[kr].getRunNumber();
604  for (int k = 0; k < 2; k++) {
605  for (int iphi = 0; iphi < 72; iphi++) {
606  for (int ieta = 0; ieta < 17; ieta++) {
607  newEBStatus[iphi][ieta][k] = 0;
608  }
609  }
610  for (int ix = 0; ix < 20; ix++) {
611  for (int iy = 0; iy < 20; iy++) {
612  newEEStatus[ix][iy][k] = 0;
613  }
614  }
615  } // loop over side
616 
617  // these are the online conditions DB classes readout FEDs
618  std::map<EcalLogicID, RunDat> fed_dat;
619  econn->fetchDataSet(&fed_dat, &run_vec[kr]);
620 
621  // these are the online conditions DB classes unread FEs
622  typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
623  // EcalLogicID ecid_xt;
624  RunDat rdat_fe;
625  EcalLogicID idfed;
626 
627  std::map<EcalLogicID, RunFEConfigDat> feconfig;
628  econn->fetchDataSet(&feconfig, &run_vec[kr]);
629 
630  if (fed_dat.empty() || feconfig.empty()) {
631  std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag() << " Run type "
632  << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
633  << " feconfig and/or read FED size = 0, leaving..." << std::endl;
634  continue;
635  }
636 
637  if (fed_dat.size() != 54) {
638  int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
639  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
640  int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}};
641  for (fedIter p = fed_dat.begin(); p != fed_dat.end(); p++) {
642  idfed = p->first;
643  int sm = 0;
644  int z = 0;
645  if (idfed.getLogicID() < 2000000000) { // eb
646  sm = idfed.getID1();
647  // std::cout << " EB " << sm;
648  SM[sm - 1] = 1;
649  } else { // ee
650  z = idfed.getID1();
651  sm = idfed.getID2();
652  // std::cout << " EE " << z << " " << sm;
653  int izz = z;
654  if (z == -1)
655  izz = 0;
656  Sect[izz][sm - 1] = 1;
657  }
658  } // loop over all FED
660  /* if(irun == 124089) {
661  Sect[0][2] = 0;
662  Sect[1][7] = 0;
663  } */
665  // mark all TT/SC in the not read out FEDs
666  for (int sm = 0; sm < 36; sm++) // barrel
667  if (SM[sm] != 1) {
668  //std::cout << " missing EB " << sm + 1 << std::endl;
669  if (sm < 18)
670  for (int tt = 0; tt < 68; tt++)
671  newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
672  else
673  for (int tt = 0; tt < 68; tt++)
674  newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
675  }
676  for (int z = 0; z < 2; z++) // endcaps
677  for (int sec = 0; sec < 9; sec++)
678  if (Sect[z][sec] != 1) {
679  //std::cout << " missing EE " << z << " " << sec + 1 << std::endl;
680  int sec18 = sec;
681  if (z == 1)
682  sec18 = sec + 9;
683  for (int sc = 0; sc < 41; sc++) {
684  if (ixx[sec18][sc][0] != 0) {
685  newEEStatus[ixx[sec18][sc][0] - 1][iyy[sec18][sc][0] - 1][z] = 1;
686  if (ixx[sec18][sc][1] != 0) {
687  newEEStatus[ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][z] = 1;
688  if (ixx[sec18][sc][2] != 0) {
689  newEEStatus[ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][z] = 1;
690  }
691  }
692  }
693  } // loop over all possible SC in a sector
694  } // not read out sector
695  } // not all FED are read out
696 
697  typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
698  // EcalLogicID ecid_xt;
699  RunFEConfigDat rd_fe;
700 
701  int fe_conf_id = 0;
702  for (feConfIter p = feconfig.begin(); p != feconfig.end(); p++) {
703  // ecid_xt = p->first;
704  rd_fe = p->second;
705  fe_conf_id = rd_fe.getConfigId();
706  }
707 
708  // reading this configuration
709  ODFEDAQConfig myconfig;
710  myconfig.setId(fe_conf_id);
711  econn->fetchConfigSet(&myconfig);
712 
713  // list of bad towers
714  int myTT = myconfig.getBadTTId();
715  ODBadTTInfo mybadTT;
716  std::vector<ODBadTTDat> badTT_dat;
717  unsigned NbadTT = 0;
718 
719  /* if(myTT == 0) {
720  std::cout << " myTT = 0" << std::endl;
721  continue;
722  }
723  else {
724  */
725  if (myTT != 0) {
726  mybadTT.setId(myTT);
727  econn->fetchConfigSet(&mybadTT);
728 
729  econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
730  NbadTT = badTT_dat.size();
731  }
732 
733  /* std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
734  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
735  << " number of read FEDs " << fed_dat.size()
736  << " number of bad FEs " << NbadTT
737  << " fe_conf_id " << fe_conf_id << std::endl;
738  */
739 
740  // *daqFile << " run " << irun << " bad TT number " << NbadTT << "\n" << "Towers : ";
741  for (size_t iTT = 0; iTT < NbadTT; iTT++) {
742  int fed_id = badTT_dat[iTT].getFedId();
743  int tt_id = badTT_dat[iTT].getTTId();
744  // int SM = badTT_dat[iTT].getSMId(); // SM always 0!
745  int side = 0; // EB/EE-
746  //*daqFile << fed_id << "/" << tt_id << " ";
747  // std::cout << fed_id << "/" << tt_id << "/" << SM << "/" ;
748  // std::cout << fed_id << "/" << tt_id << "/";
749  if (fed_id >= 610 && fed_id <= 645) { // barrel
750  if (tt_id > 68) {
751  //std::cout << " Problem in Fed " << fed_id << " TT " << tt_id << " Give up " << std::endl;
752  continue;
753  }
754  if (fed_id > 627)
755  side = +1; // EB+
756  if (m_debug)
757  std::cout << " phi " << iphiEB[fed_id - 610][tt_id - 1] << " eta " << ietaEB[fed_id - 610][tt_id - 1]
758  << " side " << side << std::endl;
759  newEBStatus[iphiEB[fed_id - 610][tt_id - 1] - 1][ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
760  } else if (fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) { // endcap
761  if (tt_id > 41) {
762  //std::cout << " Problem in Fed " << fed_id << " SC " << tt_id << " Give up " << std::endl;
763  continue;
764  }
765  if (fed_id < 610) { // EE-
766  if (m_debug)
767  std::cout << " x " << ixx[fed_id - 601][tt_id - 1][0] << " y " << iyy[fed_id - 601][tt_id - 1][0];
768  newEEStatus[ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
769  if (ixx[fed_id - 601][tt_id - 1][1] != 0) { // partial SC
770  if (m_debug)
771  std::cout << " x2 " << ixx[fed_id - 601][tt_id - 1][1] << " y2 " << iyy[fed_id - 601][tt_id - 1][1];
772  newEEStatus[ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
773  if (ixx[fed_id - 601][tt_id - 1][2] != 0) { // partial SC
774  if (m_debug)
775  std::cout << " x3 " << ixx[fed_id - 601][tt_id - 1][2] << " y3 " << iyy[fed_id - 601][tt_id - 1][2];
776  newEEStatus[ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
777  }
778  }
779  if (m_debug)
780  std::cout << " side " << side << std::endl;
781  } else { // EE+
782  side = +1;
783  if (m_debug)
784  std::cout << " x " << ixx[fed_id - 637][tt_id - 1][0] << " y " << iyy[fed_id - 637][tt_id - 1][0];
785  newEEStatus[ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
786  if (ixx[fed_id - 637][tt_id - 1][1] != 0) { // partial SC
787  if (m_debug)
788  std::cout << " x2 " << ixx[fed_id - 637][tt_id - 1][1] << " y2 " << iyy[fed_id - 637][tt_id - 1][1];
789  newEEStatus[ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
790  if (ixx[fed_id - 637][tt_id - 1][2] != 0) { // partial SC
791  if (m_debug)
792  std::cout << " x3 " << ixx[fed_id - 637][tt_id - 1][2] << " y3 " << iyy[fed_id - 637][tt_id - 1][2];
793  newEEStatus[ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
794  }
795  }
796  if (m_debug)
797  std::cout << " side " << side << std::endl;
798  }
799  } else {
800  std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
801  continue;
802  }
803  } // end loop over iTT
804  if (m_debug)
805  std::cout << std::endl;
806  //*daqFile << std::endl;
807  for (int k = 0; k < 2; k++) {
808  int iz = -1;
809  if (k == 1)
810  iz = 1;
811  if (m_debug)
812  std::cout << " Side : " << k << " barrel " << std::endl; // barrel
813  for (int iphi = 0; iphi < 72; iphi++) {
814  for (int ieta = 0; ieta < 17; ieta++) {
815  if (newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
816  somediff = true;
817  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
818  daq_temp->setValue(ebid, newEBStatus[iphi][ieta][k]);
819  if (m_debug)
820  std::cout << " change in EB side " << iz << " phi " << iphi + 1 << " eta " << ieta + 1 << std::endl;
821  } // new status
822  if (m_debug)
823  std::cout << newEBStatus[iphi][ieta][k] << " ";
824  oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
825  }
826  if (m_debug)
827  std::cout << std::endl;
828  }
829  if (m_debug)
830  std::cout << " endcaps " << std::endl; // endcap
831  for (int iy = 0; iy < 20; iy++) {
832  for (int ix = 0; ix < 20; ix++) {
833  if (EcalScDetId::validDetId(ix + 1, iy + 1, iz)) {
834  if (newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
835  somediff = true;
836  EcalScDetId eeid(ix + 1, iy + 1, iz);
837  daq_temp->setValue(eeid, newEEStatus[ix][iy][k]);
838  if (m_debug)
839  std::cout << " change in EE side " << iz << " x " << ix + 1 << " y " << iy + 1 << std::endl;
840  } // new status
841  if (m_debug)
842  std::cout << newEEStatus[ix][iy][k] << " ";
843  oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
844  } // valid SC
845  else {
846  if (m_debug)
847  std::cout << ". ";
848  }
849  }
850  if (m_debug)
851  std::cout << std::endl;
852  }
853  } // loop over side
854 
855  if (somediff) {
856  // we copy the last valid record to the object that is sent to the DB
857  EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
858 
859  int iz = -1;
860  for (int k = 0; k < 2; k++) {
861  if (k == 1)
862  iz = 1;
863  for (int iphi = 1; iphi < 73; iphi++) {
864  for (int ieta = 1; ieta < 18; ieta++) {
867  uint16_t dbStatus = 0;
868  dbStatus = (daq_temp->barrel(ebid.hashedIndex())).getStatusCode();
869  daq_pop->setValue(ebid, dbStatus);
870  }
871  } // end loop over ieta
872  } // end loop over iphi
873 
874  // endcap
875  for (int ix = 1; ix < 21; ix++) {
876  for (int iy = 1; iy < 21; iy++) {
877  if (EcalScDetId::validDetId(ix, iy, iz)) {
878  EcalScDetId eeid(ix, iy, iz);
879 
880  EcalDAQTowerStatus::const_iterator it = daq_temp->find(eeid.rawId());
881  uint16_t dbStatus = 0;
882  if (it != daq_temp->end()) {
883  dbStatus = it->getStatusCode();
884  }
885  daq_pop->setValue(eeid, dbStatus);
886  }
887  } // end loop over iy
888  } // end loop over ix
889  } // end loop over k (side)
890 
891  std::cout << "Generating popcon record for run " << irun << std::endl;
892 
893  m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
894 
895  ss << "Run=" << irun << "_DAQchanged_" << std::endl;
896  m_userTextLog = ss.str() + ";";
897  } // some change found
898  else {
899  std::cout << "Run" << irun << " DAQ record was the same as previous run " << std::endl;
900  ss << "Run=" << irun << "_DAQunchanged_" << std::endl;
901  m_userTextLog = ss.str() + ";";
902 
903  } // no change
904 
905  // hlt } // check on number of already transferred runs
906  } // loop over runs
907  } // check on run number > 0
908 
909  // disconnect from DB
910  delete econn;
911  delete daq_temp;
912  if (m_debug)
913  std::cout << "Ecal - > end of getNewObjects -----------\n";
914 }
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:59
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:42
std::vector< RunIOV > getRuns()
Definition: RunList.cc:25
EcalDAQHandler(edm::ParameterSet const &)
unsigned long m_lastRun
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
int getID1() const
Definition: EcalLogicID.cc:30
void setId(int id)
Definition: ODFEDAQConfig.h:18
Definition: RunTag.h:13
int getID2() const
Definition: EcalLogicID.cc:32
const Item & barrel(size_t hashedIndex) const
int getConfigId() const
void setValue(const uint32_t id, const Item &item)
void getNewObjects() override
const int iyy[18][41][3]
const int ixx[18][41][3]
Definition: TTTypes.h:54
int getLogicID() const
Definition: EcalLogicID.cc:28
const int iphiEB[36][68]
int getBadTTId() const
Definition: ODFEDAQConfig.h:36
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:33
void setId(int id)
Definition: ODBadTTInfo.h:18
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
def getRunNumber(filename)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const int ietaEB[36][68]
unsigned long m_firstRun
const_iterator find(uint32_t rawId) const
Definition: RunDat.h:11
std::unique_ptr< EcalDAQTowerStatus > Ref
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
uint16_t OffDBStatus(uint16_t dbStatus, int pos)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
std::vector< Item >::const_iterator const_iterator
void setGeneralTag(std::string tag)
Definition: RunTag.cc:24