/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/geometry/GassiplexBoardBeta24.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1328 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-03 17:04:17 +0200 (Mon, 03 Oct 2011) $ */
00002 
00003 #include "geometry/GassiplexBoardBeta24.hh"
00004 #include "geometry/GassiplexChip.hh"
00005 #include "geometry/GassiplexChannel.hh"
00006 #include <iostream>
00007 #include "tools/Log.hh"
00008 
00009 #define NBCHANNEL 96
00010 
00011 using namespace std;
00012 
00013 //--------------------------//
00014 // mapping between a channel number (0 - n-1) and the physical channel map
00015       // -- see cleverer code below which gives the same result
00016 static int chMap(int boardId, const int chNum) {
00017   static const int g4map[4][96] = {
00018 
00019 
00020     /* board 1    channel   0- 95              */
00021     /*             0    1    2    3    4    5  */
00022     /*  0 */ {    0,  31,   1,  30,   2,  29 ,
00023     /*  1 */      3,  28,   4,  27,   5,  26 ,
00024     /*  2 */      6,  25,   7,  24,   8,  23 ,
00025     /*  3 */      9,  22,  10,  21,  11,  20 ,
00026     /*  4 */     12,  19,  13,  18,  14,  17 ,
00027     /*  5 */     15,  16,  32,  63,  33,  62 ,
00028     /*  6 */     34,  61,  35,  60,  36,  59 ,
00029     /*  7 */     37,  58,  38,  57,  39,  56 ,
00030     /*  8 */     40,  55,  41,  54,  42,  53 ,
00031     /*  9 */     43,  52,  44,  51,  45,  50 ,
00032     /* 10 */     46,  49,  47,  48,  64,  95 ,
00033     /* 11 */     65,  94,  66,  93,  67,  92 ,
00034     /* 12 */     68,  91,  69,  90,  70,  89 ,
00035     /* 13 */     71,  88,  72,  87,  73,  86 ,
00036     /* 14 */     74,  85,  75,  84,  76,  83 ,
00037     /* 15 */     77,  82,  78,  81,  79,  80  },
00038     /* board 2    channel   96-191             */
00039     /*             0    1    2    3    4    5  */
00040     /*  0 */ {    96, 127,  97, 126,  98, 125 ,
00041     /*  1 */     99, 124, 100, 123, 101, 122 ,
00042     /*  2 */    102, 121, 103, 120, 104, 119 ,
00043     /*  3 */    105, 118, 106, 117, 107, 116 ,
00044     /*  4 */    108, 115, 109, 114, 110, 113 ,
00045     /*  5 */    111, 112, 128, 159, 129, 158 ,
00046     /*  6 */    130, 157, 131, 156, 132, 155 ,
00047     /*  7 */    133, 154, 134, 153, 135, 152 ,
00048     /*  8 */    136, 151, 137, 150, 138, 149 ,
00049     /*  9 */    139, 148, 140, 147, 141, 146 ,
00050     /* 10 */    142, 145, 143, 144, 160, 191 ,
00051     /* 11 */    161, 190, 162, 189, 163, 188 ,
00052     /* 12 */    164, 187, 165, 186, 166, 185 ,
00053     /* 13 */    167, 184, 168, 183, 169, 182 ,
00054     /* 14 */    170, 181, 171, 180, 172, 179 ,
00055     /* 15 */    173, 178, 174, 177, 175, 176  },
00056     /* board 3    channel 192-287              */
00057     /*             0    1    2    3    4    5  */
00058     /*  0 */ {  272, 271, 273, 270, 274, 269 ,
00059     /*  1 */    275, 268, 276, 267, 277, 266 ,
00060     /*  2 */    278, 265, 279, 264, 280, 263 ,
00061     /*  3 */    281, 262, 282, 261, 283, 260 ,
00062     /*  4 */    284, 259, 285, 258, 286, 257 ,
00063     /*  5 */    287, 256, 240, 239, 241, 238 ,
00064     /*  6 */    242, 237, 243, 236, 244, 235 ,
00065     /*  7 */    245, 234, 246, 233, 247, 232 ,
00066     /*  8 */    248, 231, 249, 230, 250, 229 ,
00067     /*  9 */    251, 228, 252, 227, 253, 226 ,
00068     /* 10 */    254, 225, 255, 224, 208, 207 ,
00069     /* 11 */    209, 206, 210, 205, 211, 204 ,
00070     /* 12 */    212, 203, 213, 202, 214, 201 ,
00071     /* 13 */    215, 200, 216, 199, 217, 198 ,
00072     /* 14 */    218, 197, 219, 196, 220, 195 ,
00073     /* 15 */    221, 194, 222, 193, 223, 192  },
00074     /* board 4    channel 288-383              */
00075     /*             0    1    2    3    4    5  */
00076     /*  0 */ {  368, 367, 369, 366, 370, 365 ,
00077     /*  1 */    371, 364, 372, 363, 373, 362 ,
00078     /*  2 */    374, 361, 375, 360, 376, 359 ,
00079     /*  3 */    377, 358, 378, 357, 379, 356 ,
00080     /*  4 */    380, 355, 381, 354, 382, 353 ,
00081     /*  5 */    383, 352, 336, 335, 337, 334 ,
00082     /*  6 */    338, 333, 339, 332, 340, 331 ,
00083     /*  7 */    341, 330, 342, 329, 343, 328 ,
00084     /*  8 */    344, 327, 345, 326, 346, 325 ,
00085     /*  9 */    347, 324, 348, 323, 349, 322 ,
00086     /* 10 */    350, 321, 351, 320, 304, 303 ,
00087     /* 11 */    305, 302, 306, 301, 307, 300 ,
00088     /* 12 */    308, 299, 309, 298, 310, 297 ,
00089     /* 13 */    311, 296, 312, 295, 313, 294 ,
00090     /* 14 */    314, 293, 315, 292, 316, 291 ,
00091     /* 15 */    317, 290, 318, 289, 319, 288  }
00092   };
00093 
00094   for ( int i = 0 ; i < 96  ; i++)
00095   {
00096       if ( g4map[boardId-1][i] == chNum)
00097       {
00098           return i;
00099       }
00100   }
00101  // return (g4map[boardId - 1][(chNum / 6) % 16][chNum % 6]);
00102 }
00103 //--------------------------//
00104 // old mapping between a channel number (0 - n-1) and the physical channel map
00105 /*
00106 int beta24chMap(int boardId, const int chNum) {
00107   --boardId;
00108   int mod = (chNum % 16) * 2;
00109   int res = (((chNum & 16) == 0) ? mod : 15 - mod) + ((chNum % 96) / 16) * 16;
00110 
00111   if ((boardId % 4) < 2)
00112     res += boardId * 96;
00113   else
00114     res = (95 - res) + boardId * 96;
00115   return(res);
00116 }
00117 */
00118 //--------------------------//
00119 GassiplexBoardBeta24::GassiplexBoardBeta24(const Chamber& aChamber, const i32 aCol, const i32 aRow, const ui32 nbColumns, const ui32 nbRows,const i32 aId)
00120       : Board(aChamber,  aCol, aRow, nbColumns, nbRows,  aId)
00121 {
00122   //FILE_LOG(logDEBUG) << "GassiplexBoardBeta24 constructor" << endl;
00123   init();
00124 };
00125 
00126 //--------------------------//
00127 GassiplexBoardBeta24::~GassiplexBoardBeta24()
00128 {
00129   //FILE_LOG(logDEBUG) << "GassiplexBoardBeta24 destructor" << endl;
00130 };
00131 
00132 //--------------------------//
00133 void GassiplexBoardBeta24::init()
00134 {
00135   // Le mapping est different entre BETA 2.1 et BETA 2.4
00136     for (int chipNum = 0; chipNum < NBCHANNEL; chipNum++)
00137     {
00138         int chipMap = chMap(id, chipNum+ 96 * (id-1));
00139 
00140         int col, row = 0;
00141         if ( id == 1 || id == 2)
00142         {
00143             row = chipMap % 6;
00144             col = chipMap / 6 ;
00145         }
00146         else if ( id == 3 || id == 4)
00147         {
00148             row =  chipMap % 6 ;
00149             col =  chipMap / 6 ;
00150         }
00151         //int x = col * getXGap() + col * GassiplexChip::length();
00152         //int y = row * getYGap() + row * GassiplexChip::width();
00153         i32 chipId =  chipNum + (id-1) * NBCHANNEL;
00154         //                      cout << "Add GassiplexChip id[" << chipId << "], col [" << col << "] row[" << row << "]" << endl;
00155 
00156         Chip *chip = new GassiplexChip(*this, col, row, 1, 1 ,  chipId, 0); // only 1 row and 1 column for gassiplex Chip ( wich contains only one channel )
00157 
00158         chips.insert(make_pair(chipId, chip));
00159     }
00160 }
00161 
00162 
00163 

Generated on Mon Jan 7 13:15:22 2013 for MicromegasFramework by  doxygen 1.4.7