 |
ATLAS Offline Software
|
Go to the documentation of this file.
18 const std::string&
group)
197 const std::string &dict_name) {
203 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" No dictionary found");
227 ATH_MSG_ERROR(
"reinitialize: dict names and tags vectors not the same length ");
254 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Failed to register dict tag");
259 m_helper = std::make_unique<AtlasDetectorIDHelper>().release();
263 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Initialization from dictionary failed.");
268 ATH_MSG_ERROR(__func__<<
":"<<__LINE__<<
" - Level initialization from dictionary failed.");
280 return id.fields() > 0 &&
id[0] ==
m_INDET_ID;
283 return id.fields() > 0 &&
id[0] ==
m_LAR_ID;
286 return id.fields() > 0 &&
id[0] ==
m_TILE_ID;
289 return id.fields() > 0 &&
id[0] ==
m_MUON_ID;
292 return id.fields() > 0 &&
id[0] ==
m_CALO_ID;
302 return is_indet(
id) &&
id.fields() > 1;
326 return is_lar_fcal(
id) &&
id.fields() > 3 &&std::abs(
id[3]) == 0;
363 std::string
result(
"Unable to decode id");
364 unsigned int max_index = (context) ? context->
end_index() : 999;
394 if (dict->unpack(compact,
prefix, max_index, expId)) {
402 for (
unsigned int i = 0;
i < expId.fields(); ++
i) {
425 unsigned int max_index = (context) ? context->
end_index() : 999;
449 ATH_MSG_WARNING(__func__<<
":"<<__LINE__<<
" No dictionary could be associated to "<<
id);
452 if (dict->unpack(compact,
prefix, max_index,
" ",
result)) {
553 auto assignSystemId = [
this, &
field](
const std::string& systemName,
555 bool mandatory =
true) ->
bool {
558 idToAssign =
label->m_value;
559 ATH_MSG_VERBOSE(
"Assign system "<<systemName<<
" to "<<idToAssign<<
".");
562 ATH_MSG_ERROR(
"initLevelsFromDict - label "<<systemName<<
" does NOT have a value ");
566 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find '"<<systemName<<
"' label");
569 ATH_MSG_DEBUG(
"initLevelsFromDict - unable to find '"<<systemName<<
"' label");
577 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access InnerDetector dictionary");
584 m_isHighLuminosityLHC = (versionString.find(
"ITk") != std::string::npos || versionString.find(
"P2-RUN4") != std::string::npos);
589 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for InnerDetector dictionary");
596 if (!assignSystemId(
"SCT",
m_SCT_ID)) {
603 if (!assignSystemId(
"LuminosityDetectors",
m_LUMI_ID, versionString.find(
"PLR") != std::string::npos ||
604 versionString.find(
"P2-RUN4") != std::string::npos)) {
615 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access ForwardDetectors dictionary");
627 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for ForwardDetectors dictionary");
630 if (!assignSystemId(
"ALFA",
m_ALFA_ID)) {
633 if (!assignSystemId(
"BCM",
m_BCM_ID)) {
639 if (!assignSystemId(
"ZDC",
m_ZDC_ID)) {
647 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access LArCalorimeter dictionary");
656 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field for LArCalorimeter dictionary");
672 ATH_MSG_DEBUG(
"initLevelsFromDict - unable to find 'module' field for miniFCAL");
679 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access TileCalorimeter dictionary");
689 ATH_MSG_WARNING(
"initLevelsFromDict - cannot access MuonSpectrometer dictionary");
708 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationName' field for MuonSpectrometer dictionary");
713 std::string stationNameString{};
714 const std::vector<IdDictLabel *>& stationNameLabels =
field->m_labels;
717 int stationNameIndex{};
718 int maxStationNameIndex{-1};
722 stationNameIndex = stationNameLabels[
i]->m_valued ? stationNameLabels[
i]->m_value :
i;
724 maxStationNameIndex =
std::max(maxStationNameIndex, stationNameIndex);
735 stationNameString = stationNameLabels[
i]->m_name;
738 stationNameIndex = stationNameLabels[
i]->m_valued ? stationNameLabels[
i]->m_value :
i;
741 bool found{
false}, stationNameFound{
false}, technologyFound{
false};
742 std::string techLabel{};
743 for (
size_type j = 0; j < muonRegions.size(); ++j) {
748 stationNameFound = technologyFound =
false;
755 if (
range->m_field_name ==
"stationName") {
757 if (
range->m_label == stationNameString) {
759 stationNameFound =
true;
766 }
else if (
range->m_field_name ==
"technology") {
767 technologyFound =
true;
768 techLabel =
range->m_label;
771 if (!stationNameFound || !technologyFound) {
776 if (techLabel ==
"MDT") {
778 }
else if (techLabel ==
"RPC") {
780 }
else if (techLabel ==
"CSC") {
782 }
else if (techLabel ==
"TGC"){
784 }
else if (techLabel ==
"MM") {
786 }
else if (techLabel ==
"STGC") {
813 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'technology' field for MuonSpectrometer dictionary");
817 if (!assignSystemId(
"MDT",
m_MDT_ID)) {
820 if (!assignSystemId(
"RPC",
m_RPC_ID)) {
823 if (!assignSystemId(
"TGC",
m_TGC_ID)) {
826 if (!assignSystemId(
"STGC",
m_STGC_ID,
false)) {
829 if (!assignSystemId(
"MM",
m_MM_ID,
false)) {
832 if (!assignSystemId(
"CSC",
m_CSC_ID,
false)) {
840 ATH_MSG_WARNING(
"initLevelsFromDict - Warning cannot access Calorimeter dictionary");
851 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_lvl1_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
857 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_lvl1_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
865 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_DMLar_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
871 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_DMLar_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
880 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'negative_DMTile_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
886 ATH_MSG_ERROR(
"initLevelsFromDict - Could not get value for label 'positive_DMTile_side' of field 'DetZside' in dictionary " <<
m_calo_dict->
m_name);
903 field = top_dict->find_field(
"subdet");
907 ATH_MSG_ERROR(
"initLevelsFromDict - - unable to find 'subdet' field from dict "
908 << top_dict->m_name);
912 if (!assignSystemId(
"InnerDetector",
m_INDET_ID)) {
915 if (!assignSystemId(
"ForwardDetectors",
m_FWD_ID)) {
918 if (!assignSystemId(
"LArCalorimeter",
m_LAR_ID)) {
921 if (!assignSystemId(
"TileCalorimeter",
m_TILE_ID)) {
925 if (!assignSystemId(
"MuonSpectrometer",
m_MUON_ID)) {
928 if (!assignSystemId(
"Calorimeter",
m_CALO_ID)) {
933 if (top_dict->m_name ==
"InnerDetector") {
935 }
else if (top_dict->m_name ==
"Calorimeter") {
937 }
else if (top_dict->m_name ==
"LArCalorimeter") {
939 }
else if (top_dict->m_name ==
"MuonSpectrometer") {
940 name =
"stationName";
941 }
else if (top_dict->m_name ==
"TileCalorimeter") {
943 }
else if (top_dict->m_name ==
"ForwardDetectors") {
953 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find field " <<
name <<
" from dict "<< top_dict->m_name);
957 ATH_MSG_ERROR(
"initLevelsFromDict - no top dictionary defined");
976 ATH_MSG_ERROR(
"initLevelsFromDict - ERROR det implementation is not enumerated: "
bool is_pixel(Identifier id) const
const std::string & dict_tag(void) const
Access to the dictionary tag.
IdDictDictionary * m_muon_dict
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
bool is_forward(Identifier id) const
bool is_rpc(Identifier id) const
std::vector< unsigned int > m_muon_tech_bits
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
size_type lar_fcal_region_index() const
Identifier lumi(void) const
Identifier tile_dm(void) const
IdDictFieldImplementation m_indet_part_impl
AtlasDetectorIDHelper * m_helper
virtual void setMessageSvc(IMessageSvc *msgSvc) override
bool is_csc(Identifier id) const
bool is_lar_fcal(Identifier id) const
Identifier mm(void) const
std::string show_to_string(void) const
bool is_lar(Identifier id) const
int muon_field_value() const
bool is_sct(Identifier id) const
Identifier lar_fcal(void) const
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)
size_type lvl1_region_index() const
size_type end_index() const
int calo_field_value() const
Identifier stgc(void) const
Identifier lar_dm(void) const
bool is_mm(Identifier id) const
Identifier mdt(void) const
virtual void set_do_checks(bool do_checks) override
void pack(int value, Identifier &id) const
IdDictDictionary * m_tile_dict
size_type pixel_region_index() const
IMessageSvc * m_msgSvc
pointer to the message service
std::string m_dict_version
Identifier lar_em(void) const
bool m_do_checks
Flag for subclasses to know whether or not to perform checks.
bool is_trt(Identifier id) const
size_type m_MUON_SUBDET_INDEX
Identifier tgc(void) const
int m_LAR_FCAL_MODULE_INDEX
#define ATH_MSG_VERBOSE(x)
Identifier indet(void) const
Detector systems:
int lar_field_value() const
virtual bool do_neighbours(void) const override
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
IdContext detsystem_context(void) const
IdContext (indicates id length) for detector systems.
IdDictField * find_field(const std::string &name) const
Identifier lar_hec(void) const
size_type mdt_region_index() const
bool is_lvl1_trig_towers(Identifier id) const
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)
virtual std::string dictionaryVersion(void) const override
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
void set_quiet(bool quiet)
Set flag for suppressing informational output.
Identifier::size_type size_type
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Range::field m_tile_dm_field
Identifier hgtd(void) const
Identifier lar(void) const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
const std::vector< std::string > & dict_tags(void) const
Version tags for subdet dictionaries.
virtual void set_do_neighbours(bool do_neighbours) override
void set_ored_field(const Range::field &ored_field)
msgSvc
Provide convenience handles for various services.
std::string m_group
Group name.
IdDictDictionary * m_calo_dict
const std::vector< std::string > & file_names(void) const
File names for subdet dictionaries.
bool is_plr(Identifier id) const
bool m_is_initialized_from_dict
IdDictFieldImplementation m_lar_part_impl
Identifier csc(void) const
bool is_tgc(Identifier id) const
IdDictFieldImplementation m_muon_mdt_impl
IdDictFieldImplementation m_lar_fcal_module_impl
bool is_tile_dm(Identifier id) const
std::vector< IdDictRegion * > m_regions
bool m_isHighLuminosityLHC
Class to provide easy MsgStream access and capabilities.
Identifier calo(void) const
IdDictDictionary * m_fwd_dict
bool is_tile(Identifier id) const
bool is_lar_hec(Identifier id) const
const std::string & group() const
Group name for this helper.
Identifier tile(void) const
int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
const Range::field & ored_field() const
Range::field m_lvl1_onl_field
bool do_neighbours() const
Check whether or not to init neighbours.
bool m_quiet
If true, suppress DEBUG/INFO messages.
bool isEnumerated() const
IdDictFieldImplementation m_muon_rpc_impl
std::vector< IdDictRegionEntry * > m_entries
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_calo(Identifier id) const
const std::string & file_name(void) const
Access to file name.
int tile_field_value() const
int get_label_value(const std::string &field, const std::string &label, int &value) const
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
bool is_lar_minifcal(Identifier id) const
IdDictDictionary * m_indet_dict
AtlasDetectorID(const std::string &name="AtlasDetectorID", const std::string &group="")
void show(Identifier id, const IdContext *context=0, char sep='.') const
Short print out of any identifier (optionally provide separation character - default is '.
IdDictFieldImplementation m_calo_side_impl
bool is_indet(Identifier id) const
const std::vector< std::string > & dict_names(void) const
Dictionary names.
std::vector< std::string > m_dict_names
List of dictionary names used by this helper.
Range::field m_lar_dm_field
size_type lar_em_region_index() const
virtual void setDictVersion(const IdDictMgr &dict_mgr, const std::string &name) override
IdDictFieldImplementation m_muon_station_name_impl
void print(Identifier id, const IdContext *context=0) const
Expanded print out of any identifier.
Identifier lar_lvl1(void) const
Identifier trt(void) const
Identifier pixel(void) const
virtual ~AtlasDetectorID()
bool is_lumi(Identifier id) const
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
bool is_lar_dm(Identifier id) const
LAr/Tile dead material:
bool is_muon(Identifier id) const
IdDictFieldImplementation m_det_impl
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
size_type rpc_region_index() const
std::vector< std::string > m_file_names
List of dictionary file names used by this helper.
#define ATH_MSG_WARNING(x)
Identifier muon(void) const
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
bool do_checks() const
Check whether or not to do checks for ids.
IdDictDictionary * m_lar_dict
bool is_lvl1_online(Identifier id) const
bool is_stgc(Identifier id) const
Identifier sct(void) const
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
int initLevelsFromDict(const IdDictMgr &dict_mgr)
IdContext subdet_context(void) const
IdContext (indicates id length) for sub-detector.
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
std::vector< std::string > m_dict_tags
List of dictionary versions used by this helper.
std::vector< IdDictFieldImplementation > m_implementation
bool is_lar_em(Identifier id) const
void add_value(element_type value)
bool is_hgtd(Identifier id) const
bool is_mdt(Identifier id) const
Range::field m_lvl1_field
Identifier rpc(void) const
std::string to_range(const ExpandedIdentifier &id) const
std::vector< IdDictRegion * > m_all_regions