 |
ATLAS Offline Software
|
Go to the documentation of this file.
15 const std::string&
group) :
23 ATH_MSG_INFO(
"Request to reinitialize not satisfied - tags have not changed");
37 ATH_MSG_ERROR(
" initialize_from_dict - cannot access MuonSpectrometer dictionary ");
51 if (atlasDict->
get_label_value(
"subdet",
"MuonSpectrometer", muonField)) {
52 ATH_MSG_ERROR(
"Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary ");
61 if (muon_range.
size()) {
62 ATH_MSG_INFO(
"MultiRange built successfully to Technology "
63 <<
"MultiRange size is " << muon_range.
size());
120 ATH_MSG_WARNING(
"MuonIdHelper::get_module_hash(): Could not determine hash for identifier " <<
id.get_compact());
139 ATH_MSG_WARNING(
"MuonIdHelper::get_detectorElement_hash(): Could not determine hash for identifier " <<
id.get_compact());
145 return get_hash(
id, hash_id, &context);
176 if (!
get_compact_id(old_id, compact_id, &context)) { new_id = compact_id; }
191 }
else if (0 ==
begin) {
214 for (
size_t i = 0;
i <
id.fields();
i++) exp_id[
i] =
id[
i];
218 size_t end = (context) ? context->
end_index() :
id.fields() - 1;
251 ATH_MSG_ERROR(
" initLevelsFromDict - dictionary NOT initialized ");
267 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find a muon station index: id, reg"
278 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
287 for (
size_t i = 0;
i <
field->get_label_number();
i++) {
295 if (
'B' ==
name[0]) {
301 }
else if (
'F' ==
name[2]) {
309 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationName' field ");
316 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationEta' field ");
323 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'stationPhi' field ");
331 for (
size_t i = 0;
i <
field->get_label_number(); ++
i) {
341 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'technology' field ");
367 unsigned int nids = 0;
368 std::set<Identifier>
ids;
372 for (
const auto & expId:rit) {
375 if (!(
ids.insert(
id)).second) {
377 <<
" Error: duplicated id for module id. nid " << (
int)nids <<
" compact id " <<
id <<
" id ");
385 <<
" Error: set size NOT EQUAL to element hash max. size " <<
ids.size() <<
" hash max " <<
m_module_hash_max);
391 std::set<Identifier>::const_iterator
first =
ids.begin();
392 std::set<Identifier>::const_iterator last =
ids.end();
413 unsigned int nids = 0;
414 std::set<Identifier>
ids;
418 for (
const auto & expId:rit) {
421 if (!(
ids.insert(
id)).second) {
423 <<
" Error: duplicated id for channel id. nid " << nids <<
" compact id " <<
id <<
" id ");
437 std::set<Identifier>::const_iterator
first =
ids.begin();
438 std::set<Identifier>::const_iterator last =
ids.end();
459 unsigned int nids = 0;
460 std::set<Identifier>
ids;
464 for (
const auto & expId:rit) {
468 if (!(
ids.insert(
id)).second) {
470 <<
" Error: duplicated id for channel id. nid " << nids <<
" compact id " <<
id <<
" id ");
479 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size() <<
" hash max " <<
m_channel_hash_max);
545 for (
const auto &
id: rit) {
562 if (
get_hash(compact_id, hash_id, &wcontext)) {
563 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get hash, exp/compact "
564 <<
" " << std::hex << compact_id << std::dec <<
endmsg);
568 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get compact, exp/compact ");
573 unsigned short index = hash_id;
585 if (
get_hash(compact_id, hash_id, &wcontext)) {
586 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous phi hash, exp/compact "
587 <<
" " << std::hex << compact_id << std::dec);
591 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous phi compact, exp/compact ");
603 if (
get_hash(compact_id, hash_id, &wcontext)) {
604 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next phi hash, exp/compact "
605 <<
" " << std::hex << compact_id << std::dec);
609 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next phi compact, exp/compact ");
621 if (
get_hash(compact_id, hash_id, &wcontext)) {
622 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous eta hash, exp/compact "
623 <<
" " << std::hex << compact_id << std::dec);
627 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get previous eta compact, exp/compact ");
639 if (
get_hash(compact_id, hash_id, &wcontext)) {
640 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next eta hash, exp/compact "
641 <<
" " << std::hex << compact_id << std::dec);
645 ATH_MSG_ERROR(
" MuonIdHelper::init_neighbors - unable to get next eta compact, exp/compact ");
666 ATH_MSG_ERROR(
"test_module_packing: Unable to get expanded id. Compact id " << compact);
671 ATH_MSG_ERROR(
"test_module_packing: Unable to get compact id. Expanded id " << std::string(
id));
674 if (compact != new_compact) {
675 ATH_MSG_ERROR(
"test_module_packing: new and old compacts not equal "
676 <<
"New/old/expanded ids " << new_compact <<
" " << compact <<
" " << std::string(
id));
681 ATH_MSG_INFO(
"test_module_packing: Successful tested " << nids <<
" ids. ");
683 ATH_MSG_ERROR(
"Unable to test module is packing - no dictionary has been defined. ");
691 ATH_MSG_ERROR(
"Unable to get expanded id. Compact id " << compact);
699 if (compact != new_compact) {
700 ATH_MSG_ERROR(
"new and old compacts not equal. New/old/expanded ids " << new_compact <<
" " << compact <<
" "
722 if (
name.size() >= 2) {
723 if (
'I' ==
name[1] ||
'4' ==
name[1])
return 0;
724 if (
'E' ==
name[1] ||
'1' ==
name[1])
return 1;
725 if (
'M' ==
name[1] ||
'2' ==
name[1])
return 2;
726 if (
'O' ==
name[1] ||
'3' ==
name[1])
return 3;
728 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