 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 const std::string&
group) :
19 ATH_MSG_INFO(
"Request to reinitialize not satisfied - tags have not changed");
33 ATH_MSG_ERROR(
" initialize_from_dict - cannot access MuonSpectrometer dictionary ");
47 if (atlasDict->
get_label_value(
"subdet",
"MuonSpectrometer", muonField)) {
48 ATH_MSG_ERROR(
"Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary ");
57 if (muon_range.
size()) {
58 ATH_MSG_INFO(
"MultiRange built successfully to Technology "
59 <<
"MultiRange size is " << muon_range.
size());
116 ATH_MSG_WARNING(
"MuonIdHelper::get_module_hash(): Could not determine hash for identifier " <<
id.get_compact());
135 ATH_MSG_WARNING(
"MuonIdHelper::get_detectorElement_hash(): Could not determine hash for identifier " <<
id.get_compact());
141 return get_hash(
id, hash_id, &context);
172 if (!
get_compact_id(old_id, compact_id, &context)) { new_id = compact_id; }
187 }
else if (0 ==
begin) {
210 for (
size_t i = 0;
i <
id.fields();
i++) exp_id[
i] =
id[
i];
214 size_t end = (context) ? context->
end_index() :
id.fields() - 1;
247 ATH_MSG_ERROR(
" initLevelsFromDict - dictionary NOT initialized ");
263 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find a muon station index: id, reg"
274 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
283 for (
size_t i = 0;
i <
field->get_label_number();
i++) {
291 if (
'B' ==
name[0]) {
297 }
else if (
'F' ==
name[2]) {
305 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationName' field ");
312 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationEta' field ");
319 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationPhi' field ");
327 for (
size_t i = 0;
i <
field->get_label_number(); ++
i) {
337 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'technology' field ");
363 unsigned int nids = 0;
364 std::set<Identifier>
ids;
368 for (
const auto & expId:rit) {
371 if (!(
ids.insert(
id)).second) {
373 <<
" Error: duplicated id for module id. nid " << (
int)nids <<
" compact id " <<
id <<
" id ");
381 <<
" Error: set size NOT EQUAL to element hash max. size " <<
ids.size() <<
" hash max " <<
m_module_hash_max);
387 std::set<Identifier>::const_iterator
first =
ids.begin();
388 std::set<Identifier>::const_iterator last =
ids.end();
409 unsigned int nids = 0;
410 std::set<Identifier>
ids;
414 for (
const auto & expId:rit) {
417 if (!(
ids.insert(
id)).second) {
419 <<
" Error: duplicated id for channel id. nid " << nids <<
" compact id " <<
id <<
" id ");
433 std::set<Identifier>::const_iterator
first =
ids.begin();
434 std::set<Identifier>::const_iterator last =
ids.end();
455 unsigned int nids = 0;
456 std::set<Identifier>
ids;
460 for (
const auto & expId:rit) {
464 if (!(
ids.insert(
id)).second) {
466 <<
" Error: duplicated id for channel id. nid " << nids <<
" compact id " <<
id <<
" id ");
475 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size() <<
" hash max " <<
m_channel_hash_max);
541 for (
const auto &
id: rit) {
558 if (
get_hash(compact_id, hash_id, &wcontext)) {
559 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get hash, exp/compact "
560 <<
" " << std::hex << compact_id << std::dec <<
endmsg);
564 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get compact, exp/compact ");
569 unsigned short index = hash_id;
581 if (
get_hash(compact_id, hash_id, &wcontext)) {
582 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous phi hash, exp/compact "
583 <<
" " << std::hex << compact_id << std::dec);
587 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous phi compact, exp/compact ");
599 if (
get_hash(compact_id, hash_id, &wcontext)) {
600 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next phi hash, exp/compact "
601 <<
" " << std::hex << compact_id << std::dec);
605 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next phi compact, exp/compact ");
617 if (
get_hash(compact_id, hash_id, &wcontext)) {
618 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous eta hash, exp/compact "
619 <<
" " << std::hex << compact_id << std::dec);
623 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous eta compact, exp/compact ");
635 if (
get_hash(compact_id, hash_id, &wcontext)) {
636 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next eta hash, exp/compact "
637 <<
" " << std::hex << compact_id << std::dec);
641 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next eta compact, exp/compact ");
662 ATH_MSG_ERROR(
"test_module_packing: Unable to get expanded id. Compact id " << compact);
667 ATH_MSG_ERROR(
"test_module_packing: Unable to get compact id. Expanded id " << std::string(
id));
670 if (compact != new_compact) {
671 ATH_MSG_ERROR(
"test_module_packing: new and old compacts not equal "
672 <<
"New/old/expanded ids " << new_compact <<
" " << compact <<
" " << std::string(
id));
677 ATH_MSG_INFO(
"test_module_packing: Successful tested " << nids <<
" ids. ");
679 ATH_MSG_ERROR(
"Unable to test module is packing - no dictionary has been defined. ");
687 ATH_MSG_ERROR(
"Unable to get expanded id. Compact id " << compact);
695 if (compact != new_compact) {
696 ATH_MSG_ERROR(
"new and old compacts not equal. New/old/expanded ids " << new_compact <<
" " << compact <<
" "
718 if (
name.size() >= 2) {
719 if (
'I' ==
name[1] ||
'4' ==
name[1])
return 0;
720 if (
'E' ==
name[1] ||
'1' ==
name[1])
return 1;
721 if (
'M' ==
name[1] ||
'2' ==
name[1])
return 2;
722 if (
'O' ==
name[1] ||
'3' ==
name[1])
return 3;
724 if (
name ==
"CSS" ||
name ==
"CSL")
return 0;
bool is_muon(const Identifier &id) const
IdDictRegion * find_region(const std::string ®ion_name) const
int get_prev_in_phi(const IdentifierHash &id, IdentifierHash &prev) const
Access to hashes for neighbors in phi and eta (return == 0 for neighbor found)
hash_vec m_next_eta_module_vec
bool validStation(int stationName, int technology) const
int stationNameIndex(const std::string &name) const
IdContext detectorElement_context() const
id for detector element
std::map< int, std::string > m_technologyIdxToNameMap
Mapping int -> string.
constexpr uint8_t stationPhi
station Phi 1 to 8
MultiRange build_multirange() const
Get MultiRange for full dictionary.
bool is_rpc(Identifier id) const
hash_vec m_prev_eta_module_vec
void test_id(const Identifier &id, const IdContext &context) const
int stationRegion(const Identifier &id) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
const_id_iterator detectorElement_begin() const
Iterators over full set of ids.
std::set< int > m_isSmall
bool is_rpc(const Identifier &id) 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)
int technologyIndex(const std::string &name) const
bool is_csc(Identifier id) const
hash_vec m_next_phi_module_vec
std::set< int > m_stationInTech
const MultiRange & multiRange() const
multirange
IdContext channel_context() const
id for channel
bool is_mdt(const Identifier &id) const
const IdDictRegion & region(size_t i) const
Region at index i.
size_type m_detectorElement_hash_max
const_id_iterator channel_end() const
IdDictFieldImplementation m_sta_impl
size_type end_index() const
size_type m_channel_hash_max
std::map< std::string, int > m_technologyNameToIdxMap
Mapping string -> int.
bool is_mm(Identifier id) const
value_type get_compact() const
Get the compact id.
bool is_csc(const Identifier &id) const
const std::string & technologyString(const int &index) const
const_id_iterator module_end() const
hash_vec m_prev_phi_module_vec
int stationName(const Identifier &id) const
const_id_iterator detectorElement_end() const
#define ATH_MSG_VERBOSE(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
IdDictFieldImplementation m_phi_impl
virtual bool isStNameInTech(const std::string &stationName) const =0
The valid element checks converted the identifier to a stationName string in order to assess whether ...
int unpack(Identifier id) const
Identifier manipulation methods.
MultiRange m_full_channel_range
int stationNameIndexMax() const
int pack32(const ExpandedIdentifier &id, size_t index1, size_t index2, Identifier &packedId) const
Pack to 32bits the subset of id between (inclusive) index1 and index2 - this is generic,...
IdDictField * find_field(const std::string &name) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
bool is_tgc(const Identifier &id) const
bool isSmall(const Identifier &id) const
std::map< int, std::string > m_stationIdxToNameMap
Mapping int -> string.
bool is_stgc(const Identifier &id) const
const IdDictFieldImplementation & implementation(size_t i) const
size_type begin_index() const
std::map< std::string, int > m_stationNameToIdxMap
Mapping string -> int.
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
void addStationID(Identifier &id, int stationName, int stationEta, int stationPhi, int technology) const
bool is_tgc(Identifier id) const
int get_prev_in_eta(const IdentifierHash &id, IdentifierHash &prev) const
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const
MultiRange m_full_detectorElement_range
bool isForward(const Identifier &id) const
bool get_next(element_type current, element_type &next) const
id_vec::const_iterator id_vec_it
const std::string & group() const
Group name for this helper.
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const
MultiRange m_full_module_range
MuonIdHelper(const std::string &logName, const std::string &group)
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Create expanded id from compact id (return == 0 for OK)
bool is_mm(const Identifier &id) const
virtual int get_hash_calc(const Identifier &compact_id, IdentifierHash &hash_id, const IdContext *context) const
int technologyNameIndexMax() const
IdDictFieldImplementation m_eta_impl
IdDictFieldImplementation m_muon_impl
int nStationNames() const
int get_next_in_phi(const IdentifierHash &id, IdentifierHash &next) const
int register_dict_tag(const IdDictMgr &dict_mgr, const std::string &dict_name)
Register the file and tag names for a particular IdDict dictionary.
void clear()
Reset to invalid state.
int stationPhi(const Identifier &id) const
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & stationNameString(const int &index) const
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...
virtual int get_channel_hash(const Identifier &id, IdentifierHash &hash_id) const
const ExpandedIdentifier & prefix_id() const
Accessors.
A MultiRange combines several Ranges.
id_vec m_detectorElement_vec
bool isBarrel(const Identifier &id) const
ExpandedIdentifier muon_exp(void) const
int stationEta(const Identifier &id) const
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
std::set< int > m_isBarrel
size_type module_hash_max() const
the maximum hash value
size_type m_module_hash_max
bool isEndcap(const Identifier &id) const
virtual int init_detectorElement_hashes()
size_type m_station_region_index
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
size_type m_TECHNOLOGY_INDEX
bool is_muon(Identifier id) const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
void test_module_packing() const
Tests of packing.
#define ATH_MSG_WARNING(x)
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)
int technology(const Identifier &id) const
Identifier muon(void) const
Identifier::size_type size_type
int get_expanded_id_calc(const Identifier &compact_id, ExpandedIdentifier &id, const IdContext *context) const
const_id_iterator channel_begin() const
Iterators over full set of ids.
IdContext module_context() const
id for module
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
size_type m_DETECTORELEMENT_INDEX
bool get_previous(element_type current, element_type &previous) const
Returns false if previous/next is at end of range, or not possible.
std::vector< Identifier >::const_iterator const_id_iterator
IdDictFieldImplementation m_tec_impl
unsigned long long value_type
int get_next_in_eta(const IdentifierHash &id, IdentifierHash &next) const
bool is_stgc(Identifier id) const
int init_channel_hashes()
const std::vector< Identifier > & idVector() const
the id's
static constexpr int NOT_VALID_HASH
size_type cardinality() const
Computes a possible cardinality from all ranges.
constexpr uint8_t stationEta
1 to 3
const_id_iterator module_begin() const
Iterators over full set of ids.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
std::set< int > m_isForward
int get_compact_id(const ExpandedIdentifier &id, Identifier &compact_id, const IdContext *context) const
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
bool validTechnology(int technology) const
IdContext technology_context() const
access to IdContext's which define which levels or fields are contained in the Muon id
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
bool isInitialized() const
bool is_mdt(Identifier id) const
size_type m_CHANNEL_INDEX
static const std::string BAD_NAME
size_type channel_hash_max() const
const IdDictDictionary * m_dict