00001 #include "CondTools/Ecal/interface/EcalDAQHandler.h"
00002 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00003
00004
00005
00006 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00007
00008 #include<iostream>
00009
00010
00011
00012
00013
00014
00015 int iphiEB[36][68] = {
00016 {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,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},
00017 {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,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},
00018 {9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12,9,10,11,12},
00019 {13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16,13,14,15,16},
00020 {17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20,17,18,19,20},
00021 {21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24,21,22,23,24},
00022 {25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28,25,26,27,28},
00023 {29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32,29,30,31,32},
00024 {33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36,33,34,35,36},
00025 {37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40,37,38,39,40},
00026 {41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44,41,42,43,44},
00027 {45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48,45,46,47,48},
00028 {49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52,49,50,51,52},
00029 {53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56,53,54,55,56},
00030 {57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60,57,58,59,60},
00031 {61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64,61,62,63,64},
00032 {65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68},
00033 {69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72,69,70,71,72},
00034 {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,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},
00035 {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,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},
00036 {12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9,12,11,10,9},
00037 {16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13,16,15,14,13},
00038 {20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17,20,19,18,17},
00039 {24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21,24,23,22,21},
00040 {28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25,28,27,26,25},
00041 {32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29,32,31,30,29},
00042 {36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33,36,35,34,33},
00043 {40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37,40,39,38,37},
00044 {44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41,44,43,42,41},
00045 {48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45,48,47,46,45},
00046 {52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49,52,51,50,49},
00047 {56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53,56,55,54,53},
00048 {60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57,60,59,58,57},
00049 {64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61,64,63,62,61},
00050 {68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65,68,67,66,65},
00051 {72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69,72,71,70,69}
00052 };
00053 int ietaEB[36][68] = {
00054 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00055 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00056 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00057 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00058 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00059 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00060 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00061 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00062 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00063 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00064 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00065 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00066 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00067 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00068 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00069 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00070 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00071 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00072 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00073 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00074 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00075 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00076 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00077 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00078 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00079 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00080 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00081 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00082 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00083 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00084 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00085 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00086 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00087 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00088 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17},
00089 {1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17}
00090 };
00091 int ixx[18][41][3] = {
00092 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00093 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00094 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00095 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00096 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00097 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00098 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00099 {{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},{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},{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},{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},{12,0,0},{11,0,0},{11,0,0},{11,0,0},{11,0,0}},
00100 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00101 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00102 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00103 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00104 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00105 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00106 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00107 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00108 {{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},{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},{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},{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},{9,0,0},{10,0,0},{10,0,0},{10,0,0},{10,0,0}},
00109 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}
00110 };
00111 int iyy[18][41][3] = {
00112 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00113 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00114 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00115 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00116 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00117 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00118 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00119 {{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},{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},{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},{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},{1,0,0},{4,0,0},{3,0,0},{2,0,0},{1,0,0}},
00120 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00121 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00122 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00123 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00124 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00125 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00126 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00127 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
00128 {{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},{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},{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},{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},{1,0,0},{4,0,0},{3,0,0},{2,0,0},{1,0,0}},
00129 {{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},{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},{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},{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},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}
00130 };
00131
00132 popcon::EcalDAQHandler::EcalDAQHandler(const edm::ParameterSet & ps)
00133 : m_name(ps.getUntrackedParameter<std::string>("name","EcalDAQHandler")) {
00134
00135 std::cout << "EcalDAQ Source handler constructor\n" << std::endl;
00136 m_firstRun =(unsigned long)atoi( ps.getParameter<std::string>("firstRun").c_str());
00137 m_lastRun =(unsigned long)atoi( ps.getParameter<std::string>("lastRun").c_str());
00138 m_sid = ps.getParameter<std::string>("OnlineDBSID");
00139 m_user = ps.getParameter<std::string>("OnlineDBUser");
00140 m_pass = ps.getParameter<std::string>("OnlineDBPassword");
00141 m_location = ps.getParameter<std::string>("location");
00142 m_runtype = ps.getParameter<std::string>("runtype");
00143 m_gentag = ps.getParameter<std::string>("gentag");
00144
00145 std::cout << m_sid << "/" << m_user << std::endl;
00146
00147 }
00148
00149 popcon::EcalDAQHandler::~EcalDAQHandler() {
00150 }
00151
00152
00153 uint16_t popcon::EcalDAQHandler::OffDBStatus( uint16_t dbStatus , int pos ) {
00154 uint16_t hv_off_dbstatus = ( dbStatus & (1 << pos ) ) ;
00155 if(hv_off_dbstatus>0) hv_off_dbstatus=1;
00156 return hv_off_dbstatus;
00157 }
00158
00159
00160 void popcon::EcalDAQHandler::getNewObjects() {
00161
00162 std::cout << "------- Ecal DAQ - > getNewObjects\n";
00163
00164 std::ostringstream ss;
00165 ss<<"ECAL ";
00166
00167 unsigned long long max_since = 1;
00168
00169
00170 max_since = tagInfo().lastInterval.first;
00171
00172
00173 std::cout << " max_since : " << max_since << std::endl;
00174
00175
00176 Ref daq_db = lastPayload();
00177 std::cout << "retrieved last payload " << std::endl;
00178
00179
00180 EcalDAQTowerStatus* daq_temp = new EcalDAQTowerStatus();
00181
00182
00183 uint16_t oldEBStatus[72][17][2];
00184 uint16_t newEBStatus[72][17][2];
00185 uint16_t oldEEStatus[20][20][2];
00186 uint16_t newEEStatus[20][20][2];
00187 int iz = -1;
00188 for(int k = 0 ; k < 2; k++ ) {
00189 if(k == 1) iz = 1;
00190 for(int iphi = 1 ; iphi < 73; iphi++) {
00191 for(int ieta = 1 ; ieta < 18; ieta++) {
00192 if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
00193 EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
00194
00195 uint16_t dbStatus = 0;
00196 dbStatus =(daq_db->barrel( ebid.hashedIndex())).getStatusCode();
00197 oldEBStatus[iphi - 1][ieta -1][k] = dbStatus;
00198
00199 EcalDAQTowerStatus::const_iterator it =daq_db->find(ebid.rawId());
00200 if ( it != daq_db->end() ) {
00201 } else {
00202 std::cout<<"*** error channel not found: eta/phi ="<< ieta << "/" << iphi << std::endl;
00203 }
00204 daq_temp->setValue( ebid, dbStatus );
00205 if(dbStatus != 0) std::cout << "barrel side " << k << " phi " << iphi << " eta " << ieta << " status " << dbStatus << std::endl;
00206 }
00207 }
00208 }
00209
00210
00211 for(int ix = 1 ; ix < 21; ix++) {
00212 for(int iy = 1 ; iy < 21; iy++) {
00213 if (EcalScDetId::validDetId(ix,iy,iz )){
00214 EcalScDetId eeid(ix,iy,iz);
00215
00216 EcalDAQTowerStatus::const_iterator it =daq_db->find(eeid.rawId());
00217
00218 uint16_t dbStatus = 0;
00219 if ( it != daq_db->end() ) {
00220 dbStatus = it->getStatusCode();
00221 }
00222 oldEEStatus[ix - 1][iy -1][k] = dbStatus;
00223 daq_temp->setValue( eeid, dbStatus );
00224 if(dbStatus != 0) std::cout << "endcap side " << k << " x " << ix << " y " << iy << " status " << dbStatus << std::endl;
00225 }
00226 }
00227 }
00228 }
00229
00230
00231
00232
00233 std::cout << "Retrieving DAQ status from OMDS DB ... " << std::endl;
00234 econn = new EcalCondDBInterface( m_sid, m_user, m_pass );
00235 std::cout << "Connection done" << std::endl;
00236
00237 if (!econn) {
00238 std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
00239 throw cms::Exception("OMDS not available");
00240 }
00241
00242
00243 LocationDef my_locdef;
00244 my_locdef.setLocation(m_location);
00245
00246 RunTypeDef my_rundef;
00247 my_rundef.setRunType(m_runtype);
00248
00249 RunTag my_runtag;
00250 my_runtag.setLocationDef( my_locdef );
00251 my_runtag.setRunTypeDef( my_rundef );
00252 my_runtag.setGeneralTag(m_gentag);
00253
00254
00255 int min_run = 0;
00256 if(m_firstRun < (unsigned long)max_since) {
00257 min_run= (int)max_since+1;
00258 }
00259 else { min_run=(int)m_firstRun; }
00260 int max_run=(int)m_lastRun;
00261 std::cout << "min_run " << min_run << " max_run " << max_run << std::endl;
00262
00263 RunList my_list;
00264 my_list = econn->fetchRunListByLocation(my_runtag, min_run, max_run, my_locdef);
00265
00266 std::vector<RunIOV> run_vec = my_list.getRuns();
00267 int num_runs = run_vec.size();
00268
00269 std::cout << " number of runs is : " << num_runs << std::endl;
00270
00271 unsigned long irun=0;
00272 if(num_runs > 0){
00273
00274
00275
00276
00277
00278 bool debug = false;
00279
00280 int krmax = std::min(num_runs, 1000);
00281 for(int kr = 0; kr < krmax; kr++){
00282 if(m_to_transfer.size() < 20 ) {
00283
00284 if(run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL") continue;
00285 bool somediff = false;
00286
00287 if(kr == 0) debug = true;
00288 else debug = false;
00289 irun = (unsigned long) run_vec[kr].getRunNumber();
00290 for(int k = 0 ; k < 2; k++ ) {
00291 for(int iphi = 0 ; iphi < 72; iphi++) {
00292 for(int ieta = 0 ; ieta < 17; ieta++) {
00293 newEBStatus[iphi][ieta][k] = 0;
00294 }
00295 }
00296 for(int ix = 0 ; ix < 20; ix++) {
00297 for(int iy = 0 ; iy < 20; iy++) {
00298 newEEStatus[ix][iy][k] = 0;
00299 }
00300 }
00301 }
00302
00303
00304
00305
00306 std::map<EcalLogicID, RunDat> fed_dat;
00307 econn->fetchDataSet(&fed_dat, &run_vec[kr]);
00308
00309
00310 typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
00311
00312 RunDat rdat_fe;
00313 EcalLogicID idfed;
00314
00315 std::map<EcalLogicID, RunFEConfigDat> feconfig;
00316 econn->fetchDataSet(&feconfig, &run_vec[kr]);
00317
00318 if(fed_dat.size() == 0 || feconfig.size() == 0) {
00319 std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
00320 << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
00321 << " feconfig and/or read FED size = 0, leaving..." << std::endl;
00322 continue;
00323 }
00324
00325
00326 if(fed_dat.size() != 54 ) {
00327
00328 int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
00330 int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};
00331 for (fedIter p=fed_dat.begin(); p!=fed_dat.end(); p++) {
00332 idfed = p->first;
00333 int sm = 0;
00334 int z = 0;
00335 if(idfed.getLogicID()<2000000000){
00336 sm = idfed.getID1();
00337
00338 SM[sm - 1] = 1;
00339 }
00340 else {
00341 z = idfed.getID1();
00342 sm = idfed.getID2();
00343
00344 int izz = z;
00345 if(z == -1) izz = 0;
00346 Sect[izz][sm - 1] = 1;
00347 }
00348 }
00350
00351
00352
00353
00355
00356 for(int sm = 0; sm < 36; sm++)
00357 if(SM[sm] != 1) {
00358
00359 if(sm < 18)
00360 for(int tt = 0; tt < 68; tt++)
00361 newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
00362 else
00363 for(int tt = 0; tt < 68; tt++)
00364 newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
00365 }
00366 for(int z = 0; z < 2; z++)
00367 for(int sec = 0; sec < 9; sec++)
00368 if(Sect[z][sec] != 1) {
00369
00370 int sec18 = sec;
00371 if(z == 1) sec18 = sec + 9;
00372 for(int sc = 0 ; sc < 41; sc++) {
00373 if(ixx[sec18][sc][0] != 0) {
00374 newEEStatus[ixx[sec18][sc][0] - 1][iyy[sec18][sc][0] - 1][z] = 1;
00375 if(ixx[sec18][sc][1] != 0) {
00376 newEEStatus[ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][z] = 1;
00377 if(ixx[sec18][sc][2] != 0) {
00378 newEEStatus[ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][z] = 1;
00379 }
00380 }
00381 }
00382 }
00383 }
00384 }
00385
00386 typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
00387
00388 RunFEConfigDat rd_fe;
00389
00390 int fe_conf_id = 0;
00391 for (feConfIter p=feconfig.begin(); p!=feconfig.end(); p++) {
00392
00393 rd_fe = p->second;
00394 fe_conf_id = rd_fe.getConfigId();
00395 }
00396
00397
00398 ODFEDAQConfig myconfig;
00399 myconfig.setId(fe_conf_id);
00400 econn->fetchConfigSet(&myconfig);
00401
00402
00403 int myTT = myconfig.getBadTTId();
00404 ODBadTTInfo mybadTT;
00405 std::vector< ODBadTTDat > badTT_dat;
00406 unsigned NbadTT = 0;
00407
00408
00409
00410
00411
00412
00413
00414 if(myTT != 0) {
00415 mybadTT.setId(myTT);
00416 econn->fetchConfigSet(&mybadTT);
00417
00418 econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
00419 NbadTT = badTT_dat.size();
00420 }
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 for(size_t iTT = 0; iTT < NbadTT; iTT++){
00431 int fed_id = badTT_dat[iTT].getFedId();
00432 int tt_id = badTT_dat[iTT].getTTId();
00433
00434 int side = 0;
00435
00436
00437
00438 if(fed_id >= 610 && fed_id <= 645) {
00439 if(tt_id > 68) {
00440
00441 continue;
00442 }
00443 if(fed_id > 627) side = +1;
00444 if(debug) std::cout << " phi " << iphiEB[fed_id - 610][tt_id - 1]
00445 << " eta " << ietaEB[fed_id - 610][tt_id - 1]
00446 << " side " << side << std::endl;
00447 newEBStatus[iphiEB[fed_id - 610][tt_id - 1] - 1][ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
00448 }
00449 else if(fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) {
00450 if(tt_id > 41) {
00451
00452 continue;
00453 }
00454 if(fed_id < 610) {
00455 if(debug) std::cout << " x " << ixx[fed_id - 601][tt_id - 1][0]
00456 << " y " << iyy[fed_id - 601][tt_id - 1][0];
00457 newEEStatus[ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
00458 if(ixx[fed_id - 601][tt_id - 1][1] != 0) {
00459 if(debug) std::cout << " x2 " << ixx[fed_id - 601][tt_id - 1][1]
00460 << " y2 " << iyy[fed_id - 601][tt_id - 1][1];
00461 newEEStatus[ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
00462 if(ixx[fed_id - 601][tt_id - 1][2] != 0) {
00463 if(debug) std::cout << " x3 " << ixx[fed_id - 601][tt_id - 1][2]
00464 << " y3 " << iyy[fed_id - 601][tt_id - 1][2];
00465 newEEStatus[ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
00466 }
00467 }
00468 if(debug) std::cout << " side " << side << std::endl;
00469 }
00470 else {
00471 side = +1;
00472 if(debug) std::cout << " x " << ixx[fed_id - 637][tt_id - 1][0]
00473 << " y " << iyy[fed_id - 637][tt_id - 1][0];
00474 newEEStatus[ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
00475 if(ixx[fed_id - 637][tt_id - 1][1] != 0) {
00476 if(debug) std::cout << " x2 " << ixx[fed_id - 637][tt_id - 1][1]
00477 << " y2 " << iyy[fed_id - 637][tt_id - 1][1];
00478 newEEStatus[ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
00479 if(ixx[fed_id - 637][tt_id - 1][2] != 0) {
00480 if(debug) std::cout << " x3 " << ixx[fed_id - 637][tt_id - 1][2]
00481 << " y3 " << iyy[fed_id - 637][tt_id - 1][2];
00482 newEEStatus[ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
00483 }
00484 }
00485 if(debug) std::cout << " side " << side << std::endl;
00486 }
00487 }
00488 else {
00489 std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
00490 continue;
00491 }
00492 }
00493 if(debug) std::cout << std::endl;
00494
00495 for(int k = 0 ; k < 2; k++ ) {
00496 int iz = -1;
00497 if(k == 1) iz = 1;
00498 if(debug) std::cout << " Side : " << k << " barrel " << std::endl;
00499 for(int iphi = 0 ; iphi < 72; iphi++) {
00500 for(int ieta = 0 ; ieta < 17; ieta++) {
00501 if(newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
00502 somediff = true;
00503 EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
00504 daq_temp->setValue( ebid, newEBStatus[iphi][ieta][k]);
00505 if(debug) std::cout << " change in EB side " << iz << " phi " << iphi +1 << " eta " << ieta + 1 << std::endl;
00506 }
00507 if(debug) std::cout << newEBStatus[iphi][ieta][k] << " " ;
00508 oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
00509 }
00510 if(debug) std::cout << std::endl;
00511 }
00512 if(debug) std::cout << " endcaps " << std::endl;
00513 for(int iy = 0 ; iy < 20; iy++) {
00514 for(int ix = 0 ; ix < 20; ix++) {
00515 if (EcalScDetId::validDetId(ix + 1, iy + 1, iz )){
00516 if(newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
00517 somediff = true;
00518 EcalScDetId eeid(ix + 1, iy + 1, iz);
00519 daq_temp->setValue( eeid, newEEStatus[ix][iy][k]);
00520 if(debug) std::cout << " change in EE side " << iz << " x " << ix +1 << " y " << iy + 1 << std::endl;
00521 }
00522 if(debug) std::cout << newEEStatus[ix][iy][k] << " " ;
00523 oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
00524 }
00525 else {
00526 if(debug) std::cout << ". ";
00527 }
00528 }
00529 if(debug) std::cout << std::endl;
00530 }
00531 }
00532
00533 if(somediff) {
00534
00535
00536 EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
00537
00538
00539
00540 int iz = -1;
00541 for(int k = 0 ; k < 2; k++ ) {
00542 if(k == 1) iz = 1;
00543 for(int iphi = 1 ; iphi < 73; iphi++) {
00544 for(int ieta = 1 ; ieta < 18; ieta++) {
00545 if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
00546 EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
00547 uint16_t dbStatus = 0;
00548 dbStatus =(daq_temp->barrel( ebid.hashedIndex())).getStatusCode();
00549 daq_pop->setValue( ebid, dbStatus );
00550 }
00551 }
00552 }
00553
00554
00555 for(int ix = 1 ; ix < 21; ix++) {
00556 for(int iy = 1 ; iy < 21; iy++) {
00557 if (EcalScDetId::validDetId(ix,iy,iz )){
00558 EcalScDetId eeid(ix,iy,iz);
00559
00560 EcalDAQTowerStatus::const_iterator it =daq_temp->find(eeid.rawId());
00561 uint16_t dbStatus = 0;
00562 if ( it != daq_temp->end() ) {
00563 dbStatus = it->getStatusCode();
00564 }
00565 daq_pop->setValue( eeid, dbStatus );
00566 }
00567 }
00568 }
00569 }
00570
00571
00572
00573 std::cout << "Generating popcon record for run "<< irun << std::endl;
00574
00575 m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
00576
00577 ss << "Run=" << irun << "_DAQchanged_"<<std::endl;
00578 m_userTextLog = ss.str()+";";
00579 }
00580 else {
00581
00582 std::cout<< "Run DAQ record was the same as previous run " << std::endl;
00583 ss << "Run=" << irun << "_DAQunchanged_"<<std::endl;
00584 m_userTextLog = ss.str()+";";
00585
00586 }
00587
00588 }
00589 }
00590 }
00591
00592
00593 delete econn;
00594 delete daq_temp;
00595 std::cout << "Ecal - > end of getNewObjects -----------\n";
00596 }