17MucChain :: MucChain(
int id, std::string name,
int module,
int socket,
int fecOrder )
25 m_FecOrder = fecOrder;
31MucChain :: ~MucChain()
34 delete []m_FirstStripID;
35 delete []m_FecLayerID;
36 delete []m_StripOrder;
42void MucChain :: ReMap(
string name,
int module,
int socket )
51void MucChain :: SetFecOrder(
int fecOrder )
53 m_FecOrder = fecOrder;
55 MucChain::InitFecVect();
59void MucChain :: SetStripOrder(
int stripOrder )
63 if( stripOrder == 0 ) order = DEFAULT_STRIP_ORDER;
64 else order = stripOrder;
66 for(
int i=0; i<m_FecTotal; i++)
67 m_StripOrder[ i ] = order;
70void MucChain :: SetStripOrder(
int fecID,
int stripOrder )
73 int i = m_FecOrder * ( fecID - ((1-m_FecOrder)/2)*(m_FecTotal - 1) );
75 m_FecVect[i].SetStripOrder( stripOrder );
78void MucChain :: ArrayInvert(
int* array,
int number )
81 for(
int i=0; i<number/2; i++)
84 array[i] = array[number-1-i];
85 array[number-1-i] = temp;
90void MucChain :: Mapping()
102void MucChain :: InitPart()
105 if( m_Name[0] ==
'B' ) m_Part =
BRID;
106 else if( m_Name[1] ==
'E' ) m_Part =
EEID;
110void MucChain :: InitSegment()
117 case '1' : m_Segment = 2;
break;
118 case '2' : m_Segment = 1;
break;
119 case '3' : m_Segment = 0;
break;
120 case '4' : m_Segment = 7;
break;
121 case '5' : m_Segment = 6;
break;
122 case '6' : m_Segment = 5;
break;
123 case '7' : m_Segment = 4;
break;
124 case '8' : m_Segment = 3;
break;
128 else if( m_Part == EEID )
132 case '1' : m_Segment = 0;
break;
133 case '2' : m_Segment = 3;
break;
134 case '3' : m_Segment = 2;
break;
135 case '4' : m_Segment = 1;
break;
142 case '1' : m_Segment = 1;
break;
143 case '2' : m_Segment = 2;
break;
144 case '3' : m_Segment = 3;
break;
145 case '4' : m_Segment = 0;
break;
150void MucChain :: InitFecTotal()
155 if( m_Name[1] ==
'O' )
157 m_FecTotal = FEC_NUM - 1;
161 if( m_Segment ==
BRTOP && m_Name[1] ==
'E' )
163 m_FecTotal = FEC_NUM ;
167 m_FecTotal = FEC_NUM - 4;
173 m_FecTotal = FEC_NUM;
177void MucChain :: InitFecPerLayer()
180 if( m_FecTotal != 0 )
182 if( m_FecTotal == FEC_NUM )
191void MucChain :: InitFecLayerID()
195 for(
int i=0; i<FEC_NUM; i++)
201 if( m_Name[1] ==
'O' )
203 for(
int i=0; i<m_FecTotal; i++) {
204 m_FecLayerID[i] = (i/m_FecPerLayer) * 2;
209 for(
int i=0; i<m_FecTotal; i++) {
210 m_FecLayerID[i] = (i/m_FecPerLayer) * 2 + 1;
216 if( m_Name[3] ==
'F' )
218 for(
int i=0; i<m_FecTotal; i++) {
219 m_FecLayerID[i] = 3 - (i/m_FecPerLayer);
224 for(
int i=0; i<m_FecTotal; i++) {
225 m_FecLayerID[i] = 7 - (i/m_FecPerLayer);
231 if( m_FecOrder == -1 )
236void MucChain :: InitFirstStripID()
240 for(
int i=0; i<FEC_NUM; i++)
241 m_FirstStripID[i] = 0;
246 if( m_Name[1] ==
'E' )
253 for(
int i=0; i<m_FecTotal; i++)
256 else switch(m_Segment)
261 for(
int i=0; i<m_FecTotal; i++)
265 for(
int i=0; i<m_FecTotal; i++)
271 else if( m_Name[1] ==
'W' )
279 for(
int i=0; i<m_FecTotal; i++)
283 for(
int i=0; i<m_FecTotal; i++)
295 for(
int i=0; i<m_FecTotal; i++)
299 for(
int i=0; i<m_FecTotal; i++)
305 for(
int j=1; j<m_FecTotal/m_FecPerLayer; j+=2)
311 for(
int i=0; i<m_FecTotal; i++)
316 if( m_FecOrder == -1 )
322unsigned int MucChain :: EncodeVmeRecord(
int module,
int socket,
int fecID,
unsigned short data)
325 unsigned int record = ((module << MODULE_BIT) | (socket << SOCKET_BIT) | fecID);
326 return ( (record << LENGTH) |
data );
330void MucChain :: InitStripOrder()
335 for(
int i=0; i<m_FecTotal; i++)
339 m_StripOrder[i] = -1;
392 else if( (m_Part==EEID && (m_Segment==0 || m_Segment==2))
393 || (m_Part==
WEID && (m_Segment==1 || m_Segment==3)) )
402void MucChain :: InitFecVect()
406 unsigned short data = 0;
409 int segment = m_Segment;
417 unsigned int vmeRecord;
419 for(
int i=0; i<m_FecTotal; i++)
422 id =( (1 - m_FecOrder)/2 ) * ( m_FecTotal - 1 ) + (m_FecOrder * i);
424 layer = m_FecLayerID[ id ];
425 firstStripID = m_FirstStripID[ id ];
426 stripOrder = m_StripOrder[ id ];
427 chainName = MucChain::m_Name;
428 vmeRecord = EncodeVmeRecord( m_Module, m_Socket,
id ,
data);
431 MucFec aFec(
id, stripOrder, part, segment, layer, firstStripID, vmeRecord, chainName );
432 m_FecVect.push_back( aFec );
const int STRORDER_ECA[E_LAY_NUM]
const int STRORDER_ECB[E_LAY_NUM]
const int FIRST_STRID_SQC_BEA[3]
const int FIRST_STRID_SQC_BEB[3]
const int FIRST_STRID_SQC_BWA[3]
const int FIRST_STRID_SQC_BWB[3]
const int FIRST_STRID_SQC_EC[4]
const int FIRST_STRID_SQC_BETOP[4]
void ArrayInvert(int *array, int number)