57 ATH_MSG_ERROR(
" TRT_ID::barrel_ec_id result is NOT ok. ID, range "
58 << (std::string)
id <<
" "
76 ATH_MSG_ERROR(
" TRT_ID::module_id result is NOT ok. ID, range "
77 << (std::string)
id <<
" "
97 ATH_MSG_ERROR(
" TRT_ID::straw_id result is NOT ok. ID, range "
98 << (std::string)
id <<
" "
117 ATH_MSG_ERROR(
" TRT_ID::layer_id result is NOT ok. ID, range "
118 << (std::string)
id <<
" "
130 ATH_MSG_INFO(
"Request to reinitialize not satisfied - tags have not changed");
152 ATH_MSG_ERROR(
" TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary ");
170 if (
m_dict->get_label_value(
"barrel_endcap",
"negative_barrel", barrel_value)) {
171 ATH_MSG_ERROR(
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
179 if (
m_dict->get_label_value(
"barrel_endcap",
"positive_barrel", barrel_value)) {
180 ATH_MSG_ERROR(
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
188 <<
"Set barrel field values: "
200 if (atlasDict->
get_label_value(
"subdet",
"InnerDetector", inDetField)) {
201 ATH_MSG_ERROR(
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
202 << atlasDict->
name());
210 if (
m_dict->get_label_value(
"part",
"TRT", trtField)) {
211 ATH_MSG_ERROR(
"Could not get value for label 'TRT' of field 'part' in dictionary "
218 <<
"Found field values: InDet/TRT "
225 region_id.add(inDetField);
226 region_id.add(trtField);
255 unsigned int nids = 0;
256 std::set<Identifier> ids;
260 for (
const auto & exp_id: rit) {
264 if (!(ids.insert(
id)).second) {
266 <<
" Error: duplicated id for module id. nid " << nids
268 <<
" id " << std::string(exp_id));
276 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
286 std::set<Identifier>::const_iterator first = ids.begin();
287 std::set<Identifier>::const_iterator last = ids.end();
288 for (; first != last && nids <
m_module_vec.size(); ++first) {
301 for (
const auto & exp_id: rit) {
306 if (!(ids.insert(
id)).second) {
308 <<
" Error: duplicated id for straw layer id. nid " << nids
310 <<
" id " << std::string(exp_id));
319 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
353 unsigned int hcIndex = 0;
396 start = lay_min * 32 + str_lay_min;
397 end = start + nstr_layers;
399 for (
unsigned int i = start; i < end; ++i) {
406 end = start + nlayers;
408 for (
unsigned int i = start; i < end; ++i) {
436 start = lay_min * 32 + str_lay_min;
437 end = start + nstr_layers;
439 for (
unsigned int i = start; i < end; ++i) {
446 end = start + nlayers;
448 for (
unsigned int i = start; i < end; ++i) {
486 unsigned int nids = 0;
487 std::set<Identifier> ids;
492 for (
const auto & exp_id:rit) {
498 if (!(ids.insert(
id)).second) {
500 <<
" Error: duplicated id for straw id. nid " << nids
502 <<
" id " << std::string(exp_id));
510 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
520 std::set<Identifier>::const_iterator first = ids.begin();
521 std::set<Identifier>::const_iterator last = ids.end();
522 for (; first != last && nids <
m_straw_vec.size(); ++first) {
532 ATH_MSG_ERROR(
" TRT_ID::initLevelsFromDict - dictionary NOT initialized ");
552 ATH_MSG_WARNING(
"TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper ");
553 ATH_MSG_WARNING(
"TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout ");
563 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'subdet' field ");
567 field =
m_dict->find_field(
"part");
571 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'part' field ");
575 field =
m_dict->find_field(
"barrel_endcap");
579 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field ");
584 field =
m_dict->find_field(
"phi_sector");
588 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field ");
593 field =
m_dict->find_field(
"layer_or_wheel");
597 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'layer' field ");
602 field =
m_dict->find_field(
"straw_layer");
606 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field ");
611 field =
m_dict->find_field(
"straw");
615 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'straw' field ");
633 ATH_MSG_DEBUG(
"decode index and bit fields for each level: ");
661 size_t begin = (context) ? context->
begin_index() : 0;
663 size_t end = (context) ? context->
end_index() : 0;
678 throw std::runtime_error(
"TRT_ID::get_id: Do not know how to calculate straw id from hash yet!!");
714 size_t begin = (context) ? context->
begin_index() : 0;
715 size_t end = (context) ? context->
end_index() : 0;
746 if (range.match(expId)) {
748 if (not field.empty()) {
749 int max = field.get_maximum();
750 result = result >
max ? result :
max;
766 if (range.match(expId)) {
768 if (not field.empty()) {
769 return(field.get_maximum());
807 if (i % 10000 == 5) {
816 ATH_MSG_WARNING(
"Checked hash calculation for " << nids <<
" hashes and found "
817 << nidsFailed <<
" failures to match between binary lookup and calculation ");
825 for (; first != last; ++first, ++nids) {
833 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
836 << (std::string) exp_id);
841 if (
get_hash(
id, hashId, &context)) {
849 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
853 << std::hex << hashId << std::dec);
862 for (; first != last; ++first, ++nids) {
871 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
873 << (std::string) exp_id);
881 for (
int i = 0; i < nstraws; ++i) {
890 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
892 << (std::string) exp_id);
898 ATH_MSG_INFO(
"TRT_ID::test_trt_ids: Successfully tested "
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This is an Identifier helper class for the TRT subdetector.
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
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 trt_field_value() const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
AtlasDetectorID(const std::string &name, const std::string &group)
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
void clear()
Erase all fields.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
size_type begin_index() const
size_type end_index() const
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & name() const
Dictionary name.
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
const IdDictFieldImplementation & implementation(size_t i) const
This is a "hash" representation of an Identifier.
constexpr bool is_valid() const
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
void barrel_ec_id_checks(int barrel_ec) const
size_type m_straw_layer_hash_max
int phi_module(const Identifier &id) const
std::vector< intPair > m_hash_calcs_barrel_indexes
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
IdDictFieldImplementation m_str_lay_impl
int straw_max(const Identifier &id) const
size_type m_PHI_MODULE_INDEX
MultiRange m_full_straw_layer_range
std::vector< intPair > m_hash_calcs_endcap_indexes
IdentifierHash module_hash(Identifier module_id) const
module hash from id - optimized
IdContext straw_context() const
straw id
IdDictFieldImplementation m_indet_impl
IdDictFieldImplementation m_phi_mod_impl
IdDictFieldImplementation m_straw_impl
IdDictFieldImplementation m_trt_impl
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)
size_type m_BARREL_EC_INDEX
size_type m_module_hash_max
void layer_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
MultiRange m_full_module_range
void test_trt_ids()
Tests of packing.
void invalidMessage() const
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
int straw_layer_max(const Identifier &id) const
Max values for each field (-999 == failure)
size_type m_trt_region_index
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Identifier module_id(int barrel_ec, int phi_module, int layer_or_wheel) const
For an individual module phi sector.
const IdDictDictionary * m_dict
MultiRange m_full_straw_range
IdContext straw_layer_context() const
straw_layer id
void module_id_checks(int barrel_ec, int phi_module, int layer_or_wheel) const
int get_straw_layer_hash_calc(const ExpandedIdentifier &id, IdentifierHash &hash_id) const
Special method for timing tests.
size_type m_STRAW_LAYER_INDEX
int layer_or_wheel(const Identifier &id) const
IdContext module_context() const
module id
IdentifierHash straw_hash(Identifier straw_id) const
straw hash from id - optimized
int straw(const Identifier &id) const
size_type m_LAYER_OR_WHEEL_INDEX
IdDictFieldImplementation m_lay_wheel_impl
IdContext barrel_context() const
barrel_ec id
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override final
Set the IdDictionary.
std::vector< HashCalc > m_hash_calcs
size_type m_straw_hash_max
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)
IdentifierHash straw_hash_bin(Identifier straw_id) const
void reset_straw_hash_vector()
IdDictFieldImplementation m_bec_impl
std::vector< Identifier >::const_iterator const_id_iterator
void straw_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Range::field m_barrel_field
int straw_layer(const Identifier &id) const
void init_straw_hash_vector()
The init will use up ~2 MB of memory, so one should do init, use straw_id and then reset.
hash_vec m_straw_layer_vec
void get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context=0) const