|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "GaudiKernel/MsgStream.h"
23 const std::array<IdentifierHash, 5> invalidHashes{invalidHash, invalidHash, invalidHash,
24 invalidHash, invalidHash};
33 m_neighboursByEta{invalidHashFunc, invalidHashFunc, invalidHashFunc , invalidHashFunc, invalidHashFunc},
57 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_wafer_range);
78 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_strip_range);
121 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_strip_range);
134 for (
unsigned int i = 0;
i != useRange.size(); ++
i) {
136 if (
range.match(expId)) {
138 if (not thisField.
empty()) {
140 if (fieldIndx ==
ETA or fieldIndx ==
STRIP){
166 if (
range.match(expId)) {
168 if (not eta_field.
empty()) {
220 localMessage(
"Request to reinitialize not satisfied - tags have not changed", __func__, MSG::INFO);
234 localMessage(
" - cannot access InnerDetector dictionary ",__func__, MSG::ERROR);
246 const std::string errMsg =
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary " +
m_dict->
m_name;
252 std::string dbgMsg =
"Set barrel field values: " + std::string(
m_barrel_field);
265 if (atlasDict->
get_label_value(
"subdet",
"InnerDetector", inDetField)) {
266 const std::string errMsg =
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary " + atlasDict->
m_name;
274 const std::string errMsg=
"Could not get value for label 'SCT' of field 'part' in dictionary " +
m_dict->
m_name;
319 unsigned int nids = 0;
320 std::set<Identifier>
ids;
324 for (
const auto & exp_id : rit) {
326 if (!(
ids.insert(
id)).second) {
327 const std::string errMsg =
"Error: duplicated id for wafer id. nid " +
std::to_string(nids) +
" compact id " +
id.getString() +
" id " + std::string(exp_id);
341 std::set<Identifier>::const_iterator
first =
ids.begin();
342 std::set<Identifier>::const_iterator last =
ids.end();
380 if (!
get_id(hashId,
id, &wafer_context1)) {
381 return(
side(
id) ? hashId - 1 : hashId + 1);
439 if (!
get_id(hashId,
id, &wafer_context1)) {
440 other =
side(
id) ? hashId - 1 : hashId + 1;
475 for (
const auto & exp_id : rit) {
490 if (
get_hash(
id, hash_id, &wcontext)) {
497 unsigned short index = hash_id;
508 if (
get_hash(
id, hash_id, &wcontext)) {
509 const std::string errMsg =
"- unable to get previous phi hash, exp/compact " +
id.getString();
521 if (
get_hash(
id, hash_id, &wcontext)) {
522 const std::string errMsg =
"- unable to get next phi hash, exp/compact " +
id.getString();
534 if (
get_hash(
id, hash_id, &wcontext)) {
535 const std::string errMsg =
"- unable to get previous eta hash, exp/compact " +
id.getString();
547 if (
get_hash(
id, hash_id, &wcontext)) {
548 const std::string errMsg =
"- unable to get next eta hash, exp/compact " +
id.getString();
562 localMessage(
"- dictionary NOT initialized", __func__, MSG::ERROR);
580 auto findField = [
this](
const std::string &
name,
const size_t indx){
592 if (not findField(
"subdet",
INDET))
return 1;
593 if (not findField(
"part",
SCT))
return 1;
594 if (not findField(
"barrel_endcap",
BARREL_EC))
return 1;
595 if (not findField(
"layer",
LAYER_DISK))
return 1;
596 if (not findField(
"phi_module",
PHI))
return 1;
597 if (not findField(
"eta_module",
ETA))
return 1;
598 if (not findField(
"side",
SIDE))
return 1;
600 if (not findField(
"strip",
STRIP))
return 1;
680 localMessage(
"Do not know how to calculate strip id from hash yet!!", __func__, MSG::ERROR );
738 const std::array<std::string, MSG::NUM_LEVELS>
prefix={
"",
"VERBOSE ",
"DEBUG ",
"INFO ",
"WARNING ",
"ERROR ",
"FATAL ",
" "};
744 if (lvl >
MSG::DEBUG) std::cout<<
prefix[lvl]<<
"SCT_ID::"<<func<<
" "<<msgTxt<<std::endl;
746 std::cout<<
prefix[lvl]<<
"SCT_ID::"<<func<<
" "<<msgTxt<<std::endl;
753 std::array<IdentifierHash, 5>
755 if (
size_type index = idh; index<m_wafer_hash_max) return std::array<IdentifierHash, 5>{
760 else return invalidHashes;
764 std::array<IdentifierHash, 5>
766 if (
size_type index = idh; index<m_wafer_hash_max) return std::array<IdentifierHash, 5>{
771 else return invalidHashes;
IdDictRegion * find_region(const std::string ®ion_name) const
MultiRange m_full_wafer_range
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
int get_next_in_phi(const IdentifierHash &id, IdentifierHash &next) const
Next wafer hash in phi (return == 0 for neighbor found)
MultiRange build_multirange() const
Get MultiRange for full dictionary.
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
IdDictFieldImplementation m_eta_mod_impl
hash_vec m_prev_phi_wafer_vec
const_expanded_id_iterator strip_begin(void) const
For strip ids, only expanded id iterators are available.
int get_prev_in_phi(const IdentifierHash &id, IdentifierHash &prev) const
Previous wafer hash in phi (return == 0 for neighbor found)
identifier_factory factory_begin()
std::string show_to_string(void) const
identifier_factory factory_end()
element_type get_minimum() const
Query the values.
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
const_expanded_id_iterator strip_end(void) const
size_type end_index() const
IdDictFieldImplementation m_side_impl
size_type m_wafer_hash_max
size_type m_sct_region_index
const_id_iterator wafer_begin(void) const
Iterators over full set of ids. Wafer iterator is sorted.
int eta_module_max(const Identifier &id) const
hash_vec m_prev_eta_wafer_vec
std::vector< Identifier >::const_iterator const_id_iterator
IMessageSvc * m_msgSvc
pointer to the message service
element_type get_maximum() const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int phi_module(const Identifier &id) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override final
Initialization from the identifier dictionary.
size_type strip_hash_max(void) const
int phi_module_max(const Identifier &id) const
IdDictFieldImplementation m_sct_impl
void get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context=0) const
Create expanded id from compact id (return == 0 for OK)
IdDictFieldImplementation m_indet_impl
IdDictField * find_field(const std::string &name) const
std::array< std::function< IdentifierHash(const IdentifierHash &)>, 5 > m_neighboursByEta
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override final
Create compact id from hash id (return == 0 for OK)
const std::array< std::function< IdentifierHash(const IdentifierHash &)>, 5 > & neighbour_calls_by_eta() const
return functions to give neighbours in order: opposite, eta minus, eta plus, phi minus,...
Identifier::size_type size_type
hash_vec m_next_eta_wafer_vec
MultiRange m_full_strip_range
IdDictFieldImplementation m_strip_impl
Range::field m_barrel_field
size_type begin_index() const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
hash_vec m_next_phi_wafer_vec
int initLevelsFromDict(void)
IdDictFieldImplementation m_row_impl
IdDictFieldImplementation m_phi_mod_impl
int row(const Identifier &id) const
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override final
Create hash id from compact id (return == 0 for OK)
Identifier::size_type size_type
IdDictFieldImplementation m_lay_disk_impl
std::vector< IdDictRegion * > m_regions
IdDictFieldImplementation m_bec_impl
bool get_next(element_type current, element_type &next) const
IdContext wafer_context(void) const
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
int get_other_side(const IdentifierHash &id, IdentifierHash &other) const
Wafer hash on other side.
IdentifierHash nextInSequence(const IdentifierHash &id, const hash_vec &vectorOfHashes) const
std::array< IdentifierHash, 5 > neighbours_by_phi(const IdentifierHash &idh) const
bool is_valid() const
Check if id is in a valid state.
int sct_field_value() 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.
int eta_module_min(const Identifier &id) const
int get_label_value(const std::string &field, const std::string &label, int &value) const
const IdDictDictionary * m_dict
std::array< IdentifierHash, 5 > neighbours_by_eta(const IdentifierHash &idh) const
size_type wafer_hash_max(void) const
std::string to_string(const DetectorType &type)
void localMessage(const std::string &msgTxt, const std::string &func, const MSG::Level &lvl) const
int layer_disk(const Identifier &id) const
void wafer_id_checks(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
int layer_disk_max(const Identifier &id) const
Max/Min values for each field (-999 == failure)
bool is_eta_module_min(const Identifier &id) const
For the barrel.
int get_prev_in_eta(const IdentifierHash &id, IdentifierHash &prev) const
Previous wafer hash in eta (return == 0 for neighbor found)
int get_next_in_eta(const IdentifierHash &id, IdentifierHash &next) const
Next wafer hash in eta (return == 0 for neighbor found)
bool is_eta_module_max(const Identifier &id) const
For the barrel.
int match(const ExpandedIdentifier &id) const
Match an identifier.
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
int getMaxField(const Identifier &id, const ExpandedIdIndices &fieldIndx) const
int strip(const Identifier &id) const
int eta_module(const Identifier &id) const
int strip_max(const Identifier &id) const
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
size_type m_strip_hash_max
bool get_previous(element_type current, element_type &previous) const
Returns false if previous/next is at end of range, or not possible.
std::array< size_t, NUM_INDICES > m_indices
int side(const Identifier &id) const
const_id_iterator wafer_end(void) const
bool is_phi_module_max(const Identifier &id) const
size_type cardinality() const
Computes a possible cardinality from all ranges.
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
std::vector< IdDictFieldImplementation > m_implementation
void add_value(element_type value)
void strip_id_checks(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side, int strip) const