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 }
00030
00031 MTChip::MTChip(const Chip& aChip)
00032 {
00033 (*this) = aChip;
00034 }
00035
00036
00037
00038 MTChip::~MTChip()
00039 {
00040
00041 }
00042
00043 MTChip& MTChip::operator=(const Chip& aChip)
00044 {
00045 const Board& board = aChip.getBoard() ;
00046 const Dif* dif = board.getDif();
00047 unsigned int difId = 0;
00048 if ( dif != NULL) difId = dif->getId();
00049 const Chamber& cham = board.getChamber();
00050
00051 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());
00052
00053 id = aChip.getId();
00054 serialNum = aChip.getSerialNumber();
00055 gain = aChip.getGain();
00056 configured = aChip.isConfigured();
00057
00058 ChannelMap_t channels = aChip.getChannels();
00059 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); channelIt++)
00060 {
00061 const Channel& channel = *(channelIt->second);
00062
00063 enableChannel[channel.getHardId()] = channel.getEnable();
00064
00065 stimulatedChannel[channel.getHardId()] = channel.getStimulate();
00066
00067 pedestal_offset[channel.getHardId()] = channel.getPedestalOffset();
00068
00069 enableChannel[channel.getHardId()] = channel.getEnable();
00070 try
00071 {
00072 const MicrorocChannel& mc = dynamic_cast<const MicrorocChannel&> (channel) ;
00073 for ( unsigned int i = 0 ; i <= 2 ; i++ )
00074 {
00075 maskChannel[channel.getHardId()][i] = mc.getMask(i);
00076 }
00077 }
00078 catch ( ... ) {}
00079 }
00080 return *this;
00081 }
00082
00083
00084 void MTChip::Info(void)const
00085 {
00086 cout << "------------ Chip[" << this->GetId() << "] on Dif[" << softId.GetDifId() <<"] configuration ---------------" << endl ;
00087
00088 int index = 0;
00089 cout << "Enable channel:" << endl;
00090 for ( UInt_t num = 0; num <=63 ; num++)
00091 {
00092 cout << "[" << index++ << ":" << enableChannel[num] << "]";
00093 }
00094 cout << endl;
00095 index = 0;
00096 cout << "stimulated value:" << endl;
00097 for ( UInt_t num = 0; num <=63 ; num++)
00098 {
00099 cout << "[" << index++ << ":" << stimulatedChannel[num] << "]";
00100 }
00101
00102 cout << endl;
00103 cout << endl;
00104 index = 0;
00105 cout << "pedestal value:" << endl;
00106
00107 for ( UInt_t num = 0; num <=63 ; num++)
00108 {
00109
00110 cout << "[" << index++ << ":" << pedestal_offset[num] << "]";
00111
00112 }
00113 cout << endl;
00114
00115 cout << "gain = " << gain << endl;
00116 cout << "serial number:[" << serialNum << endl;
00117 }
00118
00119