00001
00002 #include "geometry/MicrorocChip.hh"
00003 #include "geometry/MicrorocChannel.hh"
00004
00005 #include <iostream>
00006 #include "tools/Log.hh"
00007 #include <Board.hh>
00008
00009 using namespace std;
00010
00011
00012
00013
00014
00015
00016 MicrorocChip::MicrorocChip(const Board& aBoard, const i32 aCol, const i32 aRow ,const i32 aId,const ui32 aSerialNumber)
00017 :Chip(aBoard, aCol, aRow, 8, 8, aId, aSerialNumber)
00018 {
00019 init();
00020 thresholdDac_0 = 0;
00021 thresholdDac_1 = 0;
00022 thresholdDac_2 = 0;
00023 bypassed = true;
00024
00025 };
00026
00027
00028 void MicrorocChip::init()
00029 {
00030
00031 for (int channelId = 0; channelId <= 63 ; channelId++) {
00032 int map = HRmap(channelId);
00033 MicrorocChannel *channel = new MicrorocChannel(*this, map/8, map%8, channelId);
00034 channels.insert(make_pair(channelId,channel));
00035 }
00036 };
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 int MicrorocChip::HRmap(int channel)
00056 {
00057
00058
00059 if(channel<0||channel>63)
00060 {
00061 FILE_LOG(logERROR)<<"map error channel="<<channel<<endl;return-1;
00062 }
00063
00064 const int map[64]=
00065 {7, 6, 5, 4, 3, 2, 1, 0,
00066 15, 14, 13, 12, 11, 10, 9 , 8,
00067 23, 22 ,21 ,20 ,19, 18, 17, 16,
00068 31, 30, 29, 28, 27, 26, 25, 24,
00069 39, 38, 37, 36, 35, 34, 33, 32,
00070 47, 46, 45, 44, 43, 42, 41, 40,
00071 55, 54, 53, 52, 51, 50, 49, 48,
00072 63, 62, 61, 60, 59, 58, 57, 56};
00073
00074 return map[channel];
00075
00076
00077
00078
00079 }