25 const std::string&
group)
204 const std::string &dict_name) {
210 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" No dictionary found");
234 ATH_MSG_ERROR(
"reinitialize: dict names and tags vectors not the same length ");
237 for (
unsigned int i = 0; i <
m_dict_names.size(); ++i) {
261 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Failed to register dict tag");
266 m_helper = std::make_unique<AtlasDetectorIDHelper>().release();
269 if (
m_helper->initialize_from_dictionary(dict_mgr)){
270 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Initialization from dictionary failed.");
275 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Level initialization from dictionary failed.");
287 return id.fields() > 0 &&
id[0] ==
m_INDET_ID;
290 return id.fields() > 0 &&
id[0] ==
m_LAR_ID;
293 return id.fields() > 0 &&
id[0] ==
m_TILE_ID;
296 return id.fields() > 0 &&
id[0] ==
m_MUON_ID;
299 return id.fields() > 0 &&
id[0] ==
m_CALO_ID;
309 return is_indet(
id) &&
id.fields() > 1;
333 return is_lar_fcal(
id) &&
id.fields() > 3 &&std::abs(
id[3]) == 0;
370 std::string
result(
"Unable to decode id");
371 unsigned int max_index = (context) ? context->
end_index() : 999;
373 if (!
id.is_valid()) {
405 if (dict->unpack(
m_group, compact, prefix, max_index, expId)) {
413 for (
unsigned int i = 0; i < expId.
fields(); ++i) {
418 result += std::format(
"{}", expId[i]);
436 unsigned int max_index = (context) ? context->
end_index() : 999;
460 ATH_MSG_WARNING(__func__<<
":"<<__LINE__<<
" No dictionary could be associated to "<<
id);
463 if (dict->unpack(
m_group, compact, prefix, max_index,
" ",
result)) {
501 int fields =
id.fields();
503 for (
int i = 0; i < fields; ++i) {
507 result += std::format(
"{}",
id[i]);
556 auto assignSystemId = [
this, &field](
const std::string& systemName,
558 bool mandatory =
true) ->
bool {
561 idToAssign =
label->value();
562 ATH_MSG_VERBOSE(
"Assign system "<<systemName<<
" to "<<idToAssign<<
".");
565 ATH_MSG_ERROR(
"initLevelsFromDict - label "<<systemName<<
" does NOT have a value ");
569 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find '"<<systemName<<
"' label");
572 ATH_MSG_DEBUG(
"initLevelsFromDict - unable to find '"<<systemName<<
"' label");
580 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access InnerDetector dictionary");
587 m_isHighLuminosityLHC = (versionString.find(
"ITk") != std::string::npos || versionString.find(
"P2-RUN4") != std::string::npos);
592 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for InnerDetector dictionary");
599 if (!assignSystemId(
"SCT",
m_SCT_ID)) {
606 if (!assignSystemId(
"LuminosityDetectors",
m_LUMI_ID, versionString.find(
"PLR") != std::string::npos ||
607 versionString.find(
"P2-RUN4") != std::string::npos)) {
618 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access ForwardDetectors dictionary");
630 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for ForwardDetectors dictionary");
633 if (!assignSystemId(
"ALFA",
m_ALFA_ID)) {
636 if (!assignSystemId(
"BCM",
m_BCM_ID)) {
642 if (!assignSystemId(
"ZDC",
m_ZDC_ID)) {
650 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access LArCalorimeter dictionary");
659 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for LArCalorimeter dictionary");
675 ATH_MSG_DEBUG(
"initLevelsFromDict - unable to find 'module' field for miniFCAL");
682 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access TileCalorimeter dictionary");
692 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access MuonSpectrometer dictionary");
711 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationName' field for MuonSpectrometer dictionary");
715 size_type nStationNames = field->get_label_number();
716 std::string stationNameString{};
719 int stationNameIndex{};
720 int maxStationNameIndex{-1};
721 for (
size_type i = 0; i < nStationNames; ++i) {
725 stationNameIndex =
label.valued() ?
label.value() : i;
727 maxStationNameIndex = std::max(maxStationNameIndex, stationNameIndex);
736 for (
size_type i = 0; i < nStationNames; ++i) {
738 stationNameString =
label.name();
741 stationNameIndex =
label.valued() ?
label.value() : i;
744 bool found{
false}, stationNameFound{
false}, technologyFound{
false};
745 std::string techLabel{};
747 for (
size_type j = 0; j < nregions; ++j) {
751 stationNameFound = technologyFound =
false;
753 for (
size_type k = 0; k < nentries; ++k) {
760 if (range->field_name() ==
"stationName") {
762 if (range->label() == stationNameString) {
764 stationNameFound =
true;
771 }
else if (range->field_name() ==
"technology") {
772 technologyFound =
true;
773 techLabel = range->label();
776 if (!stationNameFound || !technologyFound) {
781 if (techLabel ==
"MDT") {
783 }
else if (techLabel ==
"RPC") {
785 }
else if (techLabel ==
"CSC") {
787 }
else if (techLabel ==
"TGC"){
789 }
else if (techLabel ==
"MM") {
791 }
else if (techLabel ==
"STGC") {
818 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'technology' field for MuonSpectrometer dictionary");
822 if (!assignSystemId(
"MDT",
m_MDT_ID)) {
825 if (!assignSystemId(
"RPC",
m_RPC_ID)) {
828 if (!assignSystemId(
"TGC",
m_TGC_ID)) {
831 if (!assignSystemId(
"STGC",
m_STGC_ID,
false)) {
834 if (!assignSystemId(
"MM",
m_MM_ID,
false)) {
837 if (!assignSystemId(
"CSC",
m_CSC_ID,
false)) {
845 ATH_MSG_WARNING(
"initLevelsFromDict - Warning cannot access Calorimeter dictionary");
855 if (
m_calo_dict->get_label_value(
"DetZside",
"negative_lvl1_side", value)) {
856 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_lvl1_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
861 if (
m_calo_dict->get_label_value(
"DetZside",
"positive_lvl1_side", value)) {
862 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_lvl1_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
869 if (
m_calo_dict->get_label_value(
"DetZside",
"negative_DMLar_side", value)) {
870 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_DMLar_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
875 if (
m_calo_dict->get_label_value(
"DetZside",
"positive_DMLar_side", value)) {
876 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_DMLar_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
884 if (
m_calo_dict->get_label_value(
"DetZside",
"negative_DMTile_side", value)) {
885 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_DMTile_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
890 if (
m_calo_dict->get_label_value(
"DetZside",
"positive_DMTile_side", value)) {
891 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_DMTile_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
898 if (
m_calo_dict->get_label_value(
"DetZside",
"no_side", value)) {
899 ATH_MSG_DEBUG(
"initLevelsFromDict - Could not get value for label 'no_side' of field 'DetZside' in dictionary " <<
m_calo_dict->name());
912 ATH_MSG_ERROR(
"initLevelsFromDict - - unable to find 'subdet' field from dict "
913 << top_dict->
name());
917 if (!assignSystemId(
"InnerDetector",
m_INDET_ID)) {
920 if (!assignSystemId(
"ForwardDetectors",
m_FWD_ID)) {
923 if (!assignSystemId(
"LArCalorimeter",
m_LAR_ID)) {
926 if (!assignSystemId(
"TileCalorimeter",
m_TILE_ID)) {
930 if (!assignSystemId(
"MuonSpectrometer",
m_MUON_ID)) {
933 if (!assignSystemId(
"Calorimeter",
m_CALO_ID)) {
938 if (top_dict->
name() ==
"InnerDetector") {
940 }
else if (top_dict->
name() ==
"Calorimeter") {
942 }
else if (top_dict->
name() ==
"LArCalorimeter") {
944 }
else if (top_dict->
name() ==
"MuonSpectrometer") {
945 name =
"stationName";
946 }
else if (top_dict->
name() ==
"TileCalorimeter") {
948 }
else if (top_dict->
name() ==
"ForwardDetectors") {
958 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find field " << name <<
" from dict "<< top_dict->
name());
962 ATH_MSG_ERROR(
"initLevelsFromDict - no top dictionary defined");
979 if (not
m_det_impl.ored_field().isEnumerated()) {
980 ATH_MSG_ERROR(
"initLevelsFromDict - ERROR det implementation is not enumerated: "
989 for (
size_type i = det.get_values().size(); i < nvalues; ++i) {
1002 region_index =
m_helper->lvl1_region_index();
1009 region_index =
m_helper->lar_em_region_index();
1016 region_index =
m_helper->lar_fcal_region_index();
1024 region_index =
m_helper->mdt_region_index();
1031 region_index =
m_helper->rpc_region_index();
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Identifier lar_hec(void) const
virtual std::string dictionaryVersion(void) const override
Range::field m_lvl1_field
ExpandedIdentifier zdc_exp(void) const
bool m_do_checks
Flag for subclasses to know whether or not to perform checks.
int muon_field_value() const
Identifier hgtd(void) const
Identifier lar_dm(void) const
std::string m_dict_version
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
IdDictFieldImplementation m_det_impl
const IdDictDictionary * m_calo_dict
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
virtual bool do_neighbours(void) const override
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
bool is_lar_em(Identifier id) const
Identifier tile(void) const
IdContext detsystem_context(void) const
IdContext (indicates id length) for detector systems.
Range::field m_lar_dm_field
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
const IdDictDictionary * m_muon_dict
IdDictFieldImplementation m_calo_side_impl
ExpandedIdentifier bcm_exp(void) const
ExpandedIdentifier lar_em_exp(void) const
LAr.
ExpandedIdentifier sct_exp(void) const
Identifier trt(void) const
std::vector< std::string > m_dict_names
List of dictionary names used by this helper.
ExpandedIdentifier pixel_exp(void) const
Inner Detector:
Identifier::size_type size_type
bool is_mdt(Identifier id) const
std::string m_group
Group name.
bool is_indet(Identifier id) const
ExpandedIdentifier lar_exp(void) const
virtual void setDictVersion(const IdDictMgr &dict_mgr, const std::string &name) override
Identifier stgc(void) const
ExpandedIdentifier lar_hec_exp(void) const
ExpandedIdentifier muon_exp(void) const
IdDictFieldImplementation m_lar_part_impl
int register_dict_tag(const IdDictMgr &dict_mgr, const std::string &dict_name)
Register the file and tag names for a particular IdDict dictionary.
bool is_lar(Identifier id) const
Range::field m_lvl1_onl_field
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
bool is_stgc(Identifier id) const
IdDictFieldImplementation m_lar_fcal_module_impl
IdDictFieldImplementation m_muon_mdt_impl
bool is_rpc(Identifier id) const
virtual ~AtlasDetectorID()
IdDictFieldImplementation m_indet_part_impl
Identifier mdt(void) const
void show(Identifier id, const IdContext *context=0, char sep='.') const
Short print out of any identifier (optionally provide separation character - default is '.
Identifier lar_lvl1(void) const
bool is_sct(Identifier id) const
IdDictFieldImplementation m_muon_rpc_impl
ExpandedIdentifier indet_exp(void) const
Detector systems:
ExpandedIdentifier lumi_exp(void) const
bool is_lar_dm(Identifier id) const
LAr/Tile dead material:
int calo_field_value() const
virtual void set_do_checks(bool do_checks) override
std::vector< std::string > m_dict_tags
List of dictionary versions used by this helper.
bool is_tgc(Identifier id) const
size_type m_MUON_SUBDET_INDEX
ExpandedIdentifier lar_fcal_exp(void) const
bool is_lar_fcal(Identifier id) const
bool is_pixel(Identifier id) const
std::string to_range(const ExpandedIdentifier &id) const
bool is_plr(Identifier id) const
const std::vector< std::string > & dict_names(void) const
Dictionary names.
const std::vector< std::string > & dict_tags(void) const
Version tags for subdet dictionaries.
bool is_lvl1_online(Identifier id) const
const std::vector< std::string > & file_names(void) const
File names for subdet dictionaries.
const IdDictDictionary * m_tile_dict
ExpandedIdentifier fwd_exp(void) const
const IdDictDictionary * m_fwd_dict
bool is_muon(Identifier id) const
Identifier mm(void) const
int initLevelsFromDict(const IdDictMgr &dict_mgr)
ExpandedIdentifier trt_exp(void) const
int lar_field_value() const
bool is_hgtd(Identifier id) const
bool is_calo(Identifier id) const
IdContext subdet_context(void) const
IdContext (indicates id length) for sub-detector.
Identifier calo(void) const
bool is_tile_dm(Identifier id) const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Identifier csc(void) const
bool is_csc(Identifier id) const
Identifier lar(void) const
Identifier sct(void) const
Identifier pixel(void) const
bool is_tile(Identifier id) const
Identifier muon(void) const
ExpandedIdentifier tile_exp(void) const
bool is_lar_minifcal(Identifier id) const
AtlasDetectorIDHelper * m_helper
bool is_mm(Identifier id) const
const IdDictDictionary * m_indet_dict
void print(Identifier id, const IdContext *context=0) const
Expanded print out of any identifier.
ExpandedIdentifier lucid_exp(void) const
Identifier lumi(void) const
bool is_forward(Identifier id) const
virtual void set_do_neighbours(bool do_neighbours) override
bool is_lumi(Identifier id) const
ExpandedIdentifier alfa_exp(void) const
Forward.
ExpandedIdentifier hgtd_exp(void) const
int tile_field_value() const
bool is_lar_hec(Identifier id) const
Identifier lar_em(void) const
Identifier rpc(void) const
const IdDictDictionary * m_lar_dict
const std::string & group() const
Group name for this helper.
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override
Create hash id from compact id (return == 0 for OK)
Identifier tgc(void) const
Identifier lar_fcal(void) const
bool is_trt(Identifier id) const
ExpandedIdentifier calo_exp(void) const
std::vector< unsigned int > m_muon_tech_bits
Range::field m_tile_dm_field
bool m_isHighLuminosityLHC
int m_LAR_FCAL_MODULE_INDEX
bool m_is_initialized_from_dict
Identifier indet(void) const
Detector systems:
AtlasDetectorID(const std::string &name, const std::string &group)
bool is_lvl1_trig_towers(Identifier id) const
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
IdDictFieldImplementation m_muon_station_name_impl
Identifier tile_dm(void) const
std::vector< std::string > m_file_names
List of dictionary file names used by this helper.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
size_type end_index() const
const std::string & name() const
Dictionary name.
const IdDictField * find_field(const std::string &name) const
bool do_checks() const
Check whether or not to do checks for ids.
bool do_neighbours() const
Check whether or not to init neighbours.
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
const IdDictRegionEntry & entry(size_t i) const
const IdDictFieldImplementation & implementation(size_t i) const
This is a "hash" representation of an Identifier.
std::string label(const std::string &format, int i)