18MucFec :: MucFec(
int id )
22 if( (
id < 0) || (
id > STRIP_NUM-1) ) {
23 cout <<
"Initialize failure, check id!" << endl;
32 m_StripOrder = DEFAULT_STRIP_ORDER;
33 m_ChainName =
"NoName";
39MucFec :: MucFec(
int id,
int stripOrder,
int part,
int segment,
int layer,
int firstStripID,
40 unsigned int vmeRecord,
string chainName)
47 if( (
id < 0) || (
id > STRIP_NUM-1) ) {
49 cout <<
"MucFec::Check id:\t" <<
id <<
"!" << endl;
51 if( (stripOrder != 1) && (stripOrder != -1) ) {
53 cout <<
"MucFec::Check stripOrder:\t" << stripOrder <<
"!" << endl;
55 if( (part < 0) || ( part >
PART_MAX-1) ) {
57 cout <<
"MucFec::Check part:\t" << part <<
"!" << endl;
61 cout <<
"MucFec::Check segment:\t" << segment <<
"!" << endl;
65 cout <<
"MucFec::Check layer:\t" << layer <<
"!" << endl;
67 if(
sizeof(vmeRecord) < 4 ) {
69 cout <<
"MucFec::Check record:\t" << vmeRecord <<
"!" << endl;
73 m_StripOrder = stripOrder;
77 m_FirstStripID = firstStripID;
78 m_ChainName = chainName;
79 m_VmeRecord = vmeRecord;
85void MucFec :: Initialize()
88 MucFec::DecodeVmeAddress();
89 MucFec::SetFiredStripNumber();
90 MucFec::SetFiredStripVect();
91 MucFec::EncodePowerpcRecord();
95void MucFec :: DecodeData()
97 m_Data = (
unsigned short)m_VmeRecord;
100void MucFec :: DecodeVmeAddress()
102 m_VmeAddress = (
unsigned short)(m_VmeRecord >> LENGTH);
103 m_Module = (m_VmeAddress >> MODULE_BIT) & 0xF;
104 m_Socket = (m_VmeAddress >> SOCKET_BIT) & 0x3;
105 m_FecID = m_VmeAddress & 0xF;
108void MucFec :: SetFiredStripNumber()
110 m_FiredStripNumber = 0;
111 for(
int i=0; i<STRIP_NUM; i++) {
112 if( (m_Data>>i) & 1 ) m_FiredStripNumber++;
116void MucFec :: SetFiredStripVect()
118 m_FiredStripVect.clear();
119 int tempID[STRIP_NUM];
122 for(
int i=0; i<STRIP_NUM; i++)
124 if( (m_Data>>i) & 1 ) {
125 tempID[tempFired] = i;
131 for(
int i=0; i<tempFired; i++)
133 stripID = ((1 - m_StripOrder)/2) * (STRIP_NUM - 1) + (m_StripOrder * tempID[i]);
134 stripID += m_FirstStripID;
135 m_FiredStripVect.push_back( stripID );
139void MucFec :: EncodePowerpcRecord()
141 unsigned int address = ( (m_Part<<PART_BIT) | (m_Segment<<SEG_BIT) | (m_Layer<<LAY_BIT) | m_FirstStripID );
142 m_GeoAddress = (
unsigned short)
address;
143 m_PowerpcRecord = (
address << LENGTH ) | m_Data;
146void MucFec :: SetStripOrder(
int stripOrder )
148 m_StripOrder = stripOrder;
149 MucFec::SetFiredStripVect();
152void MucFec :: SetLocation(
int part,
int segment,
int layer )
158 MucFec::Initialize();
161void MucFec :: SetFirstStripID(
int firstStripID )
163 m_FirstStripID = firstStripID;
164 MucFec :: EncodePowerpcRecord();
165 MucFec :: SetFiredStripVect();
168void MucFec :: SetData(
unsigned short data )
171 m_VmeRecord = (m_VmeRecord | m_Data);
172 MucFec :: EncodePowerpcRecord();
173 MucFec :: SetFiredStripNumber();
174 MucFec :: SetFiredStripVect();
178int MucFec :: GetFiredStripNumber() {
return m_FiredStripNumber; }
179unsigned int MucFec :: GetPowerpcRecord() {
return m_PowerpcRecord; }
180vector< int >* MucFec :: GetFiredStripVect() {
return &m_FiredStripVect; }
182string MucFec :: GetBin(
unsigned int record )
184 const int SIZE =
sizeof(
unsigned int ) * 8;
187 unsigned int temp = 0;
188 for(
int i=0; i<SIZE; i++) {
189 temp = record >> SIZE-i-1;
190 Bin += ( temp & 1 ) ?
"1" :
"0";
196string MucFec :: GetBin(
unsigned short record )
198 const int SIZE =
sizeof(
unsigned short ) * 8;
201 unsigned short temp = 0;
202 for(
int i=0; i<SIZE; i++) {
203 temp = record >> SIZE-i-1;
204 Bin += ( temp & 1 ) ?
"1" :
"0";
210string MucFec :: GetVmeBin()
215string MucFec :: GetGeoBin()
220string MucFec :: GetDataBin()
string GetBin(unsigned int record)