ATLAS Offline Software
Loading...
Searching...
No Matches
Tile_Base_ID.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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
21#include <algorithm>
22#include <cassert>
23#include <cstdio>
24#include <iostream>
25#include <stdexcept>
26
27using namespace LArNeighbours;
28
29
30
31Tile_Base_ID::Tile_Base_ID (const std::string& name,
32 const std::string& group,
33 bool supercell)
35 , m_supercell (supercell ? 1 : 0)
37 , m_SYSTEM_INDEX(999)
38 , m_SECTION_INDEX(999)
39 , m_SIDE_INDEX(999)
40 , m_MODULE_INDEX(999)
41 , m_TOWER_INDEX(999)
42 , m_SAMPLE_INDEX(999)
43 , m_PMT_INDEX(999)
44 , m_ADC_INDEX(999)
45{
46}
47
48//
49// Tile_Base_ID methods
50//
51std::string
52Tile_Base_ID::to_string( const Identifier & id, int level ) const
53{
54 IdContext context;
55 switch (level) {
56 case 1: case -6:
57 case 2: case -5: context = region_context(); break;
58 case 3: case -4: context = module_context(); break;
59 case 4: case -3: context = tower_context(); break;
60 case 5: case -2: context = cell_context(); break;
61 case 6: case -1: context = pmt_context(); break;
62 case 7: case 0: context = adc_context(); break;
63 default:
64 return "Tile_Base_ID::to_string - unknown context";
65 }
66
67 ExpandedIdentifier exp_id;
68 if ( get_expanded_id(id,exp_id,&context) ) {
69 return "Tile_Base_ID::to_string - can not expand ID";
70 } else {
71 return (std::string)(exp_id);
72 }
73}
74
75std::string
76Tile_Base_ID::to_string( const IdentifierHash & hash_id, int level ) const
77{
78 IdContext context;
79 switch (level) {
80 case 1: case -6:
81 case 2: case -5: context = region_context(); break;
82 case 3: case -4: context = module_context(); break;
83 case 4: case -3: context = tower_context(); break;
84 case 5: case -2: context = cell_context(); break;
85 case 6: case -1: context = pmt_context(); break;
86 case 7: case 0: context = adc_context(); break;
87 default:
88 return "Tile_Base_ID::to_string - unknown context";
89 }
90
91 Identifier id;
92 if ( get_id ( hash_id, id, &context ) == 0 ) {
93 ExpandedIdentifier exp_id;
94 if ( get_expanded_id(id,exp_id,&context) ) {
95 return "Tile_Base_ID::to_string - can not expand ID";
96 } else {
97 return (std::string)(exp_id);
98 }
99 } else {
100 return "Tile_Base_ID::to_string - can not get ID from hash_id";
101 }
102}
103
104//
105// get methods
106//
107int
109{
110 int field = 0;
111 if(!dict()->unpack(id, 0, index, m_tile_region_index, field)) {
112 return field;
113 } else {
114 return 0;
115 }
116}
117
118int
120{
121 IdentifierHash hash_id;
122 IdContext context = region_context();
123
124 get_hash(region_id(section,side),hash_id,&context);
125
126 return (int)hash_id;
127}
128
129int
131{
132 IdentifierHash hash_id;
133 IdContext context = region_context();
134
135 get_hash(region_id(id),hash_id,&context);
136
137 return (int)hash_id;
138}
139
140int
142{
143 return get_field(id,m_SYSTEM_INDEX);
144}
145
146int
148{
150}
151
152int
153Tile_Base_ID::side ( const Identifier & id ) const
154{
155 return get_field(id,m_SIDE_INDEX);
156}
157
158int
159Tile_Base_ID::module ( const Identifier & id ) const
160{
161 return get_field(id,m_MODULE_INDEX);
162}
163
164int
165Tile_Base_ID::tower ( const Identifier & id ) const
166{
167 return get_field(id,m_TOWER_INDEX);
168}
169
170int
172{
173 if ( section(id) == Tile_Base_ID::AUXDET )
175 else
176 return get_field(id,m_SAMPLE_INDEX);
177}
178
179int
180Tile_Base_ID::pmt ( const Identifier & id ) const
181{
182 return get_field(id,m_PMT_INDEX);
183}
184
185int
186Tile_Base_ID::adc ( const Identifier & id ) const
187{
188 return get_field(id,m_ADC_INDEX);
189}
190
191//
192// check methods
193//
194/*
195bool
196Tile_Base_ID::is_tile (const Identifier& id) const
197{
198 bool result = ( system(id) == tile_field_value() );
199
200 return result;
201}
202*/
203
204bool
206{
207 bool result = is_tile(id)
208 && ( section(id) == Tile_Base_ID::BARREL );
209
210 return result;
211}
212
213bool
215{
216 bool result = is_tile(id)
217 && ( section(id) == Tile_Base_ID::EXTBAR );
218
219 return result;
220}
221
222bool
224{
225 bool result = is_tile(id)
226 && ( section(id) == Tile_Base_ID::GAPDET );
227
228 return result;
229}
230
231bool
233{
234 bool result = is_tile(id)
235 && ( section(id) == Tile_Base_ID::AUXDET );
236
237 return result;
238}
239
240bool
242{
243 bool result = is_tile(id)
244 && ( side(id) == Tile_Base_ID::NEGATIVE );
245
246 return result;
247}
248
249bool
251{
252 bool result = is_tile(id)
253 && ( side(id) == Tile_Base_ID::POSITIVE );
254
255 return result;
256}
257
258bool
260{
261 bool result = is_tile(id)
262 && ( side(id) == 0 );
263
264 return result;
265}
266
267bool
269{
270 bool result = is_tile(id)
271 && ( sample(id) == Tile_Base_ID::SAMP_E );
272
273 return result;
274}
275
276bool
278{
279 bool result = is_tile(id)
280 && ( adc(id) == Tile_Base_ID::LOWGAIN );
281
282 return result;
283}
284
285bool
287{
288 bool result = is_tile(id)
289 && ( adc(id) == Tile_Base_ID::HIGHGAIN );
290
291 return result;
292}
293
295{
296 return is_tile(id) && (get_field(id,m_SECTION_INDEX) & SUPERCELL_MASK);
297}
298
299// Whole TileCal
302{
303 Identifier result;
304
305 int id[8];
307
308 Identifier compactId(0);
309 if (!dict()->pack32(id, 0, m_SYSTEM_INDEX, m_tile_region_index, compactId)) {
310 result = compactId;
311 }
312
313 return result;
314}
315
316// For Tile Barrel ID
319{
320 Identifier result;
321
322 int id[8];
325
326 Identifier compactId(0);
327 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
328 result = compactId;
329 }
330
331 return result;
332}
333
334// For Tile Extended Barrel ID
337{
338 Identifier result;
339
340 int id[8];
343
344 Identifier compactId(0);
345 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
346 result = compactId;
347 }
348
349 return result;
350}
351
352
353// For Tile Gap Scintillator ID
356{
357 Identifier result;
358
359 assert (!m_supercell);
360 int id[8];
363
364 Identifier compactId(0);
365 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
366 result = compactId;
367 }
368
369 return result;
370}
371
372// For any Tilecal section
374Tile_Base_ID::tile_det ( int section, bool checks ) const
375{
376 if(checks) {
377 // Check that id is within allowed range
378 // Fill expanded id
380 expId << encode_section (section) ;
381 }
382
383 Identifier result;
384
385 int id[8];
388
389 Identifier compactId(0);
390 if (!dict()->pack32(id, 0, m_SECTION_INDEX, m_tile_region_index, compactId)) {
391 result = compactId;
392 }
393
394 return result;
395}
396
399{
400 return tile_det (section, do_checks());
401}
402
403// single region, module, tower, cell, pmt, adc identifiers
406{
407 Identifier result;
408 IdentifierHash hash_id = index;
409 IdContext context = region_context();
410
411 get_id(hash_id,result,&context);
412
413 return result;
414}
415
417Tile_Base_ID::region_id ( int section, int side, bool checks ) const
418{
419 if(checks) {
420
421 // Check that id is within allowed range
422
423 // Fill expanded id
425 expId << encode_section (section) << side;
426
427 if (!m_full_region_range.match(expId)) {
428 std::string errorMessage = "Tile_Base_ID::region_id() result is not OK: ID, range = "
429 + std::string(expId) + " , " + (std::string)m_full_region_range;
430 throw TileID_Exception(errorMessage , 1);
431 }
432 }
433
434 Identifier result;
435
436 int id[8];
439 id[m_SIDE_INDEX] = side;
440
441 Identifier compactId(0);
442 if (!dict()->pack32(id, 0, m_SIDE_INDEX, m_tile_region_index, compactId)) {
443 result = compactId;
444 }
445
446 return result;
447}
448
451{
452 return region_id (section, side, do_checks());
453}
454
455
457Tile_Base_ID::region_id ( const Identifier& any_id ) const
458{
459 Identifier result;
460 // extract with the dictionary
461 Identifier id;
462 if(!dict()->copy(any_id, 0, 0, m_SIDE_INDEX, m_tile_region_index, id)) {
463 result = id;
464 }
465 return (result);
466}
467
470 int module,
471 bool checks ) const
472{
473 if(checks) {
474
475 // Check that id is within allowed range
476
477 // Fill expanded id
479 expId << encode_section (section) << side << module;
480
481 if (!m_full_module_range.match(expId)) {
482 std::string errorMessage = "Tile_Base_ID::module_id() result is not OK: ID, range = "
483 + std::string(expId) + " , " + (std::string)m_full_region_range;
484 throw TileID_Exception(errorMessage , 1);
485 }
486 }
487
488 Identifier result;
489
490 int id[8];
493 id[m_SIDE_INDEX] = side;
494 id[m_MODULE_INDEX] = module;
495
496 Identifier compactId(0);
497 if (!dict()->pack32(id, 0, m_MODULE_INDEX, m_tile_region_index, compactId)) {
498 result = compactId;
499 }
500
501 return result;
502}
503
506 int module ) const
507{
508 return module_id (section, side, module, do_checks());
509}
510
511
513Tile_Base_ID::module_id ( const Identifier& any_id ) const
514{
515 Identifier result;
516 // extract with the dictionary
517 Identifier id;
518 if(!dict()->copy(any_id, 0, 0, m_MODULE_INDEX, m_tile_region_index, id)) {
519 result = id;
520 }
521 return (result);
522}
523
526 int module, int tower,
527 bool checks) const
528{
529 if(checks) {
530
531 // Check that id is within allowed range
532
533 // Fill expanded id
535 expId << encode_section (section) << side << module << tower;
536
537 if (!m_full_tower_range.match(expId)) {
538 std::string errorMessage = "Tile_Base_ID::tower_id() result is not OK: ID, range = "
539 + std::string(expId) + " , " + (std::string)m_full_region_range;
540 throw TileID_Exception(errorMessage , 1);
541 }
542 }
543
544 Identifier result;
545
546 int id[8];
549 id[m_SIDE_INDEX] = side;
550 id[m_MODULE_INDEX] = module;
551 id[m_TOWER_INDEX] = tower;
552
553 Identifier compactId(0);
554 if (!dict()->pack32(id, 0, m_TOWER_INDEX, m_tile_region_index, compactId)) {
555 result = compactId;
556 }
557
558 return result;
559}
560
563 int module, int tower) const
564{
565 return tower_id (section, side, module, tower, do_checks());
566}
567
569Tile_Base_ID::tower_id ( const Identifier& any_id ) const
570{
571 Identifier result;
572 // extract with the dictionary
573 Identifier id;
574 if(!dict()->copy(any_id, 0, 0, m_TOWER_INDEX, m_tile_region_index, id)) {
575 result = id;
576 }
577 return (result);
578}
579
581Tile_Base_ID::cell_id ( const Identifier & any_id ) const
582{
583 Identifier result;
584 // extract with the dictionary
585 Identifier id;
586 if(!dict()->copy(any_id, 0, 0, m_SAMPLE_INDEX, m_tile_region_index, id)) {
587 result = id;
588 }
589 return (result);
590}
591
594 int module, int tower,
595 int sample,
596 bool checks ) const
597{
598 if(checks) {
599
600 // Check that id is within allowed range
601
602 // Fill expanded id
604 expId << encode_section (section) << side << module << tower << sample;
605
606 if (!m_full_cell_range.match(expId)) {
607 std::string errorMessage = "Tile_Base_ID::cell_id() result is not OK: ID, range = "
608 + std::string(expId) + " , " + (std::string)m_full_cell_range;
609 throw TileID_Exception(errorMessage , 1);
610 }
611 }
612
613 Identifier result;
614
615 int id[8];
618 id[m_SIDE_INDEX] = side;
619 id[m_MODULE_INDEX] = module;
620 id[m_TOWER_INDEX] = tower;
622
623 Identifier compactId(0);
624 if (!dict()->pack32(id, 0, m_SAMPLE_INDEX, m_tile_region_index, compactId)) {
625 result = compactId;
626 }
627
628 return result;
629}
630
633 int module, int tower,
634 int sample ) const
635{
636 return cell_id (section, side, module, tower, sample, do_checks());
637}
638
640Tile_Base_ID::pmt_id ( const Identifier & any_id ) const
641{
642 Identifier result;
643 // extract with the dictionary
644 Identifier id;
645 if(!dict()->copy(any_id, 0, 0, m_PMT_INDEX, m_tile_region_index, id)) {
646 result = id;
647 }
648 return (result);
649}
650
653 int pmt, bool checks ) const
654{
655 Identifier result;
656
657 int id[8];
658 id[0] = pmt;
659
660 Identifier compactId(cell_id);
661 if (!dict()->pack32(id, m_PMT_INDEX, m_PMT_INDEX, m_tile_region_index, compactId)) {
662 result = compactId;
663 }
664 else {
665 std::string errorMessage = "Tile_Base_ID::pmt_id(cell_id,pmt) could not pack ID: "
666 + cell_id.getString() ;
667 throw TileID_Exception(errorMessage , 1);
668 }
669
670 if(checks) {
671
672 // Check that id is within allowed range
673
674 // Fill expanded id
675 ExpandedIdentifier expId;
676
677 IdContext context = cell_context();
678 if (get_expanded_id(result, expId, &context)) {
679 std::string errorMessage = "Tile_Base_ID::pmt_id(cell_id,pmt) result is not OK: ID = "
680 + result.getString() ;
681 throw TileID_Exception(errorMessage , 1);
682
683 // region_id.show();
684 }
685
686 expId << pmt;
687
688 if (!m_full_pmt_range.match(expId)) {
689 std::string errorMessage = "Tile_Base_ID::pmt_id() result is not OK: ID, range = "
690 + std::string(expId) + " , " + (std::string)m_full_region_range;
691 throw TileID_Exception(errorMessage , 1);
692 }
693 }
694
695 return result;
696}
697
700 int pmt ) const
701{
702 return pmt_id (cell_id, pmt, do_checks());
703}
704
707 int module, int tower,
708 int sample, int pmt,
709 bool checks) const
710{
711 if(checks) {
712
713 // Check that id is within allowed range
714
715 // Fill expanded id
717 expId << encode_section (section) << side << module << tower << sample << pmt;
718
719 if (!m_full_pmt_range.match(expId)) {
720 std::string errorMessage = "Tile_Base_ID::pmt_id() result is not OK: ID, range = "
721 + std::string(expId) + " , " + (std::string)m_full_region_range;
722 throw TileID_Exception(errorMessage , 1);
723 }
724 }
725
726 Identifier result;
727
728 int id[8];
731 id[m_SIDE_INDEX] = side;
732 id[m_MODULE_INDEX] = module;
733 id[m_TOWER_INDEX] = tower;
735 id[m_PMT_INDEX] = pmt;
736
737 Identifier compactId(0);
738 if (!dict()->pack32(id, 0, m_PMT_INDEX, m_tile_region_index, compactId)) {
739 result = compactId;
740 }
741
742 return result;
743}
744
747 int module, int tower,
748 int sample, int pmt) const
749{
750 return pmt_id (section, side, module, tower, sample, pmt, do_checks());
751}
752
755 int pmt, int adc, bool checks ) const
756{
757 Identifier result;
758
759 int id[8];
760 id[0] = pmt;
761 id[1] = adc;
762
763 Identifier compactId(cell_id);
764 if (!dict()->pack32(id, m_PMT_INDEX, m_ADC_INDEX, m_tile_region_index, compactId)) {
765 result = compactId;
766 }
767 else {
768 std::string errorMessage = "Tile_Base_ID::adc_id(cell_id,pmt,adc) could not pack ID: "
769 + cell_id.getString() ;
770 throw TileID_Exception(errorMessage , 1);
771 }
772
773 if(checks) {
774
775 // Check that id is within allowed range
776
777 // Fill expanded id
778 ExpandedIdentifier expId;
779
780 IdContext context = cell_context();
781 if (get_expanded_id(result, expId, &context)) {
782 std::string errorMessage = "Tile_Base_ID::adc_id(cell_id,pmt,adc) result is not OK: ID = "
783 + result.getString() ;
784 throw TileID_Exception(errorMessage , 1);
785
786 // region_id.show();
787 }
788
789 expId << pmt << adc;
790
791 if (!m_full_adc_range.match(expId)) {
792 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
793 + std::string(expId) + " , " + (std::string)m_full_region_range;
794 throw TileID_Exception(errorMessage , 1);
795 }
796 }
797
798 return result;
799}
800
803 int pmt, int adc ) const
804{
805 return adc_id (cell_id, pmt, adc, do_checks());
806}
807
810 int adc, bool checks ) const
811{
812 Identifier result;
813
814 int id[8];
815 id[0] = adc;
816
817 Identifier compactId(pmt_id);
818 if (!dict()->pack32(id, m_ADC_INDEX, m_ADC_INDEX, m_tile_region_index, compactId)) {
819 result = compactId;
820 }
821 else {
822 std::string errorMessage = "Tile_Base_ID::adc_id(pmt_id,adc) could not pack ID: "
823 + pmt_id.getString() ;
824 throw TileID_Exception(errorMessage , 1);
825 }
826
827 if(checks) {
828
829 // Check that id is within allowed range
830
831 // Fill expanded id
832 ExpandedIdentifier expId;
833
834 IdContext context = pmt_context();
835 if (get_expanded_id(result, expId, &context)) {
836 std::string errorMessage = "Tile_Base_ID::adc_id(pmt_id,adc) result is not OK: ID = "
837 + result.getString() ;
838 throw TileID_Exception(errorMessage , 1);
839
840 // region_id.show();
841 }
842
843 expId << adc;
844
845 if (!m_full_adc_range.match(expId)) {
846 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
847 + std::string(expId) + " , " + (std::string)m_full_region_range;
848 throw TileID_Exception(errorMessage , 1);
849 }
850 }
851
852 return result;
853}
854
857 int adc ) const
858{
859 return adc_id (pmt_id, adc, do_checks());
860}
861
864 int module, int tower, int sample,
865 int pmt, int adc,
866 bool checks) const
867{
868 if(checks) {
869
870 // Check that id is within allowed range
871
872 // Fill expanded id
874 expId << encode_section (section) << side << module << tower << sample << pmt << adc;
875
876 if (!m_full_adc_range.match(expId)) {
877 std::string errorMessage = "Tile_Base_ID::adc_id() result is not OK: ID, range = "
878 + std::string(expId) + " , " + (std::string)m_full_region_range;
879 throw TileID_Exception(errorMessage , 1);
880 }
881 }
882
883 Identifier result;
884
885 int id[8];
888 id[m_SIDE_INDEX] = side;
889 id[m_MODULE_INDEX] = module;
890 id[m_TOWER_INDEX] = tower;
892 id[m_PMT_INDEX] = pmt;
893 id[m_ADC_INDEX] = adc;
894
895 Identifier compactId(0);
896 if (!dict()->pack32(id, 0, m_ADC_INDEX, m_tile_region_index, compactId)) {
897 result = compactId;
898 }
899
900 return result;
901}
902
905 int module, int tower, int sample,
906 int pmt, int adc) const
907{
908 return adc_id (section, side, module, tower, sample, pmt, adc, do_checks());
909}
910
912 int module, Identifier& module_id ) const
913{
915 IdContext context = region_context();
916 get_expanded_id(region_id, id, &context);
917 id << module;
918 if (!m_full_module_range.match(id)) {
919 return false;
920 }
921
922 Identifier compactId(0);
923 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
924 module_id = compactId;
925 }
926 return true;
927}
928
930 int module, int tower, Identifier& tower_id ) const
931{
933 IdContext context = region_context();
934 get_expanded_id(region_id, id, &context);
935 id << module << tower;
936 if (!m_full_tower_range.match(id)) {
937 return false;
938 }
939
940 Identifier compactId(0);
941 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
942 tower_id = compactId;
943 }
944 return true;
945}
946
948 int module, int tower, int sample,
949 Identifier& cell_id ) const
950{
952 IdContext context = region_context();
953 get_expanded_id(region_id, id, &context);
954 id << module << tower << sample;
955 if (!m_full_cell_range.match(id)) {
956 return false;
957 }
958
959 Identifier compactId(0);
960 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
961 cell_id = compactId;
962 }
963 return true;
964}
965
967 int pmt, Identifier& pmt_id ) const
968{
970 IdContext context = cell_context();
971 get_expanded_id(cell_id, id, &context);
972 id << pmt;
973 if (!m_full_pmt_range.match(id)) {
974 return false;
975 }
976
977 Identifier compactId(0);
978 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
979 pmt_id = compactId;
980 }
981 return true;
982}
983
985 int adc, Identifier& adc_id ) const
986{
988 IdContext context = pmt_context();
989 get_expanded_id(pmt_id, id, &context);
990 id << adc;
991 if (!m_full_adc_range.match(id)) {
992 return false;
993 }
994
995 Identifier compactId(0);
996 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
997 adc_id = compactId;
998 }
999 return true;
1000}
1001
1003 int pmt, int adc, Identifier& adc_id ) const
1004{
1006 IdContext context = cell_context();
1007 get_expanded_id(cell_id, id, &context);
1008 id << pmt << adc;
1009 if (!m_full_adc_range.match(id)) {
1010 return false;
1011 }
1012
1013 Identifier compactId(0);
1014 if (!dict()->pack32(id,0, id.fields() - 1,compactId)) {
1015 adc_id = compactId;
1016 }
1017 return true;
1018}
1019
1021{
1022 if (hash_id < channels().hash_max()) {
1023 return channel_id (hash_id);
1024 } else {
1025 std::string errorMessage = "Tile_Base_ID::cell_id(hash_id) - hash_id out of range ";
1026 throw TileID_Exception(errorMessage , 1);
1027 }
1028}
1029
1031{
1032 IdentifierHash ret = 0;
1033 if (channels().get_hash (id, ret) == 0)
1034 return ret;
1035
1036 std::string errorMessage = "Tile_Base_ID::cell_hash(cell_id) - cell_id out of range ";
1037 throw TileID_Exception(errorMessage , 1);
1038}
1039
1040IdContext
1042{
1043 return {0, m_SIDE_INDEX};
1044}
1045
1046IdContext
1048{
1049 return {0, m_MODULE_INDEX};
1050}
1051
1052IdContext
1054{
1055 return {0, m_TOWER_INDEX};
1056}
1057
1058IdContext
1060{
1061 return {0, m_SAMPLE_INDEX};
1062}
1063
1064IdContext
1066{
1067 return {0, m_PMT_INDEX};
1068}
1069
1070IdContext
1072{
1073 return {0, m_ADC_INDEX};
1074}
1075
1076int
1078 Identifier& id,
1079 const IdContext* context ) const
1080{
1081 int result = 1;
1082 id.clear();
1083
1084 size_t begin = (context) ? context->begin_index(): 0;
1085 // cannot get hash if end is 0:
1086 size_t end = (context) ? context->end_index() : 0;
1087
1088 if (0 == begin) {
1089
1090 if ( m_ADC_INDEX == end ) {
1091 if (hash_id < m_adcs.hash_max()) {
1092 id = m_adcs.id (hash_id);
1093 result = 0;
1094 } else {
1095 ATH_MSG_ERROR("get_id: adc hash_id is out of range " << hash_id
1096 << " > " << m_adcs.hash_max());
1097 }
1098 } else if ( m_PMT_INDEX == end ) {
1099 if (hash_id < m_pmts.hash_max()) {
1100 id = m_pmts.id (hash_id);
1101 result = 0;
1102 } else {
1103 ATH_MSG_ERROR("get_id: pmt hash_id is out of range " << hash_id
1104 << " >= " << m_pmts.hash_max());
1105 }
1106 } else if ( m_SAMPLE_INDEX == end ) {
1107 if (hash_id < channels().hash_max()) {
1108 id = channels().id (hash_id);
1109 result = 0;
1110 } else {
1111 ATH_MSG_ERROR("get_id: cell hash_id is out of range " << hash_id
1112 << " >= " << channels().hash_max());
1113 }
1114 } else if ( m_TOWER_INDEX == end ) {
1115 if (hash_id < m_towers.hash_max()) {
1116 id = m_towers.id (hash_id);
1117 result = 0;
1118 } else {
1119 ATH_MSG_ERROR("get_id: tower hash_id is out of range " << hash_id
1120 << " >= " << m_towers.hash_max());
1121 }
1122 } else if ( m_MODULE_INDEX == end ) {
1123 if (hash_id < m_modules.hash_max()) {
1124 id = m_modules.id (hash_id);
1125 result = 0;
1126 } else {
1127 ATH_MSG_ERROR("get_id: module hash_id is out of range " << hash_id
1128 << " >= " << m_modules.hash_max());
1129 }
1130 } else if ( m_SIDE_INDEX == end ) {
1131 if (hash_id < regions().hash_max()) {
1132 id = regions().id (hash_id);
1133 result = 0;
1134 } else {
1135 ATH_MSG_ERROR("get_id: region hash_id is out of range " << hash_id
1136 << " >= " << regions().hash_max());
1137 }
1138 }
1139 }
1140 return(result);
1141}
1142
1143
1144int
1146 IdentifierHash& hash_id,
1147 const IdContext* context ) const
1148{
1149 hash_id = 0;
1150 int result = 1;
1151
1152 size_t begin = (context) ? context->begin_index(): 0;
1153 size_t end = (context) ? context->end_index() : 0;
1154
1155 if (0 == begin) {
1156 if ( m_ADC_INDEX == end ) {
1157 result = m_adcs.get_hash (id, hash_id);
1158 } else if ( m_PMT_INDEX == end ) {
1159 result = m_pmts.get_hash (pmt_id(id), hash_id);
1160 } else if ( m_SAMPLE_INDEX == end ) {
1161 result = channels().get_hash (cell_id(id), hash_id);
1162 } else if ( m_TOWER_INDEX == end ) {
1163 result = m_towers.get_hash (tower_id(id), hash_id);
1164 } else if ( m_MODULE_INDEX == end ) {
1165 result = m_modules.get_hash (module_id(id), hash_id);
1166 } else if ( m_SIDE_INDEX == end ) {
1167 result = regions().get_hash (region_id(id), hash_id);
1168 }
1169 }
1170
1171 return (result);
1172}
1173
1174int
1176 const std::string& group_name)
1177{
1178 ATH_MSG_DEBUG("initialize_base_from_dictionary ");
1179
1180 // Check whether this helper should be reinitialized
1181 if (!reinitialize(dict_mgr)) {
1182 ATH_MSG_DEBUG("Request to reinitialize not satisfied - tags have not changed");
1183 return (0);
1184 }
1185 else {
1186 ATH_MSG_DEBUG("(Re)initialize");
1187 }
1188
1189 ATH_MSG_DEBUG("calling base initialize_base_from_dictionary");
1190
1191 // init base object
1192 if(CaloIDHelper::initialize_base_from_dictionary(dict_mgr,
1193 "TileCalorimeter"))
1194 return (1);
1195
1196 // Initialize the field indices
1197 if(initLevelsFromDict (group_name)) return (1);
1198
1199
1200 // Find value for the field Tile Calorimeter
1201 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
1202 int tileField = -1;
1203 if (atlasDict->get_label_value("subdet", "TileCalorimeter", tileField)) {
1204 ATH_MSG_ERROR("Could not get value for label 'TileCalorimeter' of field 'subdet' in dictionary "
1205 << atlasDict->name());
1206 return (1);
1207 }
1208
1209 // Set up id for region and range prefix
1210 ExpandedIdentifier tile_id;
1211 tile_id.add(tileField);
1212 ExpandedIdentifier reg_id = tile_id;
1213 Range prefix;
1214
1215 m_full_adc_range = dict()->build_multirange(reg_id, group_name, prefix, "adc");
1216 m_full_pmt_range = dict()->build_multirange(reg_id, group_name, prefix, "pmt");
1217 m_full_cell_range = dict()->build_multirange(reg_id, group_name, prefix, "sampling");
1218 m_full_tower_range = dict()->build_multirange(reg_id, group_name, prefix, "tower");
1219 m_full_module_range = dict()->build_multirange(reg_id, group_name, prefix, "module");
1220 m_full_region_range = dict()->build_multirange(reg_id, group_name, prefix, "side");
1221
1222 // Find value for the field Tile Online
1223 int tilehwField = -1;
1224 if (dict()->get_label_value("section", "Online", tilehwField)) {
1225 ATH_MSG_ERROR("Could not get value for label 'Online' of field 'section' in dictionary "
1226 << dict()->name());
1227 } else {
1228 // remove online ID from all ranges
1229 reg_id = tile_id;
1230 reg_id.add(tilehwField);
1231 m_full_adc_range.remove_range(reg_id);
1232 m_full_pmt_range.remove_range(reg_id);
1233 m_full_cell_range.remove_range(reg_id);
1234 m_full_tower_range.remove_range(reg_id);
1235 m_full_module_range.remove_range(reg_id);
1236 m_full_region_range.remove_range(reg_id);
1237 }
1238
1239 // Find value for the field Tile Testbeam
1240 int tiletbField = -1;
1241 if (dict()->get_label_value("section", "Testbeam", tiletbField)) {
1242 ATH_MSG_ERROR("Could not get value for label 'Testbeam' of field 'section' in dictionary "
1243 << dict()->name());
1244 } else {
1245 // remove testbeam ID from all ranges
1246 reg_id = std::move(tile_id);
1247 reg_id.add(tiletbField);
1248 m_full_adc_range.remove_range(reg_id);
1249 m_full_pmt_range.remove_range(reg_id);
1250 m_full_cell_range.remove_range(reg_id);
1251 m_full_tower_range.remove_range(reg_id);
1252 m_full_module_range.remove_range(reg_id);
1253 m_full_region_range.remove_range(reg_id);
1254 }
1255
1256 ATH_MSG_DEBUG("initialize_from_dict :");
1257 ATH_MSG_DEBUG(" region range -> " << (std::string)m_full_region_range);
1258 ATH_MSG_DEBUG(" module range -> " << (std::string)m_full_module_range);
1259 ATH_MSG_DEBUG(" tower range -> " << (std::string)m_full_tower_range );
1260 ATH_MSG_DEBUG(" cell range -> " << (std::string)m_full_cell_range );
1261 ATH_MSG_DEBUG(" pmt range -> " << (std::string)m_full_pmt_range );
1262 ATH_MSG_DEBUG(" adc range -> " << (std::string)m_full_adc_range );
1263
1264 // Setup the hash tables
1265 if(init_hashes()) return (1);
1266
1267 // Setup hash tables for finding neighbors
1268 if(m_do_neighbours) {
1269 // temporary workaround to get the super_cell neighbor file directly
1270 // instead of from the db. In the long term the file name should
1271 // come from the db as well
1272 std::string neighbourFile;
1273 if ( m_supercell ) {
1274 neighbourFile = "TileSuperCellNeighbour.txt";
1275 }
1276 else {
1277 neighbourFile = dict_mgr.find_metadata("TILENEIGHBORS");
1278 }
1279 if (neighbourFile.empty()) throw std::runtime_error("TileID: Cannot find the Tile Neighbour file name");
1280 if(m_neighbour.initialize(this, neighbourFile)) return (1);
1281 }
1282
1283 return 0;
1284}
1285
1290
1292{
1293 return m_modules.hash_max();
1294}
1295
1297{
1298 return m_towers.hash_max();
1299}
1300
1305
1307{
1308 return m_pmts.hash_max();
1309}
1310
1312{
1313 return m_adcs.hash_max();
1314}
1315
1320
1322{
1323 return regions().end();
1324}
1325
1330
1332{
1333 return m_modules.begin();
1334}
1335
1337{
1338 return m_modules.end();
1339}
1340
1342{
1343 return m_modules.range();
1344}
1345
1347{
1348 return m_towers.begin();
1349}
1350
1352{
1353 return m_towers.end();
1354}
1355
1357{
1358 return m_towers.range();
1359}
1360
1365
1367{
1368 return channels().end();
1369}
1370
1375
1377{
1378 return m_pmts.begin();
1379}
1380
1382{
1383 return m_pmts.end();
1384}
1385
1387{
1388 return m_pmts.range();
1389}
1390
1392{
1393 return m_adcs.begin();
1394}
1395
1397{
1398 return m_adcs.end();
1399}
1400
1402{
1403 return m_adcs.range();
1404}
1405
1406const std::vector<Identifier>& Tile_Base_ID::region_ids() const
1407{
1408 return regions().ids();
1409}
1410
1411const std::vector<Identifier>& Tile_Base_ID::module_ids() const
1412{
1413 return m_modules.ids();
1414}
1415
1416const std::vector<Identifier>& Tile_Base_ID::tower_ids() const
1417{
1418 return m_towers.ids();
1419}
1420
1421const std::vector<Identifier>& Tile_Base_ID::cell_ids() const
1422{
1423 return channels().ids();
1424}
1425
1426const std::vector<Identifier>& Tile_Base_ID::pmt_ids() const
1427{
1428 return m_pmts.ids();
1429}
1430
1431const std::vector<Identifier>& Tile_Base_ID::adc_ids() const
1432{
1433 return m_adcs.ids();
1434}
1435
1436
1438{
1439 return this->region_id (exp_id[m_SECTION_INDEX],
1440 exp_id[m_SIDE_INDEX]);
1441}
1442
1444{
1445 return this->module_id (exp_id[m_SECTION_INDEX],
1446 exp_id[m_SIDE_INDEX],
1447 exp_id[m_MODULE_INDEX]);
1448}
1449
1451{
1452 return this->tower_id (exp_id[m_SECTION_INDEX],
1453 exp_id[m_SIDE_INDEX],
1454 exp_id[m_MODULE_INDEX],
1455 exp_id[m_TOWER_INDEX]);
1456}
1457
1459{
1460 return this->cell_id (exp_id[m_SECTION_INDEX],
1461 exp_id[m_SIDE_INDEX],
1462 exp_id[m_MODULE_INDEX],
1463 exp_id[m_TOWER_INDEX],
1464 exp_id[m_SAMPLE_INDEX]);
1465}
1466
1468{
1469 return this->pmt_id (exp_id[m_SECTION_INDEX],
1470 exp_id[m_SIDE_INDEX],
1471 exp_id[m_MODULE_INDEX],
1472 exp_id[m_TOWER_INDEX],
1473 exp_id[m_SAMPLE_INDEX],
1474 exp_id[m_PMT_INDEX]);
1475}
1476
1478{
1479 return this->adc_id (exp_id[m_SECTION_INDEX],
1480 exp_id[m_SIDE_INDEX],
1481 exp_id[m_MODULE_INDEX],
1482 exp_id[m_TOWER_INDEX],
1483 exp_id[m_SAMPLE_INDEX],
1484 exp_id[m_PMT_INDEX],
1485 exp_id[m_ADC_INDEX]);
1486}
1487
1488int Tile_Base_ID::eta_min(const Identifier& id, const IdContext& context) const
1489{
1490 ExpandedIdentifier expId;
1491 if(!get_expanded_id(id, expId, &context)) {
1492 int result = -999;
1493 for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
1494 const Range& range = m_full_tower_range[i];
1495 if (range.match(expId)) {
1496 const Range::field& eta_field = range[m_TOWER_INDEX];
1497 if (not eta_field.empty()) {
1498 int etamin = eta_field.get_minimum();
1499 if (-999 == result) {
1500 result = etamin;
1501 }
1502 else {
1503 if (etamin < result) result = etamin;
1504 }
1505 }
1506 }
1507 }
1508 return (result);
1509 }
1510 return (-999);
1511}
1512
1513int Tile_Base_ID::eta_max(const Identifier& id, const IdContext& context) const
1514{
1515 ExpandedIdentifier expId;
1516 if(!get_expanded_id(id, expId, &context)) {
1517 int result = -999;
1518 for (unsigned int i = 0; i < m_full_cell_range.size(); ++i) {
1519 const Range& range = m_full_cell_range[i];
1520 if (range.match(expId)) {
1521 const Range::field& eta_field = range[m_TOWER_INDEX];
1522 if (not eta_field.empty()) {
1523 int etamax = eta_field.get_maximum();
1524 if (result < etamax) result = etamax;
1525 }
1526 }
1527 }
1528 return (result);
1529 }
1530 return (-999); // default
1531}
1532
1534{
1535 IdContext context = tower_context();
1536 return eta_min (id, context);
1537}
1538
1540{
1541 IdContext context = cell_context();
1542 return eta_max (id, context);
1543}
1544
1546{
1547 IdContext context = region_context();
1548 return eta_min (id, context);
1549}
1550
1552{
1553 IdContext context = region_context();
1554 return eta_max (id, context);
1555}
1556
1558{
1559 ExpandedIdentifier expId;
1560 IdContext context = cell_context();
1561 if(!get_expanded_id(id, expId, &context)) {
1562 int result = -999;
1563 for (unsigned int i = 0; i < m_full_cell_range.size(); ++i) {
1564 const Range& range = m_full_cell_range[i];
1565 if (range.match(expId)) {
1566 const Range::field& phi_field = range[m_MODULE_INDEX];
1567 if (not phi_field.empty()) {
1568 int phimax = phi_field.get_maximum();
1569 if (result < phimax) result = phimax;
1570 }
1571 }
1572 }
1573 return (result);
1574 }
1575 return (-999); // default
1576}
1577
1579 ExpandedIdentifier& exp_id,
1580 const IdContext* context) const
1581{
1582 int result = 1;
1583
1584 size_t begin = (context) ? context->begin_index() : 0;
1585 size_t end = (context) ? context->end_index() : m_ADC_INDEX;
1586 assert (end <= m_ADC_INDEX);
1587
1588 if (0 == end) {
1589 result = 0;
1590 }
1591 else if ( 0 == begin) {
1593 result = dict()->unpack(group(), id, empty, end, exp_id);
1594 }
1595 else {
1596 result = dict()->unpack(group(), id, context->prefix_id(), end, exp_id);
1597 }
1598 return result;
1599}
1600
1601int Tile_Base_ID::initLevelsFromDict (const std::string& group_name)
1602{
1603 if(!dict()) {
1604 ATH_MSG_ERROR("initLevelsFromDict - dictionary NOT initialized ");
1605 return (1);
1606 }
1607
1608 // Find out which identifier field corresponds to each level.
1609
1610 m_SYSTEM_INDEX = 999;
1611 m_SECTION_INDEX = 999;
1612 m_SIDE_INDEX = 999;
1613 m_MODULE_INDEX = 999;
1614 m_TOWER_INDEX = 999;
1615 m_SAMPLE_INDEX = 999;
1616 m_PMT_INDEX = 999;
1617 m_ADC_INDEX = 999;
1618
1619 const IdDictGroup* group = dict()->find_group(group_name);
1620 if ( !group ){
1621 ATH_MSG_ERROR("initLevelsFromDict - cannot find " << group_name
1622 << " group' field ");
1623 }
1624 else {
1625 m_tile_region_index = group->region(0).index();
1626 }
1627
1628 // Fing a Tile region
1629 const IdDictField* field = dict()->find_field("subdet") ;
1630 if (field) {
1631 m_SYSTEM_INDEX = field->index();
1632 }
1633 else {
1634 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'subdet' field ");
1635 return (1);
1636 }
1637
1638 field = dict()->find_field("section") ;
1639 if (field) {
1640 m_SECTION_INDEX = field->index();
1641 }
1642 else {
1643 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'section' field ");
1644 return (1);
1645 }
1646
1647 field = dict()->find_field("side") ;
1648 if (field) {
1649 m_SIDE_INDEX = field->index();
1650 }
1651 else {
1652 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'side' field ");
1653 return (1);
1654 }
1655
1656 field = dict()->find_field("module") ;
1657 if (field) {
1658 m_MODULE_INDEX = field->index();
1659 }
1660 else {
1661 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'module' field ");
1662 return (1);
1663 }
1664
1665 field = dict()->find_field("tower") ;
1666 if (field) {
1667 m_TOWER_INDEX = field->index();
1668 }
1669 else {
1670 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'tower' field ");
1671 return (1);
1672 }
1673
1674 field = dict()->find_field("sampling") ;
1675 if (field) {
1676 m_SAMPLE_INDEX = field->index();
1677 }
1678 else {
1679 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'sampling' field ");
1680 return (1);
1681 }
1682
1683 field = dict()->find_field("pmt") ;
1684 if (field) {
1685 m_PMT_INDEX = field->index();
1686 }
1687 else {
1688 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'pmt' field ");
1689 return (1);
1690 }
1691
1692 field = dict()->find_field("adc") ;
1693 if (field) {
1694 m_ADC_INDEX = field->index();
1695 }
1696 else {
1697 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'adc' field ");
1698 return (1);
1699 }
1700
1701 const IdDictRegion& region = dict()->region(m_tile_region_index);
1702
1703 m_system_impl = region.implementation(m_SYSTEM_INDEX);
1704 m_section_impl = region.implementation(m_SECTION_INDEX);
1705 m_side_impl = region.implementation(m_SIDE_INDEX);
1706 m_module_impl = region.implementation(m_MODULE_INDEX);
1707 m_tower_impl = region.implementation(m_TOWER_INDEX);
1708 m_sample_impl = region.implementation(m_SAMPLE_INDEX);
1709 m_pmt_impl = region.implementation(m_PMT_INDEX);
1710 m_adc_impl = region.implementation(m_ADC_INDEX);
1711
1712 ATH_MSG_DEBUG("initLevelsFromDict decode index and bit fields for each level: " );
1713 ATH_MSG_DEBUG(" system [" << m_SYSTEM_INDEX << "] " << m_system_impl );
1714 ATH_MSG_DEBUG(" section [" << m_SECTION_INDEX << "] " << m_section_impl );
1715 ATH_MSG_DEBUG(" side [" << m_SIDE_INDEX << "] " << m_side_impl );
1716 ATH_MSG_DEBUG(" module [" << m_MODULE_INDEX << "] " << m_module_impl );
1717 ATH_MSG_DEBUG(" tower [" << m_TOWER_INDEX << "] " << m_tower_impl );
1718 ATH_MSG_DEBUG(" sampling [" << m_SAMPLE_INDEX << "] " << m_sample_impl );
1719 ATH_MSG_DEBUG(" pmt [" << m_PMT_INDEX << "] " << m_pmt_impl );
1720 ATH_MSG_DEBUG(" adc [" << m_ADC_INDEX << "] " << m_adc_impl );
1721
1722 return(0) ;
1723}
1724
1726{
1727 if (regions().init (*this, "regions", m_full_region_range,
1729 m_SIDE_INDEX))
1730 return 1;
1731
1732 if (m_modules.init (*this, "modules", m_full_module_range,
1735 return 1;
1736
1737 if (m_towers.init (*this, "towers", m_full_tower_range,
1740 return 1;
1741
1742 if (channels().init (*this, "channels", m_full_cell_range,
1745 return 1;
1746
1747 if (m_pmts.init (*this, "pmts", m_full_pmt_range,
1749 m_PMT_INDEX))
1750 return 1;
1751
1752 if (m_adcs.init (*this, "adcs", m_full_adc_range,
1754 m_ADC_INDEX))
1755 return 1;
1756
1757 return (0);
1758}
1759
1760
1762 std::vector<IdentifierHash>& neighbourList) const
1763{
1764 int result = 1;
1765
1766 if(!m_do_neighbours) {
1767 ATH_MSG_WARNING("get_neighbours: neighbours not initialized !!! returning empty list");
1768 neighbourList.resize(0);
1769 return result;
1770 }
1771
1772 neighbourList.clear();
1773
1774 bool prevSmp = (option & prevInSamp);
1775 bool nextSmp = (option & nextInSamp);
1776
1777 bool corners2DOnly = ( (option & all2D) == corners2D );
1778
1779 bool prevPhi = corners2DOnly || (option & prevInPhi);
1780 bool nextPhi = corners2DOnly || (option & nextInPhi);
1781 bool prevEta = corners2DOnly || (option & prevInEta);
1782 bool nextEta = corners2DOnly || (option & nextInEta);
1783
1784 std::vector<IdentifierHash> inpList;
1785 std::vector<IdentifierHash>::iterator inpItr;
1786 std::vector<IdentifierHash>::iterator inpLast;
1787
1788 inpList.push_back(id_orig);
1789
1790 // all phi neighbours (just 2)
1791 if (prevPhi) m_neighbour.prev_phi(id_orig,neighbourList);
1792 if (nextPhi) m_neighbour.next_phi(id_orig,neighbourList);
1793
1794 if ( (option & all2D) == faces2D) {
1795 // do nothing
1796
1797 } else if (corners2DOnly) {
1798 // neighbours of phi-neigbours are 2D corners
1799 inpList = std::move(neighbourList); // copy 2 phi neighbours to input list
1800 neighbourList.clear(); // and clear neighbour list
1801
1802 } else if ( (option & all2D) == all2D) {
1803 // copy all neighbours to input list
1804 inpList.insert (inpList.end(), neighbourList.begin(), neighbourList.end());
1805
1806 }
1807
1808 // all eta neighbours
1809 inpItr = inpList.begin();
1810 inpLast = inpList.end();
1811 for ( ; inpItr != inpLast; ++inpItr) {
1812 IdentifierHash id = (*inpItr);
1813 if (prevEta) m_neighbour.prev_eta(id,neighbourList);
1814 if (nextEta) m_neighbour.next_eta(id,neighbourList);
1815 }
1816
1817 // all sampling neighbours
1818 if( (option & all3DwithCorners) == all3DwithCorners ) {
1819
1820 inpItr = inpList.begin();
1821 inpLast = inpList.end();
1822 for ( ; inpItr != inpLast; ++inpItr) {
1823 IdentifierHash id = (*inpItr);
1824 m_neighbour.prev_samp_wide(id,neighbourList);
1825 m_neighbour.next_samp_wide(id,neighbourList);
1826 }
1827
1828 } else {
1829
1830 if (prevSmp) m_neighbour.prev_samp(id_orig,neighbourList);
1831 if (nextSmp) m_neighbour.next_samp(id_orig,neighbourList);
1832
1833 }
1834
1835 if (!neighbourList.empty()) result = 0;
1836
1837 return result;
1838}
1839
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
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).
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
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
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & name() const
Dictionary name.
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
Definition index.py:1