42 if( part !=
BRID ) max = E_STR_NUM;
44 else if( segment == B_TOP ) max = B_TOPSTR_NUM;
45 else max = B_PHISTR_NUM;
54 for(
int i=0; i<part; i++) {
55 boxId += BOX_PER_PART[i];
61 boxId += ( segment * BOX_PER_SEG[part] + layer );
72 boxId =
GetBoxId( part, segment, layer );
75 strId = boxId*E_STR_NUM + strSubId;
77 else if( part ==
BRID )
79 strId = STR_PER_PART[0];
82 strId += segment * B_STR_PER_SEG[0] + E_STR_NUM;
84 strId += segment * B_STR_PER_SEG[0];
87 strId += (layer/2) * ( (segment == B_TOP)?B_TOPSTR_NUM:B_PHISTR_NUM );
92 strId = STR_PER_PART[0] + STR_PER_PART[1];
93 strId += (boxId - BOX_SUM[1])*E_STR_NUM + strSubId;
102 if( (boxId < 0) || (boxId > BOX_MAX-1) )
107 cout <<
"box id out range:\t" << boxId <<
"!" << endl;
112 if( boxId < BOX_SUM[0] ) { *part = 0; }
113 else if( boxId < BOX_SUM[1] ) { *part = 1; boxId -= BOX_SUM[0]; }
114 else { *part = 2; boxId -= BOX_SUM[1]; }
117 if( *part ==
BRID ) {
132 if( (stripId < 0) || (stripId >
STRIP_MAX-1) )
138 cout <<
"strip id out range:\t" << stripId <<
"!" << endl;
143 if( stripId < STR_SUM[0] ) { *part = 0; }
144 else if ( stripId < STR_SUM[1] ) { *part = 1; stripId -= STR_SUM[0]; }
145 else { *part = 2; stripId -= STR_SUM[1]; }
151 if ( stripId >= 2*B_STR_PER_SEG[0] && stripId < 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] )
156 stripId -= 2*B_STR_PER_SEG[0];
157 temp = stripId % (
B_ZSTR_NUM + B_TOPSTR_NUM );
161 else *layer = 2*( stripId / (
B_ZSTR_NUM + B_TOPSTR_NUM ) ) + 1;
170 if (stripId >= 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] ) stripId -= E_STR_NUM;
173 *segment = stripId / B_STR_PER_SEG[0];
175 stripId %= B_STR_PER_SEG[0];
176 temp = stripId % (
B_ZSTR_NUM + B_PHISTR_NUM );
180 else *layer = 2*( stripId / (
B_ZSTR_NUM + B_PHISTR_NUM ) ) + 1;
189 *strSubId = stripId % E_STR_NUM;
190 *layer = ( stripId / E_STR_NUM ) %
E_LAY_NUM ;
191 *segment = ( stripId / E_STR_NUM ) /
E_LAY_NUM ;
202 cout <<
"prt: " << m_Part
203 <<
"\tseg: " << m_Segment
204 <<
"\tlay: " << m_Layer
205 <<
"\tstr: " << m_Strip
206 <<
"\tid: " << m_Id << endl;
210 cout <<
"id: " << m_Id
211 <<
"\tprt: " << m_Part
212 <<
"\tseg: " << m_Segment
213 <<
"\tlay: " << m_Layer
214 <<
"\tstr: " << m_Strip << endl;