31 #include "eformat/SourceIdentifier.h"
36 using eformat::helper::SourceIdentifier;
43 static const InterfaceID IID_ITRT_FillCablingData_SR1_ECC
44 (
"TRT_FillCablingData_SR1_ECC", 1, 0);
51 declareInterface< TRT_FillCablingData_SR1_ECC >(
this );
61 {
return IID_ITRT_FillCablingData_SR1_ECC; }
67 ATH_MSG_INFO(
"TRT_FillCablingData_SR1_ECC::initialize" );
74 return StatusCode::FAILURE;
86 ATH_MSG_INFO(
"TRT_FillCablingData_SR1_ECC::initializiation finished" );
88 return StatusCode::SUCCESS;
126 int tmpArray[] = {15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18,
127 18, 18, 18, 18, 19, 19, 19, 18,
128 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
129 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 23,
130 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26,
131 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28,
132 28, 29, 29, 29, 29, 28, -1};
136 while( -1 != tmpArray[
i] )
138 RunningCount += tmpArray[
i];
157 int moduleId, strawLayerId, strawInLayerId;
159 IdentifierHash hashId;
214 while ( getline( *
inputFile, thisLine ) )
216 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
218 string::size_type loc = thisLine.find(
'#' );
219 if ( loc != string::npos )
221 thisLine.replace( loc, thisLine.length(), 1,
' ' );
223 loc = thisLine.find_first_not_of(
" \t" );
224 if ( loc == string::npos )
228 istringstream
parse( thisLine );
230 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
239 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
241 bufferOffset = ((3 - rodgroup) * 444) + 14;
244 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
248 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
271 while ( getline( *
inputFile, thisLine ) )
273 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
275 string::size_type loc = thisLine.find(
'#' );
276 if ( loc != string::npos )
278 thisLine.replace( loc, thisLine.length(), 1,
' ' );
280 loc = thisLine.find_first_not_of(
" \t" );
281 if ( loc == string::npos )
285 istringstream
parse( thisLine );
287 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
296 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
298 bufferOffset = ((1 - rodgroup) * 444) + 14;
301 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
305 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
328 while ( getline( *
inputFile, thisLine ) )
330 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
332 string::size_type loc = thisLine.find(
'#' );
333 if ( loc != string::npos )
335 thisLine.replace( loc, thisLine.length(), 1,
' ' );
337 loc = thisLine.find_first_not_of(
" \t" );
338 if ( loc == string::npos )
342 istringstream
parse( thisLine );
344 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
353 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
355 bufferOffset = ((3 - rodgroup) * 444) + 14;
358 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
362 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
385 while ( getline( *
inputFile, thisLine ) )
387 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
389 string::size_type loc = thisLine.find(
'#' );
390 if ( loc != string::npos )
392 thisLine.replace( loc, thisLine.length(), 1,
' ' );
394 loc = thisLine.find_first_not_of(
" \t" );
395 if ( loc == string::npos )
399 istringstream
parse( thisLine );
401 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
410 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
412 bufferOffset = ((3 - rodgroup) * 444) + 14;
415 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
419 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
442 while ( getline( *
inputFile, thisLine ) )
444 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
446 string::size_type loc = thisLine.find(
'#' );
447 if ( loc != string::npos )
449 thisLine.replace( loc, thisLine.length(), 1,
' ' );
451 loc = thisLine.find_first_not_of(
" \t" );
452 if ( loc == string::npos )
456 istringstream
parse( thisLine );
458 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
467 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
469 bufferOffset = ((1 - rodgroup) * 444) + 14;
472 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
476 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
499 while ( getline( *
inputFile, thisLine ) )
501 int rodgroup, rodline, dtmchannel, strawlayer, strawnumber;
503 string::size_type loc = thisLine.find(
'#' );
504 if ( loc != string::npos )
506 thisLine.replace( loc, thisLine.length(), 1,
' ' );
508 loc = thisLine.find_first_not_of(
" \t" );
509 if ( loc == string::npos )
513 istringstream
parse( thisLine );
515 parse >> rodgroup >> rodline >> dtmchannel >> strawlayer >> strawnumber;
524 strawNumber = (strawlayer & 0xff) << 8 | (strawnumber & 0xff);
526 bufferOffset = ((3 - rodgroup) * 444) + 14;
529 bufferOffset += (25 - rodline) + ((dtmchannel) * 13);
533 bufferOffset += 222 + (12 - rodline) + ((dtmchannel) * 13);
547 dataFile =
"TRT_SR1_EndcapC_Cable_map.dat";
561 while ( getline( *
inputFile, thisLine ) )
563 if ( thisLine.length() == 0 )
566 string::size_type loc = thisLine.find(
'#' );
567 if ( loc != string::npos )
569 thisLine.replace( loc, thisLine.length(), 1,
' ' );
571 loc = thisLine.find_first_not_of(
" \t" );
572 if ( loc == string::npos )
577 istringstream
parse( thisLine );
586 if ( (srcId & 0xFF0000) == 0x310000 )
591 else if ( (srcId & 0xFF0000) == 0x320000 )
596 else if ( (srcId & 0xFF0000) == 0x330000 )
601 else if ( (srcId & 0xFF0000) == 0x340000 )
607 ATH_MSG_FATAL(
"TRT_FillCablingData_SR1_ECC: Invalid source id " << (hex) << srcId << (dec) );
622 int my_phi = my_map->
SubDet * 32 + my_map->
Phi;
642 for ( ptk_i=1; ptk_i<=444; ptk_i++ )
653 std::vector< GlobalCableMap_t *> GCM;
657 sort( GCM.begin(), GCM.end(), greater_RG_GCM );
659 int ConnectorCount=-1;
661 for (
it=GCM.begin();
it != GCM.end(); ++
it )
666 std::map<int, int> con_map;
669 if ( my_map->
FEid ==
"1BS_1BL" )
671 else if ( my_map->
FEid ==
"2BS_2BL1" )
673 else if ( my_map->
FEid ==
"2BL2_3BL1" )
675 else if ( my_map->
FEid ==
"3BL2" )
677 else if ( my_map->
FEid ==
"3BS" )
679 else if ( my_map->
FEid ==
"1FS_1FL" )
681 else if ( my_map->
FEid ==
"2FS_2FL1" )
683 else if ( my_map->
FEid ==
"2FL2_3FL1" )
685 else if ( my_map->
FEid ==
"3FL2" )
687 else if ( my_map->
FEid ==
"3FS" )
689 else if ( my_map->
FEid ==
"ec_rod1l" )
691 else if ( my_map->
FEid ==
"ec_rod2l" )
693 else if ( my_map->
FEid ==
"ec_rod3l" )
695 else if ( my_map->
FEid ==
"ec_rod1r" )
697 else if ( my_map->
FEid ==
"ec_rod2r" )
699 else if ( my_map->
FEid ==
"ec_rod3r" )
706 if ( abs( my_map->
SubDet ) == 1 )
708 for (
i=1;
i<=444;
i++ )
712 if ( map_it == con_map.end() )
715 i + ConnectorCount*444,
720 int BufferLocation = map_it->first + ConnectorCount*444;
721 int Straw = map_it->second - 1;
756 moduleId, strawLayerId,
769 my_map->
Phi, moduleId,
778 <<
" SubDet = " << my_map->
SubDet \
779 <<
" Phi = " << my_map->
Phi \
780 <<
" Module = " << moduleId \
781 <<
" Layer = " << strawLayerId \
782 <<
" StrInLay = " << strawInLayerId );
793 for (
i=0;
i<1776;
i++ )
797 if ( map_it == con_map.end() )
804 int BufferLocation =
i;
805 int Straw = map_it->second;
807 strawLayerId = (
Straw >> 8) & 0xff;
808 strawInLayerId =
Straw & 0xff;
810 moduleId = strawLayerId / 8;
813 moduleId = moduleId / 2;
814 strawLayerId = strawLayerId % 16;
818 moduleId = moduleId - 6;
819 strawLayerId = strawLayerId % 8;
824 moduleId, strawLayerId,
846 my_map->
Phi, moduleId,
855 <<
" SubDet = " << my_map->
SubDet \
856 <<
" Phi = " << my_map->
Phi \
857 <<
" Module = " << moduleId \
858 <<
" Layer = " << strawLayerId \
859 <<
" StrInLay = " << strawInLayerId );
889 std::vector<IdentifierHash> * vectID =
new std::vector<IdentifierHash>();
892 ATH_MSG_INFO(
"Adding Collid for ROB " << std::hex <<
pos->first << std::dec );
906 std::vector<IdentifierHash> &
ids)
909 IdentifierHash idHash;
914 eformat::helper::SourceIdentifier
id (rob_id);
922 ATH_MSG_FATAL(
"fillCollID: Unable to get CableMap for rob_id " << std::hex << rob_id << std::dec );
926 std::vector< GlobalCableMap_t *> GCM = map_it->second;
934 while (
it != GCM.end() )
939 int barrelId = my_map->
SubDet;
941 if ( abs( barrelId ) == 1 )
944 bool done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
945 while ( !done && (
it != GCM.end()) )
949 if ( (my_map->
FEid ==
"1BS_1BL") || (my_map->
FEid ==
"1FS_1FL") )
951 else if ( (my_map->
FEid ==
"2BS_2BL1") || (my_map->
FEid ==
"2FS_2FL1") )
953 else if ( (my_map->
FEid ==
"2BL2_3BL1") || (my_map->
FEid ==
"2FL2_3FL1") )
955 else if ( (my_map->
FEid ==
"3BL2") || (my_map->
FEid ==
"3BS") ||
956 (my_map->
FEid ==
"3FL2") || (my_map->
FEid ==
"3FS") )
961 if (
it != GCM.end() )
964 done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
974 if ( (ring == 0) && ((1<<ring) & rings) )
983 ids.push_back(idHash);
989 else if ( (ring == 1) && ((1<<ring) & rings) )
998 ids.push_back(idHash);
1004 else if ( (ring == 2) && ((1<<ring) & rings) )
1013 ids.push_back(idHash);
1031 bool done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
1032 while ( !done && (
it != GCM.end()) )
1035 if ( (my_map->
FEid ==
"ec_rod1l") ||
1036 (my_map->
FEid ==
"ec_rod1r") )
1043 else if ( (my_map->
FEid ==
"ec_rod2l") ||
1044 (my_map->
FEid ==
"ec_rod2r") )
1051 else if ( (my_map->
FEid ==
"ec_rod3l") ||
1052 (my_map->
FEid ==
"ec_rod3r") )
1061 ATH_MSG_ERROR(
"Invalid my_map->FEid. This should not happen!" );
1067 if (
it != GCM.end() )
1070 done = !((my_map->
SubDet == barrelId) && (my_map->
Phi ==
phi));
1076 for (
int wheel = StartWheel; wheel < EndWheel; wheel++ )
1085 ids.push_back(idHash);
1105 std::vector<uint32_t>
v;
1122 id_phi_module = id_phi_module + 32 * id_barrel_ec;
1127 eformat::helper::SourceIdentifier sid(
id );
1128 v.push_back(sid.code());
1143 return (
a->RODGroup >
b->RODGroup );
1152 return (
a->Phi >
b->Phi );