00001
00002 #include "root/MTChip.hh"
00003 #include "tools/MicroException.hh"
00004
00005 #include <iostream>
00006 #include <time.h>
00007
00008 #include "geometry/Chip.hh"
00009 #include "geometry/Board.hh"
00010 #include "geometry/Dif.hh"
00011 #include "geometry/Chamber.hh"
00012 #include "geometry/Channel.hh"
00013 #include "geometry/MicrorocChannel.hh"
00014
00015 #include "tools/Log.hh"
00016 #include "tools/Toolbox.hh"
00017
00018 using namespace std;
00019
00020 ClassImp(MTChip)
00021
00022 MTChip::MTChip(UInt_t _id )
00023 {
00024
00025 serialNum = 0;
00026 id = _id;
00027 gain = 0;
00028 configured = false;
00029 bypassed = false;
00030 }
00031
00032 MTChip::MTChip(const Chip& aChip)
00033 {
00034 (*this) = aChip;
00035 }
00036
00037
00038
00039 MTChip::~MTChip()
00040 {
00041
00042 }
00043
00044 MTChip& MTChip::operator=(const Chip& aChip)
00045 {
00046 const Board& board = aChip.getBoard() ;
00047 const Dif* dif = board.getDif();
00048 unsigned int difId = 0;
00049 if ( dif != NULL) difId = dif->getId();
00050 const Chamber& cham = board.getChamber();
00051
00052 softId.SetValue(cham.getId(), difId, aChip.getBoard().getId(),aChip.getBoard().getRow(),aChip.getBoard().getColumn(), aChip.getBoard().getNbRows(), aChip.getBoard().getNbColumns(), aChip.getId(), aChip.getRow(), aChip.getNbRows(), aChip.getNbColumns(), aChip.getColumn(), aChip.getSerialNumber());
00053
00054 id = aChip.getId();
00055 serialNum = aChip.getSerialNumber();
00056 gain = aChip.getGain();
00057 configured = aChip.isConfigured();
00058 bypassed = aChip.getBypassed();
00059
00060 ChannelMap_t channels = aChip.getChannels();
00061 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); channelIt++)
00062 {
00063 const Channel& channel = *(channelIt->second);
00064
00065 enableChannel[channel.getHardId()] = channel.getEnable();
00066
00067 stimulatedChannel[channel.getHardId()] = channel.getStimulate();
00068
00069 pedestal_offset[channel.getHardId()] = channel.getPedestalOffset();
00070
00071 enableChannel[channel.getHardId()] = channel.getEnable();
00072 try
00073 {
00074 const MicrorocChannel& mc = dynamic_cast<const MicrorocChannel&> (channel) ;
00075 for ( unsigned int i = 0 ; i <= 2 ; i++ )
00076 {
00077 maskChannel[channel.getHardId()][i] = mc.getMask(i);
00078 }
00079 }
00080 catch ( ... ) {}
00081 }
00082 return *this;
00083 }
00084
00085
00086 void MTChip::Info(void)const
00087 {
00088 cout << "------------ Chip[" << this->GetId() << "] on Dif[" << softId.GetDifId() <<"] configuration ---------------" << endl ;
00089
00090 int index = 0;
00091 cout << "Enable channel:" << endl;
00092 for ( UInt_t num = 0; num <=63 ; num++)
00093 {
00094 cout << "[" << index++ << ":" << enableChannel[num] << "]";
00095 }
00096 cout << endl;
00097 index = 0;
00098 cout << "stimulated value:" << endl;
00099 for ( UInt_t num = 0; num <=63 ; num++)
00100 {
00101 cout << "[" << index++ << ":" << stimulatedChannel[num] << "]";
00102 }
00103
00104 cout << endl;
00105 cout << endl;
00106 index = 0;
00107 cout << "pedestal value:" << endl;
00108
00109 for ( UInt_t num = 0; num <=63 ; num++)
00110 {
00111
00112 cout << "[" << index++ << ":" << pedestal_offset[num] << "]";
00113
00114 }
00115 cout << endl;
00116
00117 cout << "gain = " << gain << endl;
00118 cout << "serial number:[" << serialNum << endl;
00119 }
00120
00121