ATLAS Offline Software
Loading...
Searching...
No Matches
Tile_Base_ID.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
10
11
14#include "IdDict/IdDictField.h"
15#include "IdDict/IdDictGroup.h"
16#include "IdDict/IdDictMgr.h"
17#include "IdDict/IdDictRegion.h"
20#include "CxxUtils/StrFormat.h"
21
22#include <algorithm>
23#include <cassert>
24#include <cstdio>
25#include <iostream>
26#include <stdexcept>
27
29using namespace LArNeighbours;
30
31
32
33Tile_Base_ID::Tile_Base_ID (const std::string& name,
34 const std::string& group,
35 bool supercell)
37 , m_supercell (supercell ? 1 : 0)
39 , m_SYSTEM_INDEX(999)
40 , m_SECTION_INDEX(999)
41 , m_SIDE_INDEX(999)
42 , m_MODULE_INDEX(999)
43 , m_TOWER_INDEX(999)
44 , m_SAMPLE_INDEX(999)
45 , m_PMT_INDEX(999)
46 , m_ADC_INDEX(999)
47{
48}
49
50//
51// Tile_Base_ID methods
52//
53std::string
54Tile_Base_ID::to_string( const Identifier & id, int level ) const
55{
56 IdContext context;
57 switch (level) {
58 case 1: case -6:
59 case 2: case -5: context = region_context(); break;
60 case 3: case -4: context = module_context(); break;
61 case 4: case -3: context = tower_context(); break;
62 case 5: case -2: context = cell_context(); break;
63 case 6: case -1: context = pmt_context(); break;
64 case 7: case 0: context = adc_context(); break;
65 default:
66 return "Tile_Base_ID::to_string - unknown context";
67 }
68
69 ExpandedIdentifier exp_id;
70 if ( get_expanded_id(id,exp_id,&context) ) {
71 return "Tile_Base_ID::to_string - can not expand ID";
72 } else {
73 return (std::string)(exp_id);
74 }
75}
76
77std::string
78Tile_Base_ID::to_string( const IdentifierHash & hash_id, int level ) const
79{
80 IdContext context;
81 switch (level) {
82 case 1: case -6:
83 case 2: case -5: context = region_context(); break;
84 case 3: case -4: context = module_context(); break;
85 case 4: case -3: context = tower_context(); break;
86 case 5: case -2: context = cell_context(); break;
87 case 6: case -1: context = pmt_context(); break;
88 case 7: case 0: context = adc_context(); break;
89 default:
90 return "Tile_Base_ID::to_string - unknown context";
91 }
92
93 Identifier id;
94 if ( get_id ( hash_id, id, &context ) == 0 ) {
95 ExpandedIdentifier exp_id;
96 if ( get_expanded_id(id,exp_id,&context) ) {
97 return "Tile_Base_ID::to_string - can not expand ID";
98 } else {
99 return (std::string)(exp_id);
100 }
101 } else {
102 return "Tile_Base_ID::to_string - can not get ID from hash_id";
103 }
104}
105
106//
107// get methods
108//
109int
111{
112 int field = 0;
113 if(!dict()->unpack(id, 0, index, m_tile_region_index, field)) {
114 return field;
115 } else {
116 return 0;
117 }
118}
119
120int
122{
123 IdentifierHash hash_id;
124 IdContext context = region_context();
125
126 get_hash(region_id(section,side),hash_id,&context);
127
128 return (int)hash_id;
129}
130
131int
133{
134 IdentifierHash hash_id;
135 IdContext context = region_context();
136
137 get_hash(region_id(id),hash_id,&context);
138
139 return (int)hash_id;
140}
141
142int
144{
145 return get_field(id,m_SYSTEM_INDEX);
146}
147
148int
150{
152}
153
154int
155Tile_Base_ID::side ( const Identifier & id ) const
156{
157 return get_field(id,m_SIDE_INDEX);
158}
159
160int
161Tile_Base_ID::module ( const Identifier & id ) const
162{
163 return get_field(id,m_MODULE_INDEX);
164}
165
166int
167Tile_Base_ID::tower ( const Identifier & id ) const
168{
169 return get_field(id,m_TOWER_INDEX);
170}
171
172int
174{
175 if ( section(id) == Tile_Base_ID::AUXDET )
177 else
178 return get_field(id,m_SAMPLE_INDEX);
179}
180
181int
182Tile_Base_ID::pmt ( const Identifier & id ) const
183{
184 return get_field(id,m_PMT_INDEX);
185}
186
187int
188Tile_Base_ID::adc ( const Identifier & id ) const
189{
190 return get_field(id,m_ADC_INDEX);
191}
192
193//
194// check methods
195//
196/*
197bool
198Tile_Base_ID::is_tile (const Identifier& id) const
199{
200 bool result = ( system(id) == tile_field_value() );
201
202 return result;
203}
204*/
205
206bool
208{
209 bool result = is_tile(id)
210 && ( section(id) == Tile_Base_ID::BARREL );
211
212 return result;
213}
214
215bool
217{
218 bool result = is_tile(id)
219 && ( section(id) == Tile_Base_ID::EXTBAR );
220
221 return result;
222}
223
224bool
226{
227 bool result = is_tile(id)
228 && ( section(id) == Tile_Base_ID::GAPDET );
229
230 return result;
231}
232
233bool
235{
236 bool result = is_tile(id)
237 && ( section(id) == Tile_Base_ID::AUXDET );
238
239 return result;
240}
241
242bool
244{
245 bool result = is_tile(id)
246 && ( side(id) == Tile_Base_ID::NEGATIVE );
247
248 return result;
249}
250
251bool
253{
254 bool result = is_tile(id)
255 && ( side(id) == Tile_Base_ID::POSITIVE );
256
257 return result;
258}
259
260bool
262{
263 bool result = is_tile(id)
264 && ( side(id) == 0 );
265
266 return result;
267}
268
269bool
271{
272 bool result = is_tile(id)
273 && ( sample(id) == Tile_Base_ID::SAMP_E );
274
275 return result;
276}
277
278bool
280{
281 bool result = is_tile(id)
282 && ( adc(id) == Tile_Base_ID::LOWGAIN );
283
284 return result;
285}
286
287bool
289{
290 bool result = is_tile(id)
291 && ( adc(id) == Tile_Base_ID::HIGHGAIN );
292
293 return result;
294}
295
297{
298 return is_tile(id) && (get_field(id,m_SECTION_INDEX) & SUPERCELL_MASK);
299}
300
301// Whole TileCal
304{
306
307 int id[8];
309
310 Identifier compactId(0);
311 if (!dict()->pack32(id, 0, m_SYSTEM_INDEX, m_tile_region_index, compactId)) {
312 result = compactId;
313 }
314
315 return result;
316}
317
318// For Tile Barrel ID
321{
323
324 int id[8];
327
328 Identifier compactId(0);
329 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
330 result = compactId;
331 }
332
333 return result;
334}
335
336// For Tile Extended Barrel ID
339{
341
342 int id[8];
345
346 Identifier compactId(0);
347 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
348 result = compactId;
349 }
350
351 return result;
352}
353
354
355// For Tile Gap Scintillator ID
358{
360
361 assert (!m_supercell);
362 int id[8];
365
366 Identifier compactId(0);
367 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
368 result = compactId;
369 }
370
371 return result;
372}
373
374// For any Tilecal section
376Tile_Base_ID::tile_det ( int section, bool checks ) const
377{
378 if(checks) {
379 // Check that id is within allowed range
380 // Fill expanded id
382 expId << encode_section (section) ;
383 }
384
386
387 int id[8];
390
391 Identifier compactId(0);
392 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
393 result = compactId;
394 }
395
396 return result;
397}
398
401{
402 return tile_det (section, do_checks());
403}
404
405// single region, module, tower, cell, pmt, adc identifiers
408{
410 IdentifierHash hash_id = index;
411 IdContext context = region_context();
412
413 get_id(hash_id,result,&context);
414
415 return result;
416}
417
419Tile_Base_ID::region_id ( int section, int side, bool checks ) const
420{
421 if(checks) {
422
423 // Check that id is within allowed range
424
425 // Fill expanded id
427 expId << encode_section (section) << side;
428
429 if (!m_full_region_range.match(expId)) {
430 std::string errorMessage = "Tile_Base_ID::region_id() result is not OK: ID, range = "
431 + std::string(expId) + " , " + (std::string)m_full_region_range;
432 throw TileID_Exception(errorMessage , 1);
433 }
434 }
435
437
438 int id[8];
441 id[m_SIDE_INDEX] = side;
442
443 Identifier compactId(0);
444 if (!dict()->pack32(id, 0, m_SIDE_INDEX, m_tile_region_index, compactId)) {
445 result = compactId;
446 }
447
448 return result;
449}
450
453{
454 return region_id (section, side, do_checks());
455}
456
457
459Tile_Base_ID::region_id ( const Identifier& any_id ) const
460{
462 // extract with the dictionary
463 Identifier id;
464 if(!dict()->copy(any_id, 0, 0, m_SIDE_INDEX, m_tile_region_index, id)) {
465 result = id;
466 }
467 return (result);
468}
469
472 int module,
473 bool checks ) const
474{
475 if(checks) {
476
477 // Check that id is within allowed range
478
479 // Fill expanded id
481 expId << encode_section (section) << side << module;
482
483 if (!m_full_module_range.match(expId)) {
484 std::string errorMessage = "Tile_Base_ID::module_id() result is not OK: ID, range = "
485 + std::string(expId) + " , " + (std::string)m_full_region_range;
486 throw TileID_Exception(errorMessage , 1);
487 }
488 }
489
491
492 int id[8];
495 id[m_SIDE_INDEX] = side;
496 id[m_MODULE_INDEX] = module;
497
498 Identifier compactId(0);
499 if (!dict()->pack32(id, 0, m_MODULE_INDEX, m_tile_region_index, compactId)) {
500 result = compactId;
501 }
502
503 return result;
504}
505
508 int module ) const
509{
510 return module_id (section, side, module, do_checks());
511}
512
513
515Tile_Base_ID::module_id ( const Identifier& any_id ) const
516{
518 // extract with the dictionary
519 Identifier id;
520 if(!dict()->copy(any_id, 0, 0, m_MODULE_INDEX, m_tile_region_index, id)) {
521 result = id;
522 }
523 return (result);
524}
525
528 int module, int tower,
529 bool checks) const
530{
531 if(checks) {
532
533 // Check that id is within allowed range
534
535 // Fill expanded id
537 expId << encode_section (section) << side << module << tower;
538
539 if (!m_full_tower_range.match(expId)) {
540 std::string errorMessage = "Tile_Base_ID::tower_id() result is not OK: ID, range = "
541 + std::string(expId) + " , " + (std::string)m_full_region_range;
542 throw TileID_Exception(errorMessage , 1);
543 }
544 }
545
547
548 int id[8];
551 id[m_SIDE_INDEX] = side;
552 id[m_MODULE_INDEX] = module;
553 id[m_TOWER_INDEX] = tower;
554
555 Identifier compactId(0);
556 if (!dict()->pack32(id, 0, m_TOWER_INDEX, m_tile_region_index, compactId)) {
557 result = compactId;
558 }
559
560 return result;
561}
562
565 int module, int tower) const
566{
567 return tower_id (section, side, module, tower, do_checks());
568}
569
571Tile_Base_ID::tower_id ( const Identifier& any_id ) const
572{
574 // extract with the dictionary
575 Identifier id;
576 if(!dict()->copy(any_id, 0, 0, m_TOWER_INDEX, m_tile_region_index, id)) {
577 result = id;
578 }
579 return (result);
580}
581
583Tile_Base_ID::cell_id ( const Identifier & any_id ) const
584{
586 // extract with the dictionary
587 Identifier id;
588 if(!dict()->copy(any_id, 0, 0, m_SAMPLE_INDEX, m_tile_region_index, id)) {
589 result = id;
590 }
591 return (result);
592}
593
596 int module, int tower,
597 int sample,
598 bool checks ) const
599{
600 if(checks) {
601
602 // Check that id is within allowed range
603
604 // Fill expanded id
606 expId << encode_section (section) << side << module << tower << sample;
607
608 if (!m_full_cell_range.match(expId)) {
609 std::string errorMessage = "Tile_Base_ID::cell_id() result is not OK: ID, range = "
610 + std::string(expId) + " , " + (std::string)m_full_cell_range;
611 throw TileID_Exception(errorMessage , 1);
612 }
613 }
614
616
617 int id[8];
620 id[m_SIDE_INDEX] = side;
621 id[m_MODULE_INDEX] = module;
622 id[m_TOWER_INDEX] = tower;
624
625 Identifier compactId(0);
626 if (!dict()->pack32(id, 0, m_SAMPLE_INDEX, m_tile_region_index, compactId)) {
627 result = compactId;
628 }
629
630 return result;
631}
632
635 int module, int tower,
636 int sample ) const
637{
638 return cell_id (section, side, module, tower, sample, do_checks());
639}
640
642Tile_Base_ID::pmt_id ( const Identifier & any_id ) const
643{
645 // extract with the dictionary
646 Identifier id;
647 if(!dict()->copy(any_id, 0, 0, m_PMT_INDEX, m_tile_region_index, id)) {
648 result = id;
649 }
650 return (result);
651}
652
655 int pmt, bool checks ) const
656{
658
659 int id[8];
660 id[0] = pmt;
661
662 Identifier compactId(cell_id);
663 if (!dict()->pack32(id, m_PMT_INDEX, m_PMT_INDEX, m_tile_region_index, compactId)) {
664 result = compactId;
665 }
666 else {
667 std::string errorMessage = "Tile_Base_ID::pmt_id(cell_id,pmt) could not pack ID: "
668 + cell_id.getString() ;
669 throw TileID_Exception(errorMessage , 1);
670 }
671
672 if(checks) {
673
674 // Check that id is within allowed range
675
676 // Fill expanded id
677 ExpandedIdentifier expId;
678
679 IdContext context = cell_context();
680 if (get_expanded_id(result, expId, &context)) {
681 std::string errorMessage = "Tile_Base_ID::pmt_id(cell_id,pmt) result is not OK: ID = "
682 + result.getString() ;
683 throw TileID_Exception(errorMessage , 1);
684
685 // region_id.show();
686 }
687
688 expId << pmt;
689
690 if (!m_full_pmt_range.match(expId)) {
691 std::string errorMessage = "Tile_Base_ID::pmt_id() result is not OK: ID, range = "
692 + std::string(expId) + " , " + (std::string)m_full_region_range;
693 throw TileID_Exception(errorMessage , 1);
694 }
695 }
696
697 return result;
698}
699
702 int pmt ) const
703{
704 return pmt_id (cell_id, pmt, do_checks());
705}
706
709 int module, int tower,
710 int sample, int pmt,
711 bool checks) const
712{
713 if(checks) {
714
715 // Check that id is within allowed range
716
717 // Fill expanded id
719 expId << encode_section (section) << side << module << tower << sample << pmt;
720
721 if (!m_full_pmt_range.match(expId)) {
722 std::string errorMessage = "Tile_Base_ID::pmt_id() result is not OK: ID, range = "
723 + std::string(expId) + " , " + (std::string)m_full_region_range;
724 throw TileID_Exception(errorMessage , 1);
725 }
726 }
727
729
730 int id[8];
733 id[m_SIDE_INDEX] = side;
734 id[m_MODULE_INDEX] = module;
735 id[m_TOWER_INDEX] = tower;
737 id[m_PMT_INDEX] = pmt;
738
739 Identifier compactId(0);
740 if (!dict()->pack32(id, 0, m_PMT_INDEX, m_tile_region_index, compactId)) {
741 result = compactId;
742 }
743
744 return result;
745}
746
749 int module, int tower,
750 int sample, int pmt) const
751{
752 return pmt_id (section, side, module, tower, sample, pmt, do_checks());
753}
754
757 int pmt, int adc, bool checks ) const
758{
760
761 int id[8];
762 id[0] = pmt;
763 id[1] = adc;
764
765 Identifier compactId(cell_id);
766 if (!dict()->pack32(id, m_PMT_INDEX, m_ADC_INDEX, m_tile_region_index, compactId)) {
767 result = compactId;
768 }
769 else {
770 std::string errorMessage = "Tile_Base_ID::adc_id(cell_id,pmt,adc) could not pack ID: "
771 + cell_id.getString() ;
772 throw TileID_Exception(errorMessage , 1);
773 }
774
775 if(checks) {
776
777 // Check that id is within allowed range
778
779 // Fill expanded id
780 ExpandedIdentifier expId;
781
782 IdContext context = cell_context();
783 if (get_expanded_id(result, expId, &context)) {
784 std::string errorMessage = "Tile_Base_ID::adc_id(cell_id,pmt,adc) result is not OK: ID = "
785 + result.getString() ;
786 throw TileID_Exception(errorMessage , 1);
787
788 // region_id.show();
789 }
790
791 expId << pmt << adc;
792
793 if (!m_full_adc_range.match(expId)) {
794 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
795 + std::string(expId) + " , " + (std::string)m_full_region_range;
796 throw TileID_Exception(errorMessage , 1);
797 }
798 }
799
800 return result;
801}
802
805 int pmt, int adc ) const
806{
807 return adc_id (cell_id, pmt, adc, do_checks());
808}
809
812 int adc, bool checks ) const
813{
815
816 int id[8];
817 id[0] = adc;
818
819 Identifier compactId(pmt_id);
820 if (!dict()->pack32(id, m_ADC_INDEX, m_ADC_INDEX, m_tile_region_index, compactId)) {
821 result = compactId;
822 }
823 else {
824 std::string errorMessage = "Tile_Base_ID::adc_id(pmt_id,adc) could not pack ID: "
825 + pmt_id.getString() ;
826 throw TileID_Exception(errorMessage , 1);
827 }
828
829 if(checks) {
830
831 // Check that id is within allowed range
832
833 // Fill expanded id
834 ExpandedIdentifier expId;
835
836 IdContext context = pmt_context();
837 if (get_expanded_id(result, expId, &context)) {
838 std::string errorMessage = "Tile_Base_ID::adc_id(pmt_id,adc) result is not OK: ID = "
839 + result.getString() ;
840 throw TileID_Exception(errorMessage , 1);
841
842 // region_id.show();
843 }
844
845 expId << adc;
846
847 if (!m_full_adc_range.match(expId)) {
848 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
849 + std::string(expId) + " , " + (std::string)m_full_region_range;
850 throw TileID_Exception(errorMessage , 1);
851 }
852 }
853
854 return result;
855}
856
859 int adc ) const
860{
861 return adc_id (pmt_id, adc, do_checks());
862}
863
866 int module, int tower, int sample,
867 int pmt, int adc,
868 bool checks) const
869{
870 if(checks) {
871
872 // Check that id is within allowed range
873
874 // Fill expanded id
876 expId << encode_section (section) << side << module << tower << sample << pmt << adc;
877
878 if (!m_full_adc_range.match(expId)) {
879 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
880 + std::string(expId) + " , " + (std::string)m_full_region_range;
881 throw TileID_Exception(errorMessage , 1);
882 }
883 }
884
886
887 int id[8];
890 id[m_SIDE_INDEX] = side;
891 id[m_MODULE_INDEX] = module;
892 id[m_TOWER_INDEX] = tower;
894 id[m_PMT_INDEX] = pmt;
895 id[m_ADC_INDEX] = adc;
896
897 Identifier compactId(0);
898 if (!dict()->pack32(id, 0, m_ADC_INDEX, m_tile_region_index, compactId)) {
899 result = compactId;
900 }
901
902 return result;
903}
904
907 int module, int tower, int sample,
908 int pmt, int adc) const
909{
910 return adc_id (section, side, module, tower, sample, pmt, adc, do_checks());
911}
912
914 int module, Identifier& module_id ) const
915{
917 IdContext context = region_context();
918 get_expanded_id(region_id, id, &context);
919 id << module;
920 if (!m_full_module_range.match(id)) {
921 return false;
922 }
923
924 Identifier compactId(0);
925 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
926 module_id = compactId;
927 }
928 return true;
929}
930
932 int module, int tower, Identifier& tower_id ) const
933{
935 IdContext context = region_context();
936 get_expanded_id(region_id, id, &context);
937 id << module << tower;
938 if (!m_full_tower_range.match(id)) {
939 return false;
940 }
941
942 Identifier compactId(0);
943 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
944 tower_id = compactId;
945 }
946 return true;
947}
948
950 int module, int tower, int sample,
951 Identifier& cell_id ) const
952{
954 IdContext context = region_context();
955 get_expanded_id(region_id, id, &context);
956 id << module << tower << sample;
957 if (!m_full_cell_range.match(id)) {
958 return false;
959 }
960
961 Identifier compactId(0);
962 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
963 cell_id = compactId;
964 }
965 return true;
966}
967
969 int pmt, Identifier& pmt_id ) const
970{
972 IdContext context = cell_context();
973 get_expanded_id(cell_id, id, &context);
974 id << pmt;
975 if (!m_full_pmt_range.match(id)) {
976 return false;
977 }
978
979 Identifier compactId(0);
980 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
981 pmt_id = compactId;
982 }
983 return true;
984}
985
987 int adc, Identifier& adc_id ) const
988{
990 IdContext context = pmt_context();
991 get_expanded_id(pmt_id, id, &context);
992 id << adc;
993 if (!m_full_adc_range.match(id)) {
994 return false;
995 }
996
997 Identifier compactId(0);
998 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
999 adc_id = compactId;
1000 }
1001 return true;
1002}
1003
1005 int pmt, int adc, Identifier& adc_id ) const
1006{
1008 IdContext context = cell_context();
1009 get_expanded_id(cell_id, id, &context);
1010 id << pmt << adc;
1011 if (!m_full_adc_range.match(id)) {
1012 return false;
1013 }
1014
1015 Identifier compactId(0);
1016 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
1017 adc_id = compactId;
1018 }
1019 return true;
1020}
1021
1023{
1024 if (hash_id < channels().hash_max()) {
1025 return channel_id (hash_id);
1026 } else {
1027 std::string errorMessage = "Tile_Base_ID::cell_id(hash_id) - hash_id out of range ";
1028 throw TileID_Exception(errorMessage , 1);
1029 }
1030}
1031
1033{
1034 IdentifierHash ret = 0;
1035 if (channels().get_hash (id, ret) == 0)
1036 return ret;
1037
1038 std::string errorMessage = "Tile_Base_ID::cell_hash(cell_id) - cell_id out of range ";
1039 throw TileID_Exception(errorMessage , 1);
1040}
1041
1042IdContext
1044{
1045 return {0, m_SIDE_INDEX};
1046}
1047
1048IdContext
1050{
1051 return {0, m_MODULE_INDEX};
1052}
1053
1054IdContext
1056{
1057 return {0, m_TOWER_INDEX};
1058}
1059
1060IdContext
1062{
1063 return {0, m_SAMPLE_INDEX};
1064}
1065
1066IdContext
1068{
1069 return {0, m_PMT_INDEX};
1070}
1071
1072IdContext
1074{
1075 return {0, m_ADC_INDEX};
1076}
1077
1078int
1080 Identifier& id,
1081 const IdContext* context ) const
1082{
1083 int result = 1;
1084 id.clear();
1085
1086 size_t begin = (context) ? context->begin_index(): 0;
1087 // cannot get hash if end is 0:
1088 size_t end = (context) ? context->end_index() : 0;
1089
1090 if (0 == begin) {
1091
1092 if ( m_ADC_INDEX == end ) {
1093 if (hash_id < m_adcs.hash_max()) {
1094 id = m_adcs.id (hash_id);
1095 result = 0;
1096 } else {
1097 ATH_MSG_ERROR("get_id: adc hash_id is out of range " << hash_id
1098 << " > " << m_adcs.hash_max());
1099 }
1100 } else if ( m_PMT_INDEX == end ) {
1101 if (hash_id < m_pmts.hash_max()) {
1102 id = m_pmts.id (hash_id);
1103 result = 0;
1104 } else {
1105 ATH_MSG_ERROR("get_id: pmt hash_id is out of range " << hash_id
1106 << " >= " << m_pmts.hash_max());
1107 }
1108 } else if ( m_SAMPLE_INDEX == end ) {
1109 if (hash_id < channels().hash_max()) {
1110 id = channels().id (hash_id);
1111 result = 0;
1112 } else {
1113 ATH_MSG_ERROR("get_id: cell hash_id is out of range " << hash_id
1114 << " >= " << channels().hash_max());
1115 }
1116 } else if ( m_TOWER_INDEX == end ) {
1117 if (hash_id < m_towers.hash_max()) {
1118 id = m_towers.id (hash_id);
1119 result = 0;
1120 } else {
1121 ATH_MSG_ERROR("get_id: tower hash_id is out of range " << hash_id
1122 << " >= " << m_towers.hash_max());
1123 }
1124 } else if ( m_MODULE_INDEX == end ) {
1125 if (hash_id < m_modules.hash_max()) {
1126 id = m_modules.id (hash_id);
1127 result = 0;
1128 } else {
1129 ATH_MSG_ERROR("get_id: module hash_id is out of range " << hash_id
1130 << " >= " << m_modules.hash_max());
1131 }
1132 } else if ( m_SIDE_INDEX == end ) {
1133 if (hash_id < regions().hash_max()) {
1134 id = regions().id (hash_id);
1135 result = 0;
1136 } else {
1137 ATH_MSG_ERROR("get_id: region hash_id is out of range " << hash_id
1138 << " >= " << regions().hash_max());
1139 }
1140 }
1141 }
1142 return(result);
1143}
1144
1145
1146int
1148 IdentifierHash& hash_id,
1149 const IdContext* context ) const
1150{
1151 hash_id = 0;
1152 int result = 1;
1153
1154 size_t begin = (context) ? context->begin_index(): 0;
1155 size_t end = (context) ? context->end_index() : 0;
1156
1157 if (0 == begin) {
1158 if ( m_ADC_INDEX == end ) {
1159 result = m_adcs.get_hash (id, hash_id);
1160 } else if ( m_PMT_INDEX == end ) {
1161 result = m_pmts.get_hash (pmt_id(id), hash_id);
1162 } else if ( m_SAMPLE_INDEX == end ) {
1163 result = channels().get_hash (cell_id(id), hash_id);
1164 } else if ( m_TOWER_INDEX == end ) {
1165 result = m_towers.get_hash (tower_id(id), hash_id);
1166 } else if ( m_MODULE_INDEX == end ) {
1167 result = m_modules.get_hash (module_id(id), hash_id);
1168 } else if ( m_SIDE_INDEX == end ) {
1169 result = regions().get_hash (region_id(id), hash_id);
1170 }
1171 }
1172
1173 return (result);
1174}
1175
1176int
1178 const std::string& group_name)
1179{
1180 ATH_MSG_DEBUG("initialize_base_from_dictionary ");
1181
1182 // Check whether this helper should be reinitialized
1183 if (!reinitialize(dict_mgr)) {
1184 ATH_MSG_DEBUG("Request to reinitialize not satisfied - tags have not changed");
1185 return (0);
1186 }
1187 else {
1188 ATH_MSG_DEBUG("(Re)initialize");
1189 }
1190
1191 ATH_MSG_DEBUG("calling base initialize_base_from_dictionary");
1192
1193 // init base object
1195 "TileCalorimeter"))
1196 return (1);
1197
1198 // Initialize the field indices
1199 if(initLevelsFromDict (group_name)) return (1);
1200
1201
1202 // Find value for the field Tile Calorimeter
1203 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
1204 int tileField = -1;
1205 if (atlasDict->get_label_value("subdet", "TileCalorimeter", tileField)) {
1206 ATH_MSG_ERROR("Could not get value for label 'TileCalorimeter' of field 'subdet' in dictionary "
1207 << atlasDict->name());
1208 return (1);
1209 }
1210
1211 // Set up id for region and range prefix
1212 ExpandedIdentifier tile_id;
1213 tile_id.add(tileField);
1214 ExpandedIdentifier reg_id = tile_id;
1215 Range prefix;
1216
1217 m_full_adc_range = dict()->build_multirange(reg_id, group_name, prefix, "adc");
1218 m_full_pmt_range = dict()->build_multirange(reg_id, group_name, prefix, "pmt");
1219 m_full_cell_range = dict()->build_multirange(reg_id, group_name, prefix, "sampling");
1220 m_full_tower_range = dict()->build_multirange(reg_id, group_name, prefix, "tower");
1221 m_full_module_range = dict()->build_multirange(reg_id, group_name, prefix, "module");
1222 m_full_region_range = dict()->build_multirange(reg_id, group_name, prefix, "side");
1223
1224 // Find value for the field Tile Online
1225 int tilehwField = -1;
1226 if (dict()->get_label_value("section", "Online", tilehwField)) {
1227 ATH_MSG_ERROR("Could not get value for label 'Online' of field 'section' in dictionary "
1228 << dict()->name());
1229 } else {
1230 // remove online ID from all ranges
1231 reg_id = tile_id;
1232 reg_id.add(tilehwField);
1233 m_full_adc_range.remove_range(reg_id);
1234 m_full_pmt_range.remove_range(reg_id);
1235 m_full_cell_range.remove_range(reg_id);
1236 m_full_tower_range.remove_range(reg_id);
1237 m_full_module_range.remove_range(reg_id);
1238 m_full_region_range.remove_range(reg_id);
1239 }
1240
1241 // Find value for the field Tile Testbeam
1242 int tiletbField = -1;
1243 if (dict()->get_label_value("section", "Testbeam", tiletbField)) {
1244 ATH_MSG_ERROR("Could not get value for label 'Testbeam' of field 'section' in dictionary "
1245 << dict()->name());
1246 } else {
1247 // remove testbeam ID from all ranges
1248 reg_id = std::move(tile_id);
1249 reg_id.add(tiletbField);
1250 m_full_adc_range.remove_range(reg_id);
1251 m_full_pmt_range.remove_range(reg_id);
1252 m_full_cell_range.remove_range(reg_id);
1253 m_full_tower_range.remove_range(reg_id);
1254 m_full_module_range.remove_range(reg_id);
1255 m_full_region_range.remove_range(reg_id);
1256 }
1257
1258 ATH_MSG_DEBUG("initialize_from_dict :");
1259 ATH_MSG_DEBUG(" region range -> " << (std::string)m_full_region_range);
1260 ATH_MSG_DEBUG(" module range -> " << (std::string)m_full_module_range);
1261 ATH_MSG_DEBUG(" tower range -> " << (std::string)m_full_tower_range );
1262 ATH_MSG_DEBUG(" cell range -> " << (std::string)m_full_cell_range );
1263 ATH_MSG_DEBUG(" pmt range -> " << (std::string)m_full_pmt_range );
1264 ATH_MSG_DEBUG(" adc range -> " << (std::string)m_full_adc_range );
1265
1266 // Setup the hash tables
1267 if(init_hashes()) return (1);
1268
1269 // Setup hash tables for finding neighbors
1270 if(m_do_neighbours) {
1271 // temporary workaround to get the super_cell neighbor file directly
1272 // instead of from the db. In the long term the file name should
1273 // come from the db as well
1274 std::string neighbourFile;
1275 if ( m_supercell ) {
1276 neighbourFile = "TileSuperCellNeighbour.txt";
1277 }
1278 else {
1279 neighbourFile = dict_mgr.find_metadata("TILENEIGHBORS");
1280 }
1281 if (neighbourFile.empty()) throw std::runtime_error("TileID: Cannot find the Tile Neighbour file name");
1282 if(m_neighbour.initialize(this, neighbourFile)) return (1);
1283 }
1284
1285 return 0;
1286}
1287
1292
1294{
1295 return m_modules.hash_max();
1296}
1297
1299{
1300 return m_towers.hash_max();
1301}
1302
1307
1309{
1310 return m_pmts.hash_max();
1311}
1312
1314{
1315 return m_adcs.hash_max();
1316}
1317
1322
1324{
1325 return regions().end();
1326}
1327
1332
1334{
1335 return m_modules.begin();
1336}
1337
1339{
1340 return m_modules.end();
1341}
1342
1344{
1345 return m_modules.range();
1346}
1347
1349{
1350 return m_towers.begin();
1351}
1352
1354{
1355 return m_towers.end();
1356}
1357
1359{
1360 return m_towers.range();
1361}
1362
1367
1369{
1370 return channels().end();
1371}
1372
1377
1379{
1380 return m_pmts.begin();
1381}
1382
1384{
1385 return m_pmts.end();
1386}
1387
1389{
1390 return m_pmts.range();
1391}
1392
1394{
1395 return m_adcs.begin();
1396}
1397
1399{
1400 return m_adcs.end();
1401}
1402
1404{
1405 return m_adcs.range();
1406}
1407
1408const std::vector<Identifier>& Tile_Base_ID::region_ids() const
1409{
1410 return regions().ids();
1411}
1412
1413const std::vector<Identifier>& Tile_Base_ID::module_ids() const
1414{
1415 return m_modules.ids();
1416}
1417
1418const std::vector<Identifier>& Tile_Base_ID::tower_ids() const
1419{
1420 return m_towers.ids();
1421}
1422
1423const std::vector<Identifier>& Tile_Base_ID::cell_ids() const
1424{
1425 return channels().ids();
1426}
1427
1428const std::vector<Identifier>& Tile_Base_ID::pmt_ids() const
1429{
1430 return m_pmts.ids();
1431}
1432
1433const std::vector<Identifier>& Tile_Base_ID::adc_ids() const
1434{
1435 return m_adcs.ids();
1436}
1437
1438
1440{
1441 return this->region_id (exp_id[m_SECTION_INDEX],
1442 exp_id[m_SIDE_INDEX]);
1443}
1444
1446{
1447 return this->module_id (exp_id[m_SECTION_INDEX],
1448 exp_id[m_SIDE_INDEX],
1449 exp_id[m_MODULE_INDEX]);
1450}
1451
1453{
1454 return this->tower_id (exp_id[m_SECTION_INDEX],
1455 exp_id[m_SIDE_INDEX],
1456 exp_id[m_MODULE_INDEX],
1457 exp_id[m_TOWER_INDEX]);
1458}
1459
1461{
1462 return this->cell_id (exp_id[m_SECTION_INDEX],
1463 exp_id[m_SIDE_INDEX],
1464 exp_id[m_MODULE_INDEX],
1465 exp_id[m_TOWER_INDEX],
1466 exp_id[m_SAMPLE_INDEX]);
1467}
1468
1470{
1471 return this->pmt_id (exp_id[m_SECTION_INDEX],
1472 exp_id[m_SIDE_INDEX],
1473 exp_id[m_MODULE_INDEX],
1474 exp_id[m_TOWER_INDEX],
1475 exp_id[m_SAMPLE_INDEX],
1476 exp_id[m_PMT_INDEX]);
1477}
1478
1480{
1481 return this->adc_id (exp_id[m_SECTION_INDEX],
1482 exp_id[m_SIDE_INDEX],
1483 exp_id[m_MODULE_INDEX],
1484 exp_id[m_TOWER_INDEX],
1485 exp_id[m_SAMPLE_INDEX],
1486 exp_id[m_PMT_INDEX],
1487 exp_id[m_ADC_INDEX]);
1488}
1489
1490int Tile_Base_ID::eta_min(const Identifier& id, const IdContext& context) const
1491{
1492 ExpandedIdentifier expId;
1493 if(!get_expanded_id(id, expId, &context)) {
1494 int result = -999;
1495 for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
1496 const Range& range = m_full_tower_range[i];
1497 if (range.match(expId)) {
1498 const Range::field& eta_field = range[m_TOWER_INDEX];
1499 if (not eta_field.empty()) {
1500 int etamin = eta_field.get_minimum();
1501 if (-999 == result) {
1502 result = etamin;
1503 }
1504 else {
1505 if (etamin < result) result = etamin;
1506 }
1507 }
1508 }
1509 }
1510 return (result);
1511 }
1512 return (-999);
1513}
1514
1515int Tile_Base_ID::eta_max(const Identifier& id, const IdContext& context) const
1516{
1517 ExpandedIdentifier expId;
1518 if(!get_expanded_id(id, expId, &context)) {
1519 int result = -999;
1520 for (unsigned int i = 0; i < m_full_cell_range.size(); ++i) {
1521 const Range& range = m_full_cell_range[i];
1522 if (range.match(expId)) {
1523 const Range::field& eta_field = range[m_TOWER_INDEX];
1524 if (not eta_field.empty()) {
1525 int etamax = eta_field.get_maximum();
1526 if (result < etamax) result = etamax;
1527 }
1528 }
1529 }
1530 return (result);
1531 }
1532 return (-999); // default
1533}
1534
1536{
1537 IdContext context = tower_context();
1538 return eta_min (id, context);
1539}
1540
1542{
1543 IdContext context = cell_context();
1544 return eta_max (id, context);
1545}
1546
1548{
1549 IdContext context = region_context();
1550 return eta_min (id, context);
1551}
1552
1554{
1555 IdContext context = region_context();
1556 return eta_max (id, context);
1557}
1558
1560{
1561 ExpandedIdentifier expId;
1562 IdContext context = cell_context();
1563 if(!get_expanded_id(id, expId, &context)) {
1564 int result = -999;
1565 for (unsigned int i = 0; i < m_full_cell_range.size(); ++i) {
1566 const Range& range = m_full_cell_range[i];
1567 if (range.match(expId)) {
1568 const Range::field& phi_field = range[m_MODULE_INDEX];
1569 if (not phi_field.empty()) {
1570 int phimax = phi_field.get_maximum();
1571 if (result < phimax) result = phimax;
1572 }
1573 }
1574 }
1575 return (result);
1576 }
1577 return (-999); // default
1578}
1579
1581 ExpandedIdentifier& exp_id,
1582 const IdContext* context) const
1583{
1584 int result = 1;
1585
1586 size_t begin = (context) ? context->begin_index() : 0;
1587 size_t end = (context) ? context->end_index() : m_ADC_INDEX;
1588 assert (end <= m_ADC_INDEX);
1589
1590 if (0 == end) {
1591 result = 0;
1592 }
1593 else if ( 0 == begin) {
1595 result = dict()->unpack(group(), id, empty, end, exp_id);
1596 }
1597 else {
1598 result = dict()->unpack(group(), id, context->prefix_id(), end, exp_id);
1599 }
1600 return result;
1601}
1602
1603int Tile_Base_ID::initLevelsFromDict (const std::string& group_name)
1604{
1605 if(!dict()) {
1606 ATH_MSG_ERROR("initLevelsFromDict - dictionary NOT initialized ");
1607 return (1);
1608 }
1609
1610 // Find out which identifier field corresponds to each level.
1611
1612 m_SYSTEM_INDEX = 999;
1613 m_SECTION_INDEX = 999;
1614 m_SIDE_INDEX = 999;
1615 m_MODULE_INDEX = 999;
1616 m_TOWER_INDEX = 999;
1617 m_SAMPLE_INDEX = 999;
1618 m_PMT_INDEX = 999;
1619 m_ADC_INDEX = 999;
1620
1621 const IdDictGroup* group = dict()->find_group(group_name);
1622 if ( !group ){
1623 ATH_MSG_ERROR("initLevelsFromDict - cannot find " << group_name
1624 << " group' field ");
1625 }
1626 else {
1627 m_tile_region_index = group->region(0).index();
1628 }
1629
1630 // Fing a Tile region
1631 const IdDictField* field = dict()->find_field("subdet") ;
1632 if (field) {
1633 m_SYSTEM_INDEX = field->index();
1634 }
1635 else {
1636 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'subdet' field ");
1637 return (1);
1638 }
1639
1640 field = dict()->find_field("section") ;
1641 if (field) {
1642 m_SECTION_INDEX = field->index();
1643 }
1644 else {
1645 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'section' field ");
1646 return (1);
1647 }
1648
1649 field = dict()->find_field("side") ;
1650 if (field) {
1651 m_SIDE_INDEX = field->index();
1652 }
1653 else {
1654 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'side' field ");
1655 return (1);
1656 }
1657
1658 field = dict()->find_field("module") ;
1659 if (field) {
1660 m_MODULE_INDEX = field->index();
1661 }
1662 else {
1663 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'module' field ");
1664 return (1);
1665 }
1666
1667 field = dict()->find_field("tower") ;
1668 if (field) {
1669 m_TOWER_INDEX = field->index();
1670 }
1671 else {
1672 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'tower' field ");
1673 return (1);
1674 }
1675
1676 field = dict()->find_field("sampling") ;
1677 if (field) {
1678 m_SAMPLE_INDEX = field->index();
1679 }
1680 else {
1681 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'sampling' field ");
1682 return (1);
1683 }
1684
1685 field = dict()->find_field("pmt") ;
1686 if (field) {
1687 m_PMT_INDEX = field->index();
1688 }
1689 else {
1690 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'pmt' field ");
1691 return (1);
1692 }
1693
1694 field = dict()->find_field("adc") ;
1695 if (field) {
1696 m_ADC_INDEX = field->index();
1697 }
1698 else {
1699 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'adc' field ");
1700 return (1);
1701 }
1702
1704
1705 m_system_impl = region.implementation(m_SYSTEM_INDEX);
1706 m_section_impl = region.implementation(m_SECTION_INDEX);
1707 m_side_impl = region.implementation(m_SIDE_INDEX);
1708 m_module_impl = region.implementation(m_MODULE_INDEX);
1709 m_tower_impl = region.implementation(m_TOWER_INDEX);
1710 m_sample_impl = region.implementation(m_SAMPLE_INDEX);
1711 m_pmt_impl = region.implementation(m_PMT_INDEX);
1712 m_adc_impl = region.implementation(m_ADC_INDEX);
1713
1714 ATH_MSG_DEBUG("initLevelsFromDict decode index and bit fields for each level: " );
1715 ATH_MSG_DEBUG(" system [" << m_SYSTEM_INDEX << "] " << m_system_impl.show_to_string() );
1716 ATH_MSG_DEBUG(" section [" << m_SECTION_INDEX << "] " << m_section_impl.show_to_string() );
1717 ATH_MSG_DEBUG(" side [" << m_SIDE_INDEX << "] " << m_side_impl.show_to_string() );
1718 ATH_MSG_DEBUG(" module [" << m_MODULE_INDEX << "] " << m_module_impl.show_to_string() );
1719 ATH_MSG_DEBUG(" tower [" << m_TOWER_INDEX << "] " << m_tower_impl.show_to_string() );
1720 ATH_MSG_DEBUG(" sampling [" << m_SAMPLE_INDEX << "] " << m_sample_impl.show_to_string() );
1721 ATH_MSG_DEBUG(" pmt [" << m_PMT_INDEX << "] " << m_pmt_impl.show_to_string() );
1722 ATH_MSG_DEBUG(" adc [" << m_ADC_INDEX << "] " << m_adc_impl.show_to_string() );
1723
1724 return(0) ;
1725}
1726
1728{
1729 if (regions().init (*this, "regions", m_full_region_range,
1731 m_SIDE_INDEX))
1732 return 1;
1733
1734 if (m_modules.init (*this, "modules", m_full_module_range,
1737 return 1;
1738
1739 if (m_towers.init (*this, "towers", m_full_tower_range,
1742 return 1;
1743
1744 if (channels().init (*this, "channels", m_full_cell_range,
1747 return 1;
1748
1749 if (m_pmts.init (*this, "pmts", m_full_pmt_range,
1751 m_PMT_INDEX))
1752 return 1;
1753
1754 if (m_adcs.init (*this, "adcs", m_full_adc_range,
1756 m_ADC_INDEX))
1757 return 1;
1758
1759 return (0);
1760}
1761
1762
1764 std::vector<IdentifierHash>& neighbourList) const
1765{
1766 int result = 1;
1767
1768 if(!m_do_neighbours) {
1769 ATH_MSG_WARNING("get_neighbours: neighbours not initialized !!! returning empty list");
1770 neighbourList.resize(0);
1771 return result;
1772 }
1773
1774 neighbourList.clear();
1775
1776 bool prevSmp = (option & prevInSamp);
1777 bool nextSmp = (option & nextInSamp);
1778
1779 bool corners2DOnly = ( (option & all2D) == corners2D );
1780
1781 bool prevPhi = corners2DOnly || (option & prevInPhi);
1782 bool nextPhi = corners2DOnly || (option & nextInPhi);
1783 bool prevEta = corners2DOnly || (option & prevInEta);
1784 bool nextEta = corners2DOnly || (option & nextInEta);
1785
1786 std::vector<IdentifierHash> inpList;
1787 std::vector<IdentifierHash>::iterator inpItr;
1788 std::vector<IdentifierHash>::iterator inpLast;
1789
1790 inpList.push_back(id_orig);
1791
1792 // all phi neighbours (just 2)
1793 if (prevPhi) m_neighbour.prev_phi(id_orig,neighbourList);
1794 if (nextPhi) m_neighbour.next_phi(id_orig,neighbourList);
1795
1796 if ( (option & all2D) == faces2D) {
1797 // do nothing
1798
1799 } else if (corners2DOnly) {
1800 // neighbours of phi-neigbours are 2D corners
1801 inpList = std::move(neighbourList); // copy 2 phi neighbours to input list
1802 neighbourList.clear(); // and clear neighbour list
1803
1804 } else if ( (option & all2D) == all2D) {
1805 // copy all neighbours to input list
1806 inpList.insert (inpList.end(), neighbourList.begin(), neighbourList.end());
1807
1808 }
1809
1810 // all eta neighbours
1811 inpItr = inpList.begin();
1812 inpLast = inpList.end();
1813 for ( ; inpItr != inpLast; ++inpItr) {
1814 IdentifierHash id = (*inpItr);
1815 if (prevEta) m_neighbour.prev_eta(id,neighbourList);
1816 if (nextEta) m_neighbour.next_eta(id,neighbourList);
1817 }
1818
1819 // all sampling neighbours
1820 if( (option & all3DwithCorners) == all3DwithCorners ) {
1821
1822 inpItr = inpList.begin();
1823 inpLast = inpList.end();
1824 for ( ; inpItr != inpLast; ++inpItr) {
1825 IdentifierHash id = (*inpItr);
1826 m_neighbour.prev_samp_wide(id,neighbourList);
1827 m_neighbour.next_samp_wide(id,neighbourList);
1828 }
1829
1830 } else {
1831
1832 if (prevSmp) m_neighbour.prev_samp(id_orig,neighbourList);
1833 if (nextSmp) m_neighbour.next_samp(id_orig,neighbourList);
1834
1835 }
1836
1837 if (!neighbourList.empty()) result = 0;
1838
1839 return result;
1840}
1841
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Provide helper functions to create formatted strings.
Factor out code common between TileID and Tile_SuperCell_ID.
static const Attributes_t empty
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
bool is_tile(Identifier id) const
ExpandedIdentifier tile_exp(void) const
int tile_field_value() const
const std::string & group() const
Group name for this helper.
Identifier id(IdentifierHash hashId) const
Return the identifier for a given hash code (no checking).
const std::vector< Identifier > & ids() const
Return a vector of all Identifiers for this group.
id_iterator end() const
Return an end iterator over the group's Identifiers.
id_iterator begin() const
Return a begin iterator over the group's Identifiers.
id_range range() const
Return an iterator range over the group's Identifiers.
int get_hash(Identifier id, IdentifierHash &hash_id) const
Look up the hash code corresponding to an Identifier.
size_type hash_max() const
Return one more than the largest hash code.
const HashGroup & regions() const
Return the HashGroup for regions.
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
const std::string & name() const
Return the name for this helper.
const HashGroup & channels() const
Return the HashGroup for channels (cells).
void add(element_type value)
Append a value into a new field.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
size_type begin_index() const
Definition IdContext.h:45
size_type end_index() const
Definition IdContext.h:46
const ExpandedIdentifier & prefix_id() const
Accessors.
Definition IdContext.h:44
int unpack(const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix...
MultiRange build_multirange() const
Get MultiRange for full dictionary.
int get_label_value(const std::string &field, const std::string &label, int &value) const
IdDictGroup * find_group(const std::string &group_name)
const std::string & name() const
Dictionary name.
const IdDictField * find_field(const std::string &name) const
const IdDictRegion & region(size_t i) const
Region at index i.
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
const std::string & find_metadata(const std::string &name) const
Access to meta data, name/value pairs.
Definition IdDictMgr.cxx:87
element_type get_minimum() const
Query the values.
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
element_type get_maximum() const
This is a "hash" representation of an Identifier.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Exception class for Tile Identifiers.
const std::vector< Identifier > & region_ids() const
provide access to id vectors, accessed via hash
id_iterator module_begin() const
iterator over set of module Identifiers
IdDictFieldImplementation m_side_impl
id_range tower_range() const
MultiRange m_full_tower_range
bool is_twosides(const Identifier &id) const
int sample(const Identifier &id) const
IdDictFieldImplementation m_adc_impl
Identifier tile_barrel() const
build identifier for Tile Barrel
Tile_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
int decode_section(int section) const
int region_eta_max(const Identifier &id) const
id_iterator tower_begin() const
iterator over set of tower Identifiers
const std::vector< Identifier > & adc_ids() const
int tower(const Identifier &id) const
id_iterator module_end() const
size_type m_MODULE_INDEX
Identifier tile_system() const
build identifier for whole TileCal
CaloIDHelper::HashGroup m_modules
MultiRange m_full_adc_range
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
size_type module_hash_max() const
bool is_tile_aux(const Identifier &id) const
id_iterator pmt_begin() const
iterator over set of pmt Identifiers
int get_neighbours(const IdentifierHash &id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = prevInPhi,...
CaloIDHelper::HashGroup m_towers
size_type cell_hash_max() const
IdContext adc_context() const
id for ADCs
int adc(const Identifier &id) const
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
Identifier tower_id(int section, int side, int module, int tower) const
IdDictFieldImplementation m_tower_impl
id_iterator reg_end() const
IdContext cell_context() const
id for cells
IdDictFieldImplementation m_section_impl
IdContext pmt_context() const
id for PMTs
size_type m_PMT_INDEX
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
bool is_supercell(const Identifier &id) const
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
const std::vector< Identifier > & tower_ids() const
Identifier tile_det(int section) const
build identifier for any Tilecal section
size_type pmt_hash_max() const
const std::vector< Identifier > & pmt_ids() const
bool is_low_gain(const Identifier &id) const
IdentifierHash cell_hash(const Identifier &cell_id) const
fast conversion from ID to hash for cells
const std::vector< Identifier > & cell_ids() const
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
id_range module_range() const
IdContext module_context() const
id for modules
CaloIDHelper::HashGroup m_pmts
MultiRange m_full_module_range
bool is_tile_barrel(const Identifier &id) const
Test of an Identifier to see if it belongs to a particular part of the calorimeter.
int encode_section(int section) const
CaloIDHelper::HashGroup m_adcs
unsigned m_supercell
MultiRange m_full_pmt_range
std::string to_string(const Identifier &id, int level=0) const
IdDictFieldImplementation m_pmt_impl
int eta_max(const Identifier &id) const
id_iterator cell_begin() const
iterator over set of cell Identifiers
id_range pmt_range() const
int system(const Identifier &id) const
Identifier tile_extbarrel() const
build identifier for Tile Extended Barrel
const std::vector< Identifier > & module_ids() const
id_iterator reg_begin() const
iterator over set of region Identifiers
Identifier cell_id(const Identifier &any_id) const
TileNeighbour m_neighbour
int region_eta_min(const Identifier &id) const
Identifier adc_id(const Identifier &cell_id, int pmt, int adc) const
id_range reg_range() const
id_iterator adc_end() const
size_type m_SECTION_INDEX
id_iterator cell_end() const
size_type m_SAMPLE_INDEX
int side(const Identifier &id) const
size_type adc_hash_max() const
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
id_range cell_range() const
id_iterator adc_begin() const
iterator over set of adc Identifiers
size_type m_TOWER_INDEX
Identifier region_id(int index) const
build single region, module, tower, cell, pmt, adc identifiers
IdContext tower_context() const
id for towers
size_type m_tile_region_index
int initLevelsFromDict(const std::string &group_name)
int pmt(const Identifier &id) const
IdDictFieldImplementation m_module_impl
int section(const Identifier &id) const
int eta_min(const Identifier &id) const
max values (-999 == failure)
id_iterator pmt_end() const
bool is_tile_extbarrel(const Identifier &id) const
bool is_tile_gap(const Identifier &id) const
id_range adc_range() const
IdDictFieldImplementation m_sample_impl
size_type m_SYSTEM_INDEX
Identifier tile_gap() const
build identifier for Tile Gap detector (ITC + gap/crack scintillators)
bool is_high_gain(const Identifier &id) const
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
IdDictFieldImplementation m_system_impl
Identifier pmt_id(const Identifier &any_id) const
int get_field(const Identifier &id, size_type index) const
unpack one field from Identifier
size_type m_SIDE_INDEX
size_type region_hash_max() const
hash tables max size
bool is_tile_gapscin(const Identifier &id) const
size_type m_ADC_INDEX
bool is_positive(const Identifier &id) const
Identifier module_id(int section, int side, int module) const
int phi_max(const Identifier &id) const
bool is_negative(const Identifier &id) const
int region(int section, int side) const
MultiRange m_full_cell_range
id_iterator tower_end() const
size_type tower_hash_max() const
MultiRange m_full_region_range
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition StrFormat.cxx:49
Definition index.py:1