00001 /* @version $Revision: 1585 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-03-13 11:03:35 +0100 (Tue, 13 Mar 2012) $ */ 00002 #include "root/MTDif.hh" 00003 00004 #include "tools/MicroException.hh" 00005 #include "tools/Log.hh" 00006 00007 00008 #include "geometry/Dif.hh" 00009 00010 #include <iostream> 00011 #include <time.h> 00012 00013 using namespace std; 00014 00015 ClassImp(MTDif) 00016 00017 MTDif::MTDif(UInt_t _id) 00018 { 00019 id = _id; 00020 configured = false; 00021 low_register = 0; 00022 high_register = 0; 00023 before_register= 0; 00024 after_register = 0; 00025 acqMode = 0; 00026 difFirmware = 0; 00027 difConfig = 0; 00028 asicType = 0; 00029 asu1Id = 0; 00030 asu2Id = 0; 00031 } 00032 00033 //____________________ 00034 MTDif::MTDif(const Dif& aDif) 00035 { 00036 FILE_LOG(logDEBUG) << "MTDif::MTDif(const Dif& aDif)" << endl; 00037 (*this) = aDif; // appel de l'operateur de copie 00038 } 00039 00040 00041 //______________________________________________________________________________ 00042 MTDif::~MTDif() 00043 { 00044 00045 } 00046 00047 //______________________________________________________________________________ 00048 MTDif& MTDif::operator=(const Dif& aDif) 00049 { 00050 id = aDif.getId(); 00051 configured = aDif.isConfigured(); 00052 low_register = aDif.getLowRegister(); 00053 high_register = aDif.getHighRegister(); 00054 before_register = aDif.getBeforeRegister(); 00055 after_register = aDif.getAfterRegister() ; 00056 acqMode = aDif.getAcqMode(); 00057 difFirmware = aDif.getDifFirmware(); 00058 difConfig = aDif.getDifConfig(); 00059 asicType = aDif.getAsicType(); 00060 asu1Id = aDif.getAsu1Id(); 00061 asu2Id = aDif.getAsu2Id(); 00062 } 00063 00064 00065 //______________________________________________________________________________ 00066 void MTDif::SetRegister(Char_t low, Char_t high, Char_t before, Char_t after) 00067 { 00068 low_register = low; 00069 high_register = high; //8 bits 00070 before_register = before; //8 bits 00071 after_register = after; 00072 } 00073 00074 00075 TString MTDif::GetStringAsicType() const 00076 { 00077 // Code to describe front-end electronic device: 00078 // 01 Hardroc1 00079 // 02 Hardroc2 00080 // 03 Hardroc2b 00081 // 11 Dirac1 00082 // 12 Dirac2 00083 // 31 Microroc1 00084 if (asicType == 1) { return "Hardroc1"; } 00085 else if (asicType == 2) { return "Hardroc2"; } 00086 else if (asicType == 3) { return "Hardroc2b"; } 00087 else if (asicType == 4) { return "Microroc"; } 00088 else if (asicType == 11) { return "Dirac1"; } 00089 else if (asicType == 12) { return "Dirac2"; } 00090 else if (asicType == 31) { return "Microroc1"; } 00091 else return "Unknown asic type"; 00092 00093 } 00094 //______________________________________________________________________________ 00095 void MTDif::Info(void) const 00096 { 00097 cout << endl << "**** Dif informations ****" << endl ; 00098 cout << " Dif id[0x" << hex << id << "] configuration " <<endl; 00099 cout << " low:0x" <<hex << (Int_t)low_register; //8 bits 00100 cout << ", high:0x" <<hex << (Int_t)high_register; //8 bits 00101 cout << ", before:0x" <<hex<< (Int_t)before_register; //8 bits 00102 cout << ", after:0x" <<hex<< (Int_t)after_register ; //8 bits 00103 cout << ", acqMode:0x"<<hex<< acqMode << endl; 00104 cout << " Bunch crossing period:0x"<<hex << GetDifBunchCrossing() << endl; 00105 cout << " Firmware: 0x"<<hex << difFirmware <<endl; 00106 cout << " Config: 0x"<<hex << difConfig << endl; 00107 cout << " asic Type Id : 0x"<< hex << asicType << endl; 00108 cout << " asic Type: "<< GetStringAsicType() << endl; 00109 cout << " asu1 Id: 0x"<<hex << (unsigned int)asu1Id << endl; 00110 cout << " asu2 Id: 0x"<<hex << (unsigned int)asu2Id << endl; 00111 }