|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "GaudiKernel/MsgStream.h"
23 constexpr std::array<std::string_view, MSG::Level::NUM_LEVELS> lvl{
"NIL ",
"VERBOSE ",
24 "DEBUG ",
"INFO ",
"WARNING ",
"ERROR ",
"FATAL ",
"ALWAYS "};
32 const std::array<IdentifierHash, 5> invalidHashes{invalidHash, invalidHash, invalidHash,
33 invalidHash, invalidHash};
42 m_neighboursByEta{invalidHashFunc, invalidHashFunc, invalidHashFunc , invalidHashFunc, invalidHashFunc},
66 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_wafer_range);
87 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_strip_range);
130 std::string errMsg =
" result is NOT ok. ID, range " + std::string(
id)+std::string(
m_full_strip_range);
143 for (
unsigned int i = 0;
i != useRange.size(); ++
i) {
145 if (
range.match(expId)) {
147 if (not thisField.
empty()) {
149 if (fieldIndx ==
ETA or fieldIndx ==
STRIP){
175 if (
range.match(expId)) {
177 if (not eta_field.
empty()) {
229 localMessage(
"Request to reinitialize not satisfied - tags have not changed", __func__, MSG::INFO);
243 localMessage(
" - cannot access InnerDetector dictionary ",__func__, MSG::ERROR);
255 const std::string errMsg =
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary " +
m_dict->
m_name;
261 std::string dbgMsg =
"Set barrel field values: " + std::string(
m_barrel_field);
274 if (atlasDict->
get_label_value(
"subdet",
"InnerDetector", inDetField)) {
275 const std::string errMsg =
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary " + atlasDict->
m_name;
283 const std::string errMsg=
"Could not get value for label 'SCT' of field 'part' in dictionary " +
m_dict->
m_name;
328 unsigned int nids = 0;
329 std::set<Identifier>
ids;
333 for (
const auto & exp_id : rit) {
335 if (!(
ids.insert(
id)).second) {
336 const std::string errMsg =
"Error: duplicated id for wafer id. nid " +
std::to_string(nids) +
" compact id " +
id.getString() +
" id " + std::string(exp_id);
350 std::set<Identifier>::const_iterator
first =
ids.begin();
351 std::set<Identifier>::const_iterator last =
ids.end();
389 if (!
get_id(hashId,
id, &wafer_context1)) {
390 return(
side(
id) ? hashId - 1 : hashId + 1);
448 if (!
get_id(hashId,
id, &wafer_context1)) {
449 other =
side(
id) ? hashId - 1 : hashId + 1;
484 for (
const auto & exp_id : rit) {
499 if (
get_hash(
id, hash_id, &wcontext)) {
506 unsigned short index = hash_id;
517 if (
get_hash(
id, hash_id, &wcontext)) {
518 const std::string errMsg =
"- unable to get previous phi hash, exp/compact " +
id.getString();
530 if (
get_hash(
id, hash_id, &wcontext)) {
531 const std::string errMsg =
"- unable to get next phi hash, exp/compact " +
id.getString();
543 if (
get_hash(
id, hash_id, &wcontext)) {
544 const std::string errMsg =
"- unable to get previous eta hash, exp/compact " +
id.getString();
556 if (
get_hash(
id, hash_id, &wcontext)) {
557 const std::string errMsg =
"- unable to get next eta hash, exp/compact " +
id.getString();
571 localMessage(
"- dictionary NOT initialized", __func__, MSG::ERROR);
589 auto findField = [
this](
const std::string &
name,
const size_t indx){
601 if (not findField(
"subdet",
INDET))
return 1;
602 if (not findField(
"part",
SCT))
return 1;
603 if (not findField(
"barrel_endcap",
BARREL_EC))
return 1;
604 if (not findField(
"layer",
LAYER_DISK))
return 1;
605 if (not findField(
"phi_module",
PHI))
return 1;
606 if (not findField(
"eta_module",
ETA))
return 1;
607 if (not findField(
"side",
SIDE))
return 1;
609 if (not findField(
"strip",
STRIP))
return 1;
689 localMessage(
"Do not know how to calculate strip id from hash yet!!", __func__, MSG::ERROR );
752 if (lvl >
MSG::DEBUG) std::cout<<lvl<<
"SCT_ID::"<<func<<
" "<<msgTxt<<std::endl;
754 std::cout<<lvl<<
"SCT_ID::"<<func<<
" "<<msgTxt<<std::endl;
761 std::array<IdentifierHash, 5>
763 if (
size_type index = idh; index<m_wafer_hash_max) return std::array<IdentifierHash, 5>{
768 else return invalidHashes;
772 std::array<IdentifierHash, 5>
774 if (
size_type index = idh; index<m_wafer_hash_max) return std::array<IdentifierHash, 5>{
779 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
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
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