Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-02 03:39:02

0001 #include "CondTools/Ecal/interface/EcalDAQHandler.h"
0002 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0005 
0006 #include <iostream>
0007 
0008 //  maps from EcalElectronicsMapping
0009 // iphiEB and ietaEB[FedId - 610][towerId - 1]
0010 // ixx and iyy[FEDid][iTT - 1][3] where  FEDid -= 601 if FEDid < 610, FEDid -= 637 else
0011 // pos = 0/2 filled when needed. ixx/iyy = 0 if unused
0012 
0013 const int iphiEB[36][68] = {
0014     {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,
0015      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},
0016     {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,
0017      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},
0018     {9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11,
0019      12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10,
0020      11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12, 9,  10, 11, 12},
0021     {13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15,
0022      16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14,
0023      15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16, 13, 14, 15, 16},
0024     {17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19,
0025      20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18,
0026      19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20},
0027     {21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23,
0028      24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22,
0029      23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24, 21, 22, 23, 24},
0030     {25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27,
0031      28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26,
0032      27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28, 25, 26, 27, 28},
0033     {29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31,
0034      32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30,
0035      31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32, 29, 30, 31, 32},
0036     {33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35,
0037      36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34,
0038      35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36, 33, 34, 35, 36},
0039     {37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39,
0040      40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38,
0041      39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40, 37, 38, 39, 40},
0042     {41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43,
0043      44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42,
0044      43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44, 41, 42, 43, 44},
0045     {45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47,
0046      48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46,
0047      47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48, 45, 46, 47, 48},
0048     {49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51,
0049      52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50,
0050      51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52, 49, 50, 51, 52},
0051     {53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55,
0052      56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54,
0053      55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56},
0054     {57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59,
0055      60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58,
0056      59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60, 57, 58, 59, 60},
0057     {61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63,
0058      64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62,
0059      63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64, 61, 62, 63, 64},
0060     {65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67,
0061      68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66,
0062      67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68, 65, 66, 67, 68},
0063     {69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71,
0064      72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70,
0065      71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72, 69, 70, 71, 72},
0066     {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,
0067      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},
0068     {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,
0069      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},
0070     {12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10,
0071      9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11,
0072      10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9,  12, 11, 10, 9},
0073     {16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14,
0074      13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15,
0075      14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13, 16, 15, 14, 13},
0076     {20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18,
0077      17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19,
0078      18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17, 20, 19, 18, 17},
0079     {24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22,
0080      21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23,
0081      22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21, 24, 23, 22, 21},
0082     {28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26,
0083      25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27,
0084      26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25, 28, 27, 26, 25},
0085     {32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30,
0086      29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31,
0087      30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29, 32, 31, 30, 29},
0088     {36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34,
0089      33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35,
0090      34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33, 36, 35, 34, 33},
0091     {40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38,
0092      37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39,
0093      38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37, 40, 39, 38, 37},
0094     {44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42,
0095      41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43,
0096      42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41, 44, 43, 42, 41},
0097     {48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46,
0098      45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47,
0099      46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45, 48, 47, 46, 45},
0100     {52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50,
0101      49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51,
0102      50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49, 52, 51, 50, 49},
0103     {56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54,
0104      53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55,
0105      54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53, 56, 55, 54, 53},
0106     {60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58,
0107      57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59,
0108      58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57, 60, 59, 58, 57},
0109     {64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62,
0110      61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63,
0111      62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61, 64, 63, 62, 61},
0112     {68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66,
0113      65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67,
0114      66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65, 68, 67, 66, 65},
0115     {72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70,
0116      69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71,
0117      70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69, 72, 71, 70, 69}};
0118 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,
0119                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0120                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0121                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0122                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0123                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0124                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0125                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0126                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0127                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0128                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0129                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0130                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0131                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0132                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0133                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0134                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0135                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0136                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0137                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0138                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0139                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0140                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0141                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0142                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0143                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0144                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0145                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0146                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0147                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0148                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0149                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0150                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0151                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0152                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0153                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0154                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0155                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0156                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0157                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0158                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0159                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0160                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0161                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0162                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0163                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0164                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0165                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0166                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0167                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0168                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0169                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0170                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0171                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0172                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0173                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0174                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0175                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0176                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0177                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0178                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0179                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0180                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0181                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0182                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0183                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0184                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0185                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0186                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0187                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0188                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0189                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0190                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0191                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0192                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0193                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0194                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0195                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0196                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0197                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0198                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0199                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0200                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0201                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0202                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0203                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0204                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0205                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0206                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0207                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0208                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0209                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0210                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0211                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0212                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0213                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0214                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0215                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0216                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0217                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0218                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0219                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0220                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0221                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0222                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17},
0223                             {1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,
0224                              6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9,  10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
0225                              12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17}};
0226 const int ixx[18][41][3] = {
0227     {{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},
0228      {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},
0229      {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},
0230      {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},
0231      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0232     {{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},
0233      {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},
0234      {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},
0235      {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},
0236      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0237     {{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},
0238      {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},
0239      {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},
0240      {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},
0241      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0242     {{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},
0243      {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},
0244      {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},
0245      {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},
0246      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0247     {{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},
0248      {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},
0249      {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},
0250      {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},
0251      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0252     {{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},
0253      {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},
0254      {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},
0255      {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},
0256      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0257     {{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},
0258      {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},
0259      {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},
0260      {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},
0261      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0262     {{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},
0263      {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},
0264      {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},
0265      {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},
0266      {12, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}, {11, 0, 0}},
0267     {{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},
0268      {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},
0269      {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},
0270      {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},
0271      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0272     {{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},
0273      {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},
0274      {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},
0275      {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},
0276      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0277     {{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},
0278      {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},
0279      {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},
0280      {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},
0281      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0282     {{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},
0283      {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},
0284      {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},
0285      {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},
0286      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0287     {{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},
0288      {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},
0289      {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},
0290      {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},
0291      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0292     {{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},
0293      {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},
0294      {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},
0295      {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},
0296      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0297     {{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},
0298      {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},
0299      {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},
0300      {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},
0301      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0302     {{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},
0303      {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},
0304      {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},
0305      {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},
0306      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0307     {{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},
0308      {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},
0309      {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},
0310      {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},
0311      {9, 0, 0},  {10, 0, 0}, {10, 0, 0}, {10, 0, 0}, {10, 0, 0}},
0312     {{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},
0313      {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},
0314      {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},
0315      {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},
0316      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}}};
0317 const int iyy[18][41][3] = {
0318     {{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},
0319      {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},
0320      {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},
0321      {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},
0322      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0323     {{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},
0324      {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},
0325      {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},
0326      {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},
0327      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0328     {{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},
0329      {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},
0330      {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},
0331      {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},
0332      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0333     {{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},
0334      {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},
0335      {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},
0336      {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},
0337      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0338     {{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},
0339      {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},
0340      {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},
0341      {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},
0342      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0343     {{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},
0344      {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},
0345      {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},
0346      {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},
0347      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0348     {{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},
0349      {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},
0350      {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},
0351      {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},
0352      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0353     {{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},
0354      {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},
0355      {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},
0356      {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},
0357      {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}},
0358     {{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},
0359      {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},
0360      {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},
0361      {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},
0362      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0363     {{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},
0364      {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},
0365      {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},
0366      {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},
0367      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0368     {{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},
0369      {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},
0370      {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},
0371      {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},
0372      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0373     {{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},
0374      {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},
0375      {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},
0376      {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},
0377      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0378     {{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},
0379      {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},
0380      {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},
0381      {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},
0382      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0383     {{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},
0384      {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},
0385      {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},
0386      {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},
0387      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},   {0, 0, 0},  {0, 0, 0}},
0388     {{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},
0389      {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},
0390      {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},
0391      {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},
0392      {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0},  {0, 0, 0}},
0393     {{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},
0394      {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},
0395      {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},
0396      {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},
0397      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
0398     {{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},
0399      {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},
0400      {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},
0401      {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},
0402      {1, 0, 0}, {4, 0, 0}, {3, 0, 0}, {2, 0, 0}, {1, 0, 0}},
0403     {{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},
0404      {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},
0405      {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},
0406      {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},
0407      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}};
0408 
0409 popcon::EcalDAQHandler::EcalDAQHandler(const edm::ParameterSet& ps)
0410     : m_name(ps.getUntrackedParameter<std::string>("name", "EcalDAQHandler")) {
0411   std::cout << "EcalDAQ Source handler constructor\n" << std::endl;
0412   m_firstRun = (unsigned long)atoi(ps.getParameter<std::string>("firstRun").c_str());
0413   m_lastRun = (unsigned long)atoi(ps.getParameter<std::string>("lastRun").c_str());
0414   m_sid = ps.getParameter<std::string>("OnlineDBSID");
0415   m_user = ps.getParameter<std::string>("OnlineDBUser");
0416   m_pass = ps.getParameter<std::string>("OnlineDBPassword");
0417   m_location = ps.getParameter<std::string>("location");
0418   m_runtype = ps.getParameter<std::string>("runtype");
0419   m_gentag = ps.getParameter<std::string>("gentag");
0420   m_debug = ps.getParameter<bool>("debug");
0421 
0422   std::cout << m_sid << "/" << m_user << std::endl;
0423 }
0424 
0425 popcon::EcalDAQHandler::~EcalDAQHandler() {}
0426 
0427 uint16_t popcon::EcalDAQHandler::OffDBStatus(uint16_t dbStatus, int pos) {
0428   uint16_t hv_off_dbstatus = (dbStatus & (1 << pos));
0429   if (hv_off_dbstatus > 0)
0430     hv_off_dbstatus = 1;
0431   return hv_off_dbstatus;
0432 }
0433 
0434 void popcon::EcalDAQHandler::getNewObjects() {
0435   if (m_debug)
0436     std::cout << "------- Ecal DAQ - > getNewObjects\n";
0437 
0438   std::ostringstream ss;
0439   ss << "ECAL ";
0440 
0441   unsigned long long max_since = 1;
0442 
0443   // this is the last inserted run
0444   max_since = tagInfo().lastInterval.since;
0445 
0446   // this is the last object in the DB
0447   std::cout << " max_since : " << max_since << std::endl;
0448 
0449   uint16_t oldEBStatus[72][17][2];
0450   uint16_t newEBStatus[72][17][2];
0451   uint16_t oldEEStatus[20][20][2];
0452   uint16_t newEEStatus[20][20][2];
0453 
0454   // we copy the last valid record to a temporary object peds
0455   EcalDAQTowerStatus* daq_temp = new EcalDAQTowerStatus();
0456 
0457   if (tagInfo().size) {
0458     Ref daq_db = lastPayload();
0459     if (m_debug)
0460       std::cout << "retrieved last payload " << std::endl;
0461 
0462     // barrel
0463     int iz = -1;
0464     for (int k = 0; k < 2; k++) {
0465       if (k == 1)
0466         iz = 1;
0467       for (int iphi = 1; iphi < 73; iphi++) {
0468         for (int ieta = 1; ieta < 18; ieta++) {
0469           if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
0470             EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
0471 
0472             uint16_t dbStatus = 0;
0473             dbStatus = (daq_db->barrel(ebid.hashedIndex())).getStatusCode();
0474             oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
0475 
0476             EcalDAQTowerStatus::const_iterator it = daq_db->find(ebid.rawId());
0477             if (it != daq_db->end()) {
0478             } else {
0479               std::cout << "*** error channel not found: eta/phi =" << ieta << "/" << iphi << std::endl;
0480             }
0481             daq_temp->setValue(ebid, dbStatus);
0482             if (m_debug && dbStatus != 0)
0483               std::cout << "barrel side " << k << " phi " << iphi << " eta " << ieta << " status " << dbStatus
0484                         << std::endl;
0485           }
0486         }  // end loop over ieta
0487       }    // end loop over iphi
0488 
0489       // endcap
0490       for (int ix = 1; ix < 21; ix++) {
0491         for (int iy = 1; iy < 21; iy++) {
0492           if (EcalScDetId::validDetId(ix, iy, iz)) {
0493             EcalScDetId eeid(ix, iy, iz);
0494 
0495             EcalDAQTowerStatus::const_iterator it = daq_db->find(eeid.rawId());
0496 
0497             uint16_t dbStatus = 0;
0498             if (it != daq_db->end()) {
0499               dbStatus = it->getStatusCode();
0500             }
0501             oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
0502             daq_temp->setValue(eeid, dbStatus);
0503             if (m_debug && dbStatus != 0)
0504               std::cout << "endcap side " << k << " x " << ix << " y " << iy << " status " << dbStatus << std::endl;
0505           }
0506         }  // end loop over iy
0507       }    // end loop over ix
0508     }      // end loop over k (side)
0509   }        // check if there is already a payload
0510   else {
0511     if (m_debug)
0512       std::cout << " No db found : set default values " << std::endl;
0513     // barrel
0514     int iz = -1;
0515     for (int k = 0; k < 2; k++) {
0516       if (k == 1)
0517         iz = 1;
0518       for (int iphi = 1; iphi < 73; iphi++) {
0519         for (int ieta = 1; ieta < 18; ieta++) {
0520           if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
0521             EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
0522 
0523             uint16_t dbStatus = 0;
0524             oldEBStatus[iphi - 1][ieta - 1][k] = dbStatus;
0525             daq_temp->setValue(ebid, dbStatus);
0526           }  // valid Id
0527         }    // end loop over ieta
0528       }      // end loop over iphi
0529       // endcap
0530       for (int ix = 1; ix < 21; ix++) {
0531         for (int iy = 1; iy < 21; iy++) {
0532           if (EcalScDetId::validDetId(ix, iy, iz)) {
0533             EcalScDetId eeid(ix, iy, iz);
0534             uint16_t dbStatus = 0;
0535             oldEEStatus[ix - 1][iy - 1][k] = dbStatus;
0536             daq_temp->setValue(eeid, dbStatus);
0537           }  // valid Id
0538         }    // end loop over iy
0539       }      // end loop over ix
0540     }        // end loop over k (side)
0541   }          //  no payload set default values
0542 
0543   // now read the actual status from the online DB
0544 
0545   if (m_debug)
0546     std::cout << "Retrieving DAQ status from OMDS DB ... " << std::endl;
0547   econn = new EcalCondDBInterface(m_sid, m_user, m_pass);
0548   if (m_debug)
0549     std::cout << "Connection done" << std::endl;
0550 
0551   if (!econn) {
0552     std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
0553     throw cms::Exception("OMDS not available");
0554   }
0555 
0556   // code from EcalTPGBadTTHandler.cc
0557   LocationDef my_locdef;
0558   my_locdef.setLocation(m_location);
0559 
0560   RunTypeDef my_rundef;
0561   my_rundef.setRunType(m_runtype);
0562 
0563   RunTag my_runtag;
0564   my_runtag.setLocationDef(my_locdef);
0565   my_runtag.setRunTypeDef(my_rundef);
0566   my_runtag.setGeneralTag(m_gentag);
0567 
0568   // range of validity
0569   int min_run = 0;
0570   if (m_firstRun < (unsigned long)max_since) {
0571     min_run = (int)max_since + 1;  // we have to add 1 to the last transferred one
0572   } else {
0573     min_run = (int)m_firstRun;
0574   }
0575   int max_run = (int)m_lastRun;
0576   std::cout << "min_run " << min_run << " max_run " << max_run << std::endl;
0577 
0578   RunList my_list;
0579   my_list = econn->fetchRunListByLocation(my_runtag, min_run, max_run, my_locdef);
0580 
0581   std::vector<RunIOV> run_vec = my_list.getRuns();
0582   int num_runs = run_vec.size();
0583 
0584   std::cout << " number of runs is : " << num_runs << std::endl;
0585 
0586   unsigned long irun = 0;
0587   if (num_runs > 0) {
0588     //    char outfile[800];
0589     //sprintf(outfile,"BadChannelsEB_run%d.txt",min_run);
0590     //ofstream *daqFile;
0591     //daqFile = new ofstream(outfile,ios::out);
0592 
0593     //hlt    for(int kr = 0; kr < num_runs; kr++){
0594     for (int kr = num_runs - 1; kr < num_runs; kr++) {
0595       //    int krmax = std::min(num_runs, 1000);
0596       //    for(int kr = 0; kr < krmax; kr++){
0597       //hlt    if(m_to_transfer.size() < 20 ) {
0598 
0599       if (run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL")
0600         continue;
0601       bool somediff = false;
0602       // initialize this run status to all OK
0603       irun = (unsigned long)run_vec[kr].getRunNumber();
0604       for (int k = 0; k < 2; k++) {
0605         for (int iphi = 0; iphi < 72; iphi++) {
0606           for (int ieta = 0; ieta < 17; ieta++) {
0607             newEBStatus[iphi][ieta][k] = 0;
0608           }
0609         }
0610         for (int ix = 0; ix < 20; ix++) {
0611           for (int iy = 0; iy < 20; iy++) {
0612             newEEStatus[ix][iy][k] = 0;
0613           }
0614         }
0615       }  // loop over side
0616 
0617       // these are the online conditions DB classes        readout FEDs
0618       std::map<EcalLogicID, RunDat> fed_dat;
0619       econn->fetchDataSet(&fed_dat, &run_vec[kr]);
0620 
0621       // these are the online conditions DB classes        unread FEs
0622       typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
0623       //      EcalLogicID ecid_xt;
0624       RunDat rdat_fe;
0625       EcalLogicID idfed;
0626 
0627       std::map<EcalLogicID, RunFEConfigDat> feconfig;
0628       econn->fetchDataSet(&feconfig, &run_vec[kr]);
0629 
0630       if (fed_dat.empty() || feconfig.empty()) {
0631         std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag() << " Run type "
0632                   << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
0633                   << " feconfig and/or read FED size = 0, leaving..." << std::endl;
0634         continue;
0635       }
0636 
0637       if (fed_dat.size() != 54) {
0638         int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0639                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
0640         int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}};
0641         for (fedIter p = fed_dat.begin(); p != fed_dat.end(); p++) {
0642           idfed = p->first;
0643           int sm = 0;
0644           int z = 0;
0645           if (idfed.getLogicID() < 2000000000) {  // eb
0646             sm = idfed.getID1();
0647             //      std::cout << " EB " << sm;
0648             SM[sm - 1] = 1;
0649           } else {  // ee
0650             z = idfed.getID1();
0651             sm = idfed.getID2();
0652             //      std::cout << " EE " << z << " " << sm;
0653             int izz = z;
0654             if (z == -1)
0655               izz = 0;
0656             Sect[izz][sm - 1] = 1;
0657           }
0658         }  // loop over all FED
0659         //////////////////////////  test ////// do not keep
0660         /*  if(irun == 124089) {
0661       Sect[0][2] = 0;
0662       Sect[1][7] = 0;
0663       } */
0664         //////////////////////////  test ////// do not keep
0665         // mark all TT/SC in the not read out FEDs
0666         for (int sm = 0; sm < 36; sm++)  // barrel
0667           if (SM[sm] != 1) {
0668             //std::cout << " missing EB " << sm + 1 << std::endl;
0669             if (sm < 18)
0670               for (int tt = 0; tt < 68; tt++)
0671                 newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
0672             else
0673               for (int tt = 0; tt < 68; tt++)
0674                 newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
0675           }
0676         for (int z = 0; z < 2; z++)  // endcaps
0677           for (int sec = 0; sec < 9; sec++)
0678             if (Sect[z][sec] != 1) {
0679               //std::cout << " missing EE " << z << " " << sec + 1 << std::endl;
0680               int sec18 = sec;
0681               if (z == 1)
0682                 sec18 = sec + 9;
0683               for (int sc = 0; sc < 41; sc++) {
0684                 if (ixx[sec18][sc][0] != 0) {
0685                   newEEStatus[ixx[sec18][sc][0] - 1][iyy[sec18][sc][0] - 1][z] = 1;
0686                   if (ixx[sec18][sc][1] != 0) {
0687                     newEEStatus[ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][z] = 1;
0688                     if (ixx[sec18][sc][2] != 0) {
0689                       newEEStatus[ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][z] = 1;
0690                     }
0691                   }
0692                 }
0693               }  // loop over all possible SC in a sector
0694             }    // not read out sector
0695       }          // not all FED are read out
0696 
0697       typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
0698       //      EcalLogicID ecid_xt;
0699       RunFEConfigDat rd_fe;
0700 
0701       int fe_conf_id = 0;
0702       for (feConfIter p = feconfig.begin(); p != feconfig.end(); p++) {
0703         //  ecid_xt = p->first;
0704         rd_fe = p->second;
0705         fe_conf_id = rd_fe.getConfigId();
0706       }
0707 
0708       // reading this configuration
0709       ODFEDAQConfig myconfig;
0710       myconfig.setId(fe_conf_id);
0711       econn->fetchConfigSet(&myconfig);
0712 
0713       // list of bad towers
0714       int myTT = myconfig.getBadTTId();
0715       ODBadTTInfo mybadTT;
0716       std::vector<ODBadTTDat> badTT_dat;
0717       unsigned NbadTT = 0;
0718 
0719       /*      if(myTT == 0) {
0720         std::cout << " myTT = 0" << std::endl;
0721         continue;
0722       }
0723       else {
0724       */
0725       if (myTT != 0) {
0726         mybadTT.setId(myTT);
0727         econn->fetchConfigSet(&mybadTT);
0728 
0729         econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
0730         NbadTT = badTT_dat.size();
0731       }
0732 
0733       /*      std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
0734        << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
0735        << " number of read FEDs " << fed_dat.size()
0736        << " number of bad FEs " << NbadTT
0737        << " fe_conf_id " << fe_conf_id << std::endl;
0738       */
0739 
0740       //      *daqFile  << " run " << irun << " bad TT number " << NbadTT << "\n" << "Towers : ";
0741       for (size_t iTT = 0; iTT < NbadTT; iTT++) {
0742         int fed_id = badTT_dat[iTT].getFedId();
0743         int tt_id = badTT_dat[iTT].getTTId();
0744         //  int SM = badTT_dat[iTT].getSMId();  // SM always 0!
0745         int side = 0;  // EB/EE-
0746         //*daqFile << fed_id << "/" << tt_id << " ";
0747         //  std::cout << fed_id << "/" << tt_id << "/" << SM << "/" ;
0748         // std::cout << fed_id << "/" << tt_id << "/";
0749         if (fed_id >= 610 && fed_id <= 645) {  // barrel
0750           if (tt_id > 68) {
0751             //std::cout << " Problem in Fed " << fed_id << " TT " << tt_id << " Give up " << std::endl;
0752             continue;
0753           }
0754           if (fed_id > 627)
0755             side = +1;  // EB+
0756           if (m_debug)
0757             std::cout << " phi " << iphiEB[fed_id - 610][tt_id - 1] << " eta " << ietaEB[fed_id - 610][tt_id - 1]
0758                       << " side " << side << std::endl;
0759           newEBStatus[iphiEB[fed_id - 610][tt_id - 1] - 1][ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
0760         } else if (fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) {  // endcap
0761           if (tt_id > 41) {
0762             //std::cout << " Problem in Fed " << fed_id << " SC " << tt_id << " Give up " << std::endl;
0763             continue;
0764           }
0765           if (fed_id < 610) {  // EE-
0766             if (m_debug)
0767               std::cout << " x " << ixx[fed_id - 601][tt_id - 1][0] << " y " << iyy[fed_id - 601][tt_id - 1][0];
0768             newEEStatus[ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
0769             if (ixx[fed_id - 601][tt_id - 1][1] != 0) {  // partial SC
0770               if (m_debug)
0771                 std::cout << " x2 " << ixx[fed_id - 601][tt_id - 1][1] << " y2 " << iyy[fed_id - 601][tt_id - 1][1];
0772               newEEStatus[ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
0773               if (ixx[fed_id - 601][tt_id - 1][2] != 0) {  // partial SC
0774                 if (m_debug)
0775                   std::cout << " x3 " << ixx[fed_id - 601][tt_id - 1][2] << " y3 " << iyy[fed_id - 601][tt_id - 1][2];
0776                 newEEStatus[ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
0777               }
0778             }
0779             if (m_debug)
0780               std::cout << " side " << side << std::endl;
0781           } else {  // EE+
0782             side = +1;
0783             if (m_debug)
0784               std::cout << " x " << ixx[fed_id - 637][tt_id - 1][0] << " y " << iyy[fed_id - 637][tt_id - 1][0];
0785             newEEStatus[ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
0786             if (ixx[fed_id - 637][tt_id - 1][1] != 0) {  // partial SC
0787               if (m_debug)
0788                 std::cout << " x2 " << ixx[fed_id - 637][tt_id - 1][1] << " y2 " << iyy[fed_id - 637][tt_id - 1][1];
0789               newEEStatus[ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
0790               if (ixx[fed_id - 637][tt_id - 1][2] != 0) {  // partial SC
0791                 if (m_debug)
0792                   std::cout << " x3 " << ixx[fed_id - 637][tt_id - 1][2] << " y3 " << iyy[fed_id - 637][tt_id - 1][2];
0793                 newEEStatus[ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
0794               }
0795             }
0796             if (m_debug)
0797               std::cout << " side " << side << std::endl;
0798           }
0799         } else {
0800           std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
0801           continue;
0802         }
0803       }  // end loop over iTT
0804       if (m_debug)
0805         std::cout << std::endl;
0806       //*daqFile  << std::endl;
0807       for (int k = 0; k < 2; k++) {
0808         int iz = -1;
0809         if (k == 1)
0810           iz = 1;
0811         if (m_debug)
0812           std::cout << " Side : " << k << " barrel " << std::endl;  // barrel
0813         for (int iphi = 0; iphi < 72; iphi++) {
0814           for (int ieta = 0; ieta < 17; ieta++) {
0815             if (newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
0816               somediff = true;
0817               EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
0818               daq_temp->setValue(ebid, newEBStatus[iphi][ieta][k]);
0819               if (m_debug)
0820                 std::cout << " change in EB side " << iz << " phi " << iphi + 1 << " eta " << ieta + 1 << std::endl;
0821             }  // new status
0822             if (m_debug)
0823               std::cout << newEBStatus[iphi][ieta][k] << " ";
0824             oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
0825           }
0826           if (m_debug)
0827             std::cout << std::endl;
0828         }
0829         if (m_debug)
0830           std::cout << " endcaps " << std::endl;  // endcap
0831         for (int iy = 0; iy < 20; iy++) {
0832           for (int ix = 0; ix < 20; ix++) {
0833             if (EcalScDetId::validDetId(ix + 1, iy + 1, iz)) {
0834               if (newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
0835                 somediff = true;
0836                 EcalScDetId eeid(ix + 1, iy + 1, iz);
0837                 daq_temp->setValue(eeid, newEEStatus[ix][iy][k]);
0838                 if (m_debug)
0839                   std::cout << " change in EE side " << iz << " x " << ix + 1 << " y " << iy + 1 << std::endl;
0840               }  // new status
0841               if (m_debug)
0842                 std::cout << newEEStatus[ix][iy][k] << " ";
0843               oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
0844             }  // valid SC
0845             else {
0846               if (m_debug)
0847                 std::cout << ". ";
0848             }
0849           }
0850           if (m_debug)
0851             std::cout << std::endl;
0852         }
0853       }  // loop over side
0854 
0855       if (somediff) {
0856         // we copy the last valid record to the object that is sent to the DB
0857         EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
0858 
0859         int iz = -1;
0860         for (int k = 0; k < 2; k++) {
0861           if (k == 1)
0862             iz = 1;
0863           for (int iphi = 1; iphi < 73; iphi++) {
0864             for (int ieta = 1; ieta < 18; ieta++) {
0865               if (EcalTrigTowerDetId::validDetId(iz, EcalBarrel, ieta, iphi)) {
0866                 EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta, iphi);
0867                 uint16_t dbStatus = 0;
0868                 dbStatus = (daq_temp->barrel(ebid.hashedIndex())).getStatusCode();
0869                 daq_pop->setValue(ebid, dbStatus);
0870               }
0871             }  // end loop over ieta
0872           }    // end loop over iphi
0873 
0874           // endcap
0875           for (int ix = 1; ix < 21; ix++) {
0876             for (int iy = 1; iy < 21; iy++) {
0877               if (EcalScDetId::validDetId(ix, iy, iz)) {
0878                 EcalScDetId eeid(ix, iy, iz);
0879 
0880                 EcalDAQTowerStatus::const_iterator it = daq_temp->find(eeid.rawId());
0881                 uint16_t dbStatus = 0;
0882                 if (it != daq_temp->end()) {
0883                   dbStatus = it->getStatusCode();
0884                 }
0885                 daq_pop->setValue(eeid, dbStatus);
0886               }
0887             }  // end loop over iy
0888           }    // end loop over ix
0889         }      // end loop over k (side)
0890 
0891         std::cout << "Generating popcon record for run " << irun << std::endl;
0892 
0893         m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
0894 
0895         ss << "Run=" << irun << "_DAQchanged_" << std::endl;
0896         m_userTextLog = ss.str() + ";";
0897       }  // some change found
0898       else {
0899         std::cout << "Run" << irun << " DAQ record was the same as previous run " << std::endl;
0900         ss << "Run=" << irun << "_DAQunchanged_" << std::endl;
0901         m_userTextLog = ss.str() + ";";
0902 
0903       }  // no change
0904 
0905       // hlt    } // check on number of already transferred runs
0906     }  // loop over runs
0907   }    // check on run number > 0
0908 
0909   // disconnect from DB
0910   delete econn;
0911   delete daq_temp;
0912   if (m_debug)
0913     std::cout << "Ecal - > end of getNewObjects -----------\n";
0914 }