177{
179
180 int moduleId, strawLayerId, strawInLayerId;
181 Identifier strawID;
182 IdentifierHash hashId;
183
185 string thisLine;
186
187 std::string dataFile;
189
190
191
192
193
194
195
196
197
198
199 {
201
202 dataFile = "TRT_ROD05_Barrel_A_Map.dat";
205
207 {
208 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
209 }
210
211 for ( int ii=0; ii<(120*16); ii++ )
213
214 while ( getline( inputFile, thisLine ) )
215 {
216 int RodChannel, DtmChannel, strawnumber, HWaddr, GolNumber;
217 string Board;
218
219 string::size_type loc = thisLine.find( '#' );
220 if ( loc != string::npos )
221 {
222 thisLine.replace( loc, thisLine.length(), 1, ' ' );
223
224 loc = thisLine.find_first_not_of( " \t" );
225 if ( loc == string::npos )
226 continue;
227 }
228
229 istringstream
parse( thisLine );
230
231 parse >> RodChannel >> DtmChannel >> strawnumber >> HWaddr >> Board >> GolNumber;
232
233
234 bufferOffset = (120 * DtmChannel) + RodChannel;
235
237
238
239 }
240
242 }
243
244
245
246
247
248 {
250
251 dataFile = "TRT_ROD05_Barrel_C_Map.dat";
254
256 {
257 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
258 }
259
260 for ( int ii=0; ii<(120*16); ii++ )
262
263 while ( getline( inputFile, thisLine ) )
264 {
265 int RodChannel, DtmChannel, strawnumber, HWaddr, GolNumber;
266 string Board;
267
268 string::size_type loc = thisLine.find( '#' );
269 if ( loc != string::npos )
270 {
271 thisLine.replace( loc, thisLine.length(), 1, ' ' );
272
273 loc = thisLine.find_first_not_of( " \t" );
274 if ( loc == string::npos )
275 continue;
276 }
277
278 istringstream
parse( thisLine );
279
280 parse >> RodChannel >> DtmChannel >> strawnumber >> HWaddr >> Board >> GolNumber;
281
282
283 bufferOffset = (120 * DtmChannel) + RodChannel;
284
286 }
287
289 }
290
291
292
293
294
295
296
297
298
299
300
301
302 {
303
304
305
307
308 dataFile = "TRT_ROD05_ECA_LEFT.dat";
311
313 {
314 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
315 }
316
317 for ( int ii=0; ii<(16*120); ii++ )
318 {
321 }
322
323 while ( getline( inputFile, thisLine ) )
324 {
325 int wheel, dtmaddr, dtmchannel, zlayer, phistraw, rodhalf, strawNumber;
326
327
328 string::size_type loc = thisLine.find( '#' );
329 if ( loc != string::npos )
330 {
331 thisLine.replace( loc, thisLine.length(), 1, ' ' );
332
333 loc = thisLine.find_first_not_of( " \t" );
334 if ( loc == string::npos )
335 continue;
336 }
337
338 istringstream
parse( thisLine );
339
340 parse >> wheel >> dtmaddr >> dtmchannel >> zlayer >> phistraw
341 >> rodhalf >> bufferOffset;
342
343
344
345
346
347
348
349 strawNumber = (zlayer & 0xff) << 8 | (phistraw & 0xff);
350
351 if ( (rodhalf < 0) || (rodhalf > 1) )
352 {
354 std::abort();
355 }
356
357 if ( 0 == rodhalf )
359 else if ( 1 == rodhalf )
361
362
363 }
364
366 }
367
368
369
370 {
371
372
373
375
376 dataFile = "TRT_ROD05_ECA_RIGHT.dat";
379
381 {
382 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
383 }
384
385 for ( int ii=0; ii<(16*120); ii++ )
386 {
389 }
390
391 while ( getline( inputFile, thisLine ) )
392 {
393 int wheel, dtmaddr, dtmchannel, zlayer, phistraw, rodhalf, strawNumber;
394
395
396 string::size_type loc = thisLine.find( '#' );
397 if ( loc != string::npos )
398 {
399 thisLine.replace( loc, thisLine.length(), 1, ' ' );
400
401 loc = thisLine.find_first_not_of( " \t" );
402 if ( loc == string::npos )
403 continue;
404 }
405
406 istringstream
parse( thisLine );
407
408 parse >> wheel >> dtmaddr >> dtmchannel >> zlayer >> phistraw
409 >> rodhalf >> bufferOffset;
410
411
412
413
414
415
416
417 strawNumber = (zlayer & 0xff) << 8 | (phistraw & 0xff);
418
419 if ( 0 == rodhalf )
421 else if ( 1 == rodhalf )
423
424
425 }
426
428 }
429
430
431
432
433
434 {
435
436
437
439
440 dataFile = "TRT_ROD05_ECC_LEFT.dat";
443
445 {
446 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
447 }
448
449 for ( int ii=0; ii<(16*120); ii++ )
450 {
453 }
454
455 while ( getline( inputFile, thisLine ) )
456 {
457 int wheel, dtmaddr, dtmchannel, zlayer, phistraw, rodhalf, strawNumber;
458
459
460 string::size_type loc = thisLine.find( '#' );
461 if ( loc != string::npos )
462 {
463 thisLine.replace( loc, thisLine.length(), 1, ' ' );
464
465 loc = thisLine.find_first_not_of( " \t" );
466 if ( loc == string::npos )
467 continue;
468 }
469
470 istringstream
parse( thisLine );
471
472 parse >> wheel >> dtmaddr >> dtmchannel >> zlayer >> phistraw
473 >> rodhalf >> bufferOffset;
474
475
476
477
478
479
480
481 strawNumber = (zlayer & 0xff) << 8 | (phistraw & 0xff);
482
483 if ( (rodhalf < 0) || (rodhalf > 1) )
484 {
486 std::abort();
487 }
488
489 if ( 0 == rodhalf )
491 else if ( 1 == rodhalf )
493
494
495 }
496
498 }
499
500
501
502 {
503
504
505
507
508 dataFile = "TRT_ROD05_ECC_RIGHT.dat";
511
513 {
514 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
515 }
516
517 for ( int ii=0; ii<(16*120); ii++ )
518 {
521 }
522
523 while ( getline( inputFile, thisLine ) )
524 {
525 int wheel, dtmaddr, dtmchannel, zlayer, phistraw, rodhalf, strawNumber;
526
527
528 string::size_type loc = thisLine.find( '#' );
529 if ( loc != string::npos )
530 {
531 thisLine.replace( loc, thisLine.length(), 1, ' ' );
532
533 loc = thisLine.find_first_not_of( " \t" );
534 if ( loc == string::npos )
535 continue;
536 }
537
538 istringstream
parse( thisLine );
539
540 parse >> wheel >> dtmaddr >> dtmchannel >> zlayer >> phistraw
541 >> rodhalf >> bufferOffset;
542
543
544
545
546
547
548
549 strawNumber = (zlayer & 0xff) << 8 | (phistraw & 0xff);
550
551 if ( 0 == rodhalf )
553 else if ( 1 == rodhalf )
555
556
557 }
558
560 }
561
562
563
564
565
566
567
568
570
572 {
574
576
578
579
581
582 std::ifstream globalInputFile (
file.c_str() );
583
584 if (!globalInputFile.is_open())
585 {
586 ATH_MSG_FATAL(
"TRT_FillCablingData_DC3: Could not open file " << dataFile );
587 }
588
589
590 while ( !globalInputFile.eof() && !globalInputFile.fail() )
591 {
592 std::getline( globalInputFile, thisLine );
593
594 if ( !thisLine.empty() )
595 {
597
598 string::size_type loc = thisLine.find( '#' );
599 if ( loc != string::npos )
600 {
601 thisLine.replace( loc, thisLine.length(), 1, ' ' );
602
603 loc = thisLine.find_first_not_of( " \t" );
604 if ( loc == string::npos )
605 continue;
606 }
607
608 istringstream
parse( thisLine );
609
610 parse >> std::hex >> SourceId;
611
612 ATH_MSG_INFO(
"Including Source ID: " << hex << SourceId << dec );
613
615 }
616 }
617
618 globalInputFile.close();
619
620 }
621
622
623
624
625
626
627 Identifier NULLstrawID(0);
628 IdentifierHash NULLhashId(0);
629
630 int i_barrel;
632 int SourceBase;
633
634 for ( i_barrel=0; i_barrel<2; i_barrel++ )
635 {
636 std::map<int, int> con_map;
637
638 if ( 0 == i_barrel )
639 {
642 SourceBase = 0x310000;
643 }
644 else
645 {
648 SourceBase = 0x320000;
649 }
650
653 {
654 int rodId = SourceBase | ((
Phi+1) << 8);
655 int ii;
656 int strawNumber;
657
658 for ( ii=0; ii<(120*16); ii++ )
659 {
660 strawNumber = con_map[ii];
661
662 if ( strawNumber < 0 )
663 {
664 m_cabling->set_identifierForAllStraws( rodId, ii, NULLstrawID );
665 m_cabling->set_identifierHashForAllStraws( rodId, ii, NULLhashId );
666 continue;
667 }
668
669
670
671
672 strawLayerId = 0;
675 {
676 strawLayerId++;
677 }
678
680 {
681 ATH_MSG_WARNING(
"Invalid Straw in table (" <<
Phi <<
", " << ii <<
"): " << strawNumber );
682 continue;
683 }
684
686
687
688 moduleId = -1;
690 moduleId = 0;
692 {
693 moduleId = 1;
695 }
696 else if ( strawLayerId <
698 {
699 moduleId = 2;
701 }
702 else
704
705
706 strawID =
m_TRTHelper->straw_id( SubDet,
Phi, moduleId, strawLayerId, strawInLayerId );
707
708
709
710
711
712
713
714
715 m_cabling->set_identifierForAllStraws( rodId, ii, strawID );
716
717
718 Identifier Lid =
m_TRTHelper->layer_id( SubDet,
Phi, moduleId, strawLayerId );
719
721 if ( result != 0 )
722 {
726 << " SubDet = " << SubDet \
727 <<
" Phi = " <<
Phi \
728 << " Module = " << moduleId \
729 << " Layer = " << strawLayerId \
730 << " StrInLay = " << strawInLayerId );
731 }
732
733
734 m_cabling->set_identifierHashForAllStraws( rodId, ii, hashId );
735
736 }
737
738 }
739 }
740
741
742 int i_ec;
744
745 for ( i_ec=0; i_ec<2; i_ec++ )
746 {
747
748 if ( 0 == i_ec )
749 {
750
752 SourceBase = 0x330000;
753 }
754 else
755 {
756
758 SourceBase = 0x340000;
759 }
760
762 {
763 int j;
764 for ( j=0; j<2; j++ )
765 {
766 int my_Phi;
767 std::map< int, int > con_map;
768
769 if ( 2 == SubDet )
770 {
771
773
775 {
776 if ( 0 == j )
777 {
778 if ( my_Phi < 8 )
780 else if ( my_Phi < 16 )
782 else if ( my_Phi < 24 )
784 else if ( my_Phi < 32 )
786 }
787 else if ( 1 == j )
788 {
789 if ( my_Phi < 8 )
791 else if ( my_Phi < 16 )
793 else if ( my_Phi < 24 )
795 else if ( my_Phi < 32 )
797
798 }
799 }
800 else
801 {
802
803 if ( 0 == j )
804 {
805 if ( my_Phi < 8 )
807 else if ( my_Phi < 16 )
809 else if ( my_Phi < 24 )
811 else if ( my_Phi < 32 )
813 }
814 else if ( 1 == j )
815 {
816 if ( my_Phi < 8 )
818 else if ( my_Phi < 16 )
820 else if ( my_Phi < 24 )
822 else if ( my_Phi < 32 )
824 }
825
826 }
827 }
828 else
829 {
831
832 if ( 0 == j )
833 {
834 if ( my_Phi < 8 )
836 else if ( my_Phi < 16 )
838 else if ( my_Phi < 24 )
840 else if ( my_Phi < 32 )
842 }
843 else if ( 1 == j )
844 {
845 if ( my_Phi < 8 )
847 else if ( my_Phi < 16 )
849 else if ( my_Phi < 24 )
851 else if ( my_Phi < 32 )
853 }
854 }
855
856 int rodId = SourceBase | ((my_Phi+1) << 8) | (j+1);
857
859 for ( i=0;
i<(120*16);
i++ )
860 {
861
862 int BufferLocation =
i;
863 int StrawNumber = con_map[
i];
864
865 strawLayerId = (StrawNumber >> 8) & 0xff;
866 strawInLayerId = StrawNumber & 0xff;
867
869 {
870 strawInLayerId = 23 - strawInLayerId;
871 }
872
873
874 if ( (strawInLayerId < 0) || (strawInLayerId > 23 ) )
875 {
876 ATH_MSG_WARNING( i <<
" " << j <<
" " << my_Phi <<
" " << hex << StrawNumber );
877
878 std::abort();
879 }
880
881
883
884
885 moduleId = strawLayerId / 8;
886 if ( moduleId < 12 )
887 {
888 moduleId = moduleId / 2;
889 strawLayerId = strawLayerId % 16;
890
892 {
893
894 if ( strawLayerId < 8 )
895 strawLayerId = 7 - strawLayerId;
896 else
897 strawLayerId = 15 - (strawLayerId - 8);
898
899
900 strawInLayerId = 23 - strawInLayerId;
901 }
902 }
903 else
904 {
905 moduleId = moduleId - 6;
906 strawLayerId = strawLayerId % 8;
908 {
909 strawLayerId = 7 - strawLayerId;
910 strawInLayerId = 23 - strawInLayerId;
911 }
912 }
913
914
915
917 moduleId, strawLayerId,
918 strawInLayerId );
919
920
921 m_cabling->set_identifierForAllStraws( rodId, BufferLocation,
922 strawID );
923
924
925
926
927
928
930 my_Phi, moduleId,
931 strawLayerId );
932
934 if ( result != 0 )
935 {
937
939 " SubDet = " << SubDet \
940 << " Phi = " << my_Phi \
941 << " Module = " << moduleId \
942 << " Layer = " << strawLayerId \
943 << " StrInLay = " << strawInLayerId );
944 }
945
946
947 m_cabling->set_identifierHashForAllStraws( rodId,
948 BufferLocation,
949 hashId );
950 }
951 }
952 }
953 }
954
955
957
958 return;
959}
#define ATH_MSG_WARNING(x)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
std::map< int, int > m_eca_l0_map
std::map< int, int > m_ecc_r1_map
std::map< int, int > m_eca_r0_map
std::map< int, int > m_eca_l1_map
std::map< int, int > m_ecc_l0_map
std::map< int, int > m_eca_r1_map
std::map< int, int > m_barrel_c_map
int m_StrawLayerToRod[160]
std::map< int, int > m_barrel_a_map
std::set< uint32_t > m_validSourceIds
std::map< int, int > m_ecc_l1_map
std::map< int, int > m_ecc_r0_map
bool m_broken_FDR_Cabling