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];
86 strId += ((1+layer)/2) * B_ZSTR_NUM;
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 ) {
118 *segment = boxId / B_LAY_NUM;
119 *layer = boxId % B_LAY_NUM;
122 *segment = boxId / E_LAY_NUM;
123 *layer = boxId % E_LAY_NUM;
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 );
160 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / ( B_ZSTR_NUM + B_TOPSTR_NUM ) );
161 else *layer = 2*( stripId / ( B_ZSTR_NUM + B_TOPSTR_NUM ) ) + 1;
164 if( temp < B_ZSTR_NUM ) *strSubId = temp;
165 else *strSubId = temp - B_ZSTR_NUM;
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 );
179 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / ( B_ZSTR_NUM + B_PHISTR_NUM ) );
180 else *layer = 2*( stripId / ( B_ZSTR_NUM + B_PHISTR_NUM ) ) + 1;
183 if( temp < B_ZSTR_NUM ) *strSubId = temp;
184 else *strSubId = temp - B_ZSTR_NUM;
189 *strSubId = stripId % E_STR_NUM;
190 *layer = ( stripId / E_STR_NUM ) % E_LAY_NUM ;
191 *segment = ( stripId / E_STR_NUM ) / E_LAY_NUM ;