121 int tmpArray[] = {15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18,
122 18, 18, 18, 18, 19, 19, 19, 18,
123 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
124 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 23,
125 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26,
126 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28,
127 28, 29, 29, 29, 29, 28, -1};
131 while( -1 != tmpArray[i] )
133 RunningCount += tmpArray[i];
151 int moduleId, strawLayerId, strawInLayerId;
155 uint32_t strawNumber, bufferOffset;
158 std::string dataFile;
161 std::ifstream *inputFile;
172 dataFile =
"TRT_SR1_1BS-1BL_map.dat";
174 inputFile =
new std::ifstream(
file.c_str() );
176 if (!inputFile->is_open())
178 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
181 while ( getline( *inputFile, thisLine ) )
183 istringstream
parse( thisLine );
185 parse >> strawNumber >> bufferOffset;
200 dataFile =
"TRT_SR1_2BS-2BL1_map.dat";
202 inputFile =
new std::ifstream(
file.c_str() );
204 if (!inputFile->is_open())
206 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
209 while ( getline( *inputFile, thisLine ) )
211 istringstream
parse( thisLine );
213 parse >> strawNumber >> bufferOffset;
228 dataFile =
"TRT_SR1_2BL2-3BL1_map.dat";
230 inputFile =
new std::ifstream(
file.c_str() );
232 if (!inputFile->is_open())
234 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
237 while ( getline( *inputFile, thisLine ) )
239 istringstream
parse( thisLine );
241 parse >> strawNumber >> bufferOffset;
254 dataFile =
"TRT_SR1_3BL2_map.dat";
256 inputFile =
new std::ifstream(
file.c_str() );
258 if (!inputFile->is_open())
260 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
263 while ( getline( *inputFile, thisLine ) )
265 istringstream
parse( thisLine );
267 parse >> strawNumber >> bufferOffset;
280 dataFile =
"TRT_SR1_3BS_map.dat";
282 inputFile =
new std::ifstream(
file.c_str() );
284 if (!inputFile->is_open())
286 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
289 while ( getline( *inputFile, thisLine ) )
291 istringstream
parse( thisLine );
293 parse >> strawNumber >> bufferOffset;
310 dataFile =
"TRT_SR1_1FS-1FL_map.dat";
312 inputFile =
new std::ifstream(
file.c_str() );
314 if (!inputFile->is_open())
316 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
319 while ( getline( *inputFile, thisLine ) )
321 istringstream
parse( thisLine );
323 parse >> strawNumber >> bufferOffset;
336 dataFile =
"TRT_SR1_2FS-2FL1_map.dat";
338 inputFile =
new std::ifstream(
file.c_str() );
340 if (!inputFile->is_open())
342 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
345 while ( getline( *inputFile, thisLine ) )
347 istringstream
parse( thisLine );
349 parse >> strawNumber >> bufferOffset;
362 dataFile =
"TRT_SR1_2FL2-3FL1_map.dat";
364 inputFile =
new std::ifstream(
file.c_str() );
366 if (!inputFile->is_open())
368 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
371 while ( getline( *inputFile, thisLine ) )
373 istringstream
parse( thisLine );
375 parse >> strawNumber >> bufferOffset;
388 dataFile =
"TRT_SR1_3FL2_map.dat";
390 inputFile =
new std::ifstream(
file.c_str() );
392 if (!inputFile->is_open())
394 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
397 while ( getline( *inputFile, thisLine ) )
399 istringstream
parse( thisLine );
401 parse >> strawNumber >> bufferOffset;
414 dataFile =
"TRT_SR1_3FS_map.dat";
416 inputFile =
new std::ifstream(
file.c_str() );
418 if (!inputFile->is_open())
420 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
423 while ( getline( *inputFile, thisLine ) )
425 istringstream
parse( thisLine );
427 parse >> strawNumber >> bufferOffset;
441 dataFile =
"TRT_SR1_Barrel_Cable_map.dat";
445 inputFile =
new std::ifstream(
file.c_str() );
447 if (!inputFile->is_open())
449 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Could not open file " << dataFile );
455 while ( getline( *inputFile, thisLine ) )
457 if ( thisLine.length() == 0 )
460 string::size_type loc = thisLine.find(
'#' );
461 if ( loc != string::npos )
463 thisLine.replace( loc, thisLine.length(), 1,
' ' );
465 loc = thisLine.find_first_not_of(
" \t" );
466 if ( loc == string::npos )
471 istringstream
parse( thisLine );
480 if ( (srcId & 0xFF0000) == 0x310000 )
485 else if ( (srcId & 0xFF0000) == 0x320000 )
490 else if ( (srcId & 0xFF0000) == 0x330000 )
495 else if ( (srcId & 0xFF0000) == 0x340000 )
501 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1: Invalid source id " << (hex) << srcId << (dec) );
516 int my_phi = my_map->
SubDet * 32 + my_map->
Phi;
519 std::vector<uint32_t>::iterator it = (
m_phi_to_source[my_phi]).begin();
536 for ( ptk_i=1; ptk_i<=444; ptk_i++ )
538 std::map<int, int>::iterator map_it =
m_1BS_1BL_map.find( ptk_i );
544 GlobalCableMap::iterator pos;
547 std::vector< GlobalCableMap_t *> GCM;
551 sort( GCM.begin(), GCM.end(), greater_RG_GCM );
553 int ConnectorCount=-1;
554 std::vector< GlobalCableMap_t *>::iterator it;
555 for ( it=GCM.begin(); it != GCM.end(); ++it )
560 std::map<int, int> con_map;
563 if ( my_map->
FEid ==
"1BS_1BL" )
565 else if ( my_map->
FEid ==
"2BS_2BL1" )
567 else if ( my_map->
FEid ==
"2BL2_3BL1" )
569 else if ( my_map->
FEid ==
"3BL2" )
571 else if ( my_map->
FEid ==
"3BS" )
573 else if ( my_map->
FEid ==
"1FS_1FL" )
575 else if ( my_map->
FEid ==
"2FS_2FL1" )
577 else if ( my_map->
FEid ==
"2FL2_3FL1" )
579 else if ( my_map->
FEid ==
"3FL2" )
581 else if ( my_map->
FEid ==
"3FS" )
583 else if ( my_map->
FEid ==
"ec_rod1l" )
585 else if ( my_map->
FEid ==
"ec_rod2l" )
587 else if ( my_map->
FEid ==
"ec_rod3l" )
589 else if ( my_map->
FEid ==
"ec_rod1r" )
591 else if ( my_map->
FEid ==
"ec_rod2r" )
593 else if ( my_map->
FEid ==
"ec_rod3r" )
600 if ( abs( my_map->
SubDet ) == 1 )
602 for ( i=1; i<=444; i++ )
604 std::map<int, int>::iterator map_it = con_map.find( i );
606 if ( map_it == con_map.end() )
608 m_cabling->set_identifierForAllStraws( pos->first,
609 i + ConnectorCount*444,
614 int BufferLocation = map_it->first + ConnectorCount*444;
615 int Straw = map_it->second - 1;
650 moduleId, strawLayerId,
654 m_cabling->set_identifierForAllStraws( pos->first, BufferLocation,
663 my_map->
Phi, moduleId,
672 <<
" SubDet = " << my_map->
SubDet \
673 <<
" Phi = " << my_map->
Phi \
674 <<
" Module = " << moduleId \
675 <<
" Layer = " << strawLayerId \
676 <<
" StrInLay = " << strawInLayerId );
680 m_cabling->set_identifierHashForAllStraws( pos->first,
687 for ( i=0; i<1776; i++ )
689 std::map<int, int>::iterator map_it = con_map.find( i );
691 if ( map_it == con_map.end() )
693 m_cabling->set_identifierForAllStraws( pos->first, i,
698 int BufferLocation = i;
699 int Straw = map_it->second;
701 strawLayerId = (Straw >> 8) & 0xff;
702 strawInLayerId = Straw & 0xff;
704 moduleId = strawLayerId / 8;
707 moduleId = moduleId / 2;
708 strawLayerId = strawLayerId % 16;
712 moduleId = moduleId - 6;
713 strawLayerId = strawLayerId % 8;
718 moduleId, strawLayerId,
722 m_cabling->set_identifierForAllStraws( pos->first, BufferLocation,
731 my_map->
Phi, moduleId,
740 <<
" SubDet = " << my_map->
SubDet \
741 <<
" Phi = " << my_map->
Phi \
742 <<
" Module = " << moduleId \
743 <<
" Layer = " << strawLayerId \
744 <<
" StrInLay = " << strawInLayerId );
748 m_cabling->set_identifierHashForAllStraws( pos->first,
790std::vector<IdentifierHash> & ids)
798 eformat::helper::SourceIdentifier id (rob_id);
803 std::map<int, std::vector<GlobalCableMap_t *> >::iterator map_it =
m_CableMap.find( rob_id );
806 ATH_MSG_FATAL(
"fillCollID: Unable to get CableMap for rob_id " << std::hex << rob_id << std::dec );
810 std::vector< GlobalCableMap_t *> GCM = map_it->second;
814 std::vector<GlobalCableMap_t *>::iterator it;
818 while ( it != GCM.end() )
823 int barrelId = my_map->
SubDet;
825 if ( abs( barrelId ) == 1 )
828 bool done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
829 while ( !done && (it != GCM.end()) )
833 if ( (my_map->
FEid ==
"1BS_1BL") || (my_map->
FEid ==
"1FS_1FL") )
835 else if ( (my_map->
FEid ==
"2BS_2BL1") || (my_map->
FEid ==
"2FS_2FL1") )
837 else if ( (my_map->
FEid ==
"2BL2_3BL1") || (my_map->
FEid ==
"2FL2_3FL1") )
839 else if ( (my_map->
FEid ==
"3BL2") || (my_map->
FEid ==
"3BS") ||
840 (my_map->
FEid ==
"3FL2") || (my_map->
FEid ==
"3FS") )
845 if ( it != GCM.end() )
848 done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
858 if ( (ring == 0) && ((1<<ring) & rings) )
867 ids.push_back(idHash);
873 else if ( (ring == 1) && ((1<<ring) & rings) )
882 ids.push_back(idHash);
888 else if ( (ring == 2) && ((1<<ring) & rings) )
897 ids.push_back(idHash);
915 bool done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
916 while ( !done && (it != GCM.end()) )
919 if ( (my_map->
FEid ==
"ec_rod1l") ||
920 (my_map->
FEid ==
"ec_rod1r") )
927 else if ( (my_map->
FEid ==
"ec_rod2l") ||
928 (my_map->
FEid ==
"ec_rod2r") )
935 else if ( (my_map->
FEid ==
"ec_rod3l") ||
936 (my_map->
FEid ==
"ec_rod3r") )
945 ATH_MSG_ERROR(
"Invalid my_map->FEid. This should not happen!" );
951 if ( it != GCM.end() )
954 done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
960 for (
int wheel = StartWheel; wheel < EndWheel; wheel++ )
962 for (
int layer = StartLayer; layer < EndLayer; layer++ )
969 ids.push_back(idHash);