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;
54 MucChain::InitFecVect();
58void MucChain :: SetStripOrder(
int stripOrder )
62 if( stripOrder == 0 ) order = DEFAULT_STRIP_ORDER;
63 else order = stripOrder;
65 for(
int i=0; i<m_FecTotal; i++) m_StripOrder[ i ] = order;
68void MucChain :: SetStripOrder(
int fecID,
int stripOrder )
71 int i = m_FecOrder * ( fecID - ((1-m_FecOrder)/2)*(m_FecTotal - 1) );
72 m_FecVect[i].SetStripOrder( stripOrder );
75void MucChain :: ArrayInvert(
int* array,
int number )
78 for(
int i=0; i<number/2; i++)
81 array[i] = array[number-1-i];
82 array[number-1-i] = temp;
87void MucChain :: Mapping()
99void MucChain :: InitPart()
102 if( m_Name[0] ==
'B' ) m_Part =
BRID;
103 else if( m_Name[1] ==
'E' ) m_Part =
EEID;
107void MucChain :: InitSegment()
114 case '1' : m_Segment = 2;
break;
115 case '2' : m_Segment = 1;
break;
116 case '3' : m_Segment = 0;
break;
117 case '4' : m_Segment = 7;
break;
118 case '5' : m_Segment = 6;
break;
119 case '6' : m_Segment = 5;
break;
120 case '7' : m_Segment = 4;
break;
121 case '8' : m_Segment = 3;
break;
125 else if( m_Part == EEID )
129 case '1' : m_Segment = 0;
break;
130 case '2' : m_Segment = 3;
break;
131 case '3' : m_Segment = 2;
break;
132 case '4' : m_Segment = 1;
break;
139 case '1' : m_Segment = 1;
break;
140 case '2' : m_Segment = 2;
break;
141 case '3' : m_Segment = 3;
break;
142 case '4' : m_Segment = 0;
break;
147void MucChain :: InitFecTotal()
152 if( m_Name[1] ==
'O' ) {
153 m_FecTotal = FEC_NUM - 1;
157 if( m_Segment ==
BRTOP && m_Name[1] ==
'E' ) {
158 m_FecTotal = FEC_NUM ;
161 m_FecTotal = FEC_NUM - 4;
166 m_FecTotal = FEC_NUM;
170void MucChain :: InitFecPerLayer()
173 if( m_FecTotal != 0 ) {
174 if( m_FecTotal == FEC_NUM ) m_FecPerLayer = 4;
175 else m_FecPerLayer = 3;
181void MucChain :: InitFecLayerID()
185 for(
int i=0; i<FEC_NUM; i++) m_FecLayerID[i] = 0;
190 if( m_Name[1] ==
'O' )
192 for(
int i=0; i<m_FecTotal; i++) {
193 m_FecLayerID[i] = (i/m_FecPerLayer) * 2;
198 for(
int i=0; i<m_FecTotal; i++) {
199 m_FecLayerID[i] = (i/m_FecPerLayer) * 2 + 1;
205 if( m_Name[3] ==
'F' )
207 for(
int i=0; i<m_FecTotal; i++) {
208 m_FecLayerID[i] = 3 - (i/m_FecPerLayer);
213 for(
int i=0; i<m_FecTotal; i++) {
214 m_FecLayerID[i] = 7 - (i/m_FecPerLayer);
220 if( m_FecOrder == -1 )
224void MucChain :: InitFirstStripID()
228 for(
int i=0; i<FEC_NUM; i++)
229 m_FirstStripID[i] = 0;
234 if( m_Name[1] ==
'E' )
239 if(m_Segment==
BRTOP) {
240 for(
int i=0; i<m_FecTotal; i++)
243 else switch(m_Segment)
248 for(
int i=0; i<m_FecTotal; i++)
252 for(
int i=0; i<m_FecTotal; i++)
256 else if( m_Name[1] ==
'W' )
264 for(
int i=0; i<m_FecTotal; i++)
268 for(
int i=0; i<m_FecTotal; i++)
280 for(
int i=0; i<m_FecTotal; i++)
284 for(
int i=0; i<m_FecTotal; i++)
290 for(
int j=1; j<m_FecTotal/m_FecPerLayer; j+=2)
295 for(
int i=0; i<m_FecTotal; i++) m_FirstStripID[i] =
FIRST_STRID_SQC_EC[ i%m_FecPerLayer ];
303unsigned int MucChain :: EncodeVmeRecord(
int module,
int socket,
int fecID,
unsigned short data)
306 unsigned int record = ((module << MODULE_BIT) | (socket << SOCKET_BIT) | fecID);
307 return ( (record << LENGTH) |
data );
311void MucChain :: InitStripOrder()
314 for(
int i=0; i<m_FecTotal; i++)
318 m_StripOrder[i] = -1;
368 else if( (m_Part==EEID && (m_Segment==0 || m_Segment==2)) ||
369 (m_Part==
WEID && (m_Segment==1 || m_Segment==3)) )
378void MucChain :: InitFecVect()
382 unsigned short data = 0;
384 int segment = m_Segment;
391 unsigned int vmeRecord;
393 for(
int i=0; i<m_FecTotal; i++)
396 id = ( (1 - m_FecOrder)/2 ) * ( m_FecTotal - 1 ) + (m_FecOrder * i);
398 layer = m_FecLayerID[ id ];
399 firstStripID = m_FirstStripID[ id ];
400 stripOrder = m_StripOrder[ id ];
401 chainName = MucChain::m_Name;
402 vmeRecord = EncodeVmeRecord( m_Module, m_Socket,
id ,
data);
405 MucFec aFec(
id, stripOrder, part, segment, layer, firstStripID, vmeRecord, chainName );
406 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)