26 #include "eformat/SourceIdentifier.h"
31 using eformat::helper::SourceIdentifier;
38 static const InterfaceID IID_ITRT_FillCablingData_SR1
39 (
"TRT_FillCablingData_SR1", 1, 0);
46 declareInterface< TRT_FillCablingData_SR1 >(
this );
56 {
return IID_ITRT_FillCablingData_SR1; }
69 return StatusCode::FAILURE;
81 ATH_MSG_INFO(
"TRT_FillCablingData_SR1::initializiation finished" );
83 return StatusCode::SUCCESS;
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;
153 IdentifierHash hashId;
172 dataFile =
"TRT_SR1_1BS-1BL_map.dat";
181 while ( getline( *
inputFile, thisLine ) )
183 istringstream
parse( thisLine );
185 parse >> strawNumber >> bufferOffset;
200 dataFile =
"TRT_SR1_2BS-2BL1_map.dat";
209 while ( getline( *
inputFile, thisLine ) )
211 istringstream
parse( thisLine );
213 parse >> strawNumber >> bufferOffset;
228 dataFile =
"TRT_SR1_2BL2-3BL1_map.dat";
237 while ( getline( *
inputFile, thisLine ) )
239 istringstream
parse( thisLine );
241 parse >> strawNumber >> bufferOffset;
263 while ( getline( *
inputFile, thisLine ) )
265 istringstream
parse( thisLine );
267 parse >> strawNumber >> bufferOffset;
289 while ( getline( *
inputFile, thisLine ) )
291 istringstream
parse( thisLine );
293 parse >> strawNumber >> bufferOffset;
310 dataFile =
"TRT_SR1_1FS-1FL_map.dat";
319 while ( getline( *
inputFile, thisLine ) )
321 istringstream
parse( thisLine );
323 parse >> strawNumber >> bufferOffset;
336 dataFile =
"TRT_SR1_2FS-2FL1_map.dat";
345 while ( getline( *
inputFile, thisLine ) )
347 istringstream
parse( thisLine );
349 parse >> strawNumber >> bufferOffset;
362 dataFile =
"TRT_SR1_2FL2-3FL1_map.dat";
371 while ( getline( *
inputFile, thisLine ) )
373 istringstream
parse( thisLine );
375 parse >> strawNumber >> bufferOffset;
397 while ( getline( *
inputFile, thisLine ) )
399 istringstream
parse( thisLine );
401 parse >> strawNumber >> bufferOffset;
423 while ( getline( *
inputFile, thisLine ) )
425 istringstream
parse( thisLine );
427 parse >> strawNumber >> bufferOffset;
441 dataFile =
"TRT_SR1_Barrel_Cable_map.dat";
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;
536 for ( ptk_i=1; ptk_i<=444; ptk_i++ )
547 std::vector< GlobalCableMap_t *> GCM;
551 sort( GCM.begin(), GCM.end(), greater_RG_GCM );
553 int ConnectorCount=-1;
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++ )
606 if ( map_it == con_map.end() )
609 i + ConnectorCount*444,
614 int BufferLocation = map_it->first + ConnectorCount*444;
615 int Straw = map_it->second - 1;
650 moduleId, strawLayerId,
663 my_map->
Phi, moduleId,
672 <<
" SubDet = " << my_map->
SubDet \
673 <<
" Phi = " << my_map->
Phi \
674 <<
" Module = " << moduleId \
675 <<
" Layer = " << strawLayerId \
676 <<
" StrInLay = " << strawInLayerId );
687 for (
i=0;
i<1776;
i++ )
691 if ( map_it == con_map.end() )
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,
731 my_map->
Phi, moduleId,
740 <<
" SubDet = " << my_map->
SubDet \
741 <<
" Phi = " << my_map->
Phi \
742 <<
" Module = " << moduleId \
743 <<
" Layer = " << strawLayerId \
744 <<
" StrInLay = " << strawInLayerId );
773 std::vector<IdentifierHash> * vectID =
new std::vector<IdentifierHash>();
776 ATH_MSG_INFO(
"Adding Collid for ROB " << std::hex <<
pos->first << std::dec );
790 std::vector<IdentifierHash> &
ids)
793 IdentifierHash idHash;
798 eformat::helper::SourceIdentifier
id (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;
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++ )
969 ids.push_back(idHash);
989 std::vector<uint32_t>
v;
1006 id_phi_module = id_phi_module + 32 * id_barrel_ec;
1010 for (u_int32_t
id :
it->second) {
1011 eformat::helper::SourceIdentifier sid(
id );
1012 v.push_back(sid.code());
1027 return (
a->RODGroup >
b->RODGroup );
1036 return (
a->Phi >
b->Phi );