59 ATH_MSG_ERROR(
" TRT_ID::barrel_ec_id result is NOT ok. ID, range "
60 << (std::string)
id <<
" "
78 ATH_MSG_ERROR(
" TRT_ID::module_id result is NOT ok. ID, range "
79 << (std::string)
id <<
" "
99 ATH_MSG_ERROR(
" TRT_ID::straw_id result is NOT ok. ID, range "
100 << (std::string)
id <<
" "
119 ATH_MSG_ERROR(
" TRT_ID::layer_id result is NOT ok. ID, range "
120 << (std::string)
id <<
" "
132 ATH_MSG_INFO(
"Request to reinitialize not satisfied - tags have not changed");
154 ATH_MSG_ERROR(
" TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary ");
172 if (
m_dict->get_label_value(
"barrel_endcap",
"negative_barrel", barrel_value)) {
173 ATH_MSG_ERROR(
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
181 if (
m_dict->get_label_value(
"barrel_endcap",
"positive_barrel", barrel_value)) {
182 ATH_MSG_ERROR(
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
190 <<
"Set barrel field values: "
202 if (atlasDict->
get_label_value(
"subdet",
"InnerDetector", inDetField)) {
203 ATH_MSG_ERROR(
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
204 << atlasDict->
name());
212 if (
m_dict->get_label_value(
"part",
"TRT", trtField)) {
213 ATH_MSG_ERROR(
"Could not get value for label 'TRT' of field 'part' in dictionary "
220 <<
"Found field values: InDet/TRT "
227 region_id.add(inDetField);
228 region_id.add(trtField);
257 unsigned int nids = 0;
258 std::set<Identifier> ids;
262 for (
const auto & exp_id: rit) {
266 if (!(ids.insert(
id)).second) {
268 <<
" Error: duplicated id for module id. nid " << nids
270 <<
" id " << std::string(exp_id));
278 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
288 std::set<Identifier>::const_iterator first = ids.begin();
289 std::set<Identifier>::const_iterator last = ids.end();
290 for (; first != last && nids <
m_module_vec.size(); ++first) {
303 for (
const auto & exp_id: rit) {
308 if (!(ids.insert(
id)).second) {
310 <<
" Error: duplicated id for straw layer id. nid " << nids
312 <<
" id " << std::string(exp_id));
321 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
355 unsigned int hcIndex = 0;
398 start = lay_min * 32 + str_lay_min;
399 end = start + nstr_layers;
401 for (
unsigned int i = start; i < end; ++i) {
408 end = start + nlayers;
410 for (
unsigned int i = start; i < end; ++i) {
438 start = lay_min * 32 + str_lay_min;
439 end = start + nstr_layers;
441 for (
unsigned int i = start; i < end; ++i) {
448 end = start + nlayers;
450 for (
unsigned int i = start; i < end; ++i) {
488 unsigned int nids = 0;
489 std::set<Identifier> ids;
494 for (
const auto & exp_id:rit) {
500 if (!(ids.insert(
id)).second) {
502 <<
" Error: duplicated id for straw id. nid " << nids
504 <<
" id " << std::string(exp_id));
512 <<
" Error: set size NOT EQUAL to hash max. size " << ids.size()
522 std::set<Identifier>::const_iterator first = ids.begin();
523 std::set<Identifier>::const_iterator last = ids.end();
524 for (; first != last && nids <
m_straw_vec.size(); ++first) {
534 ATH_MSG_ERROR(
" TRT_ID::initLevelsFromDict - dictionary NOT initialized ");
554 ATH_MSG_WARNING(
"TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper ");
555 ATH_MSG_WARNING(
"TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout ");
565 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'subdet' field ");
569 field =
m_dict->find_field(
"part");
573 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'part' field ");
577 field =
m_dict->find_field(
"barrel_endcap");
581 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field ");
586 field =
m_dict->find_field(
"phi_sector");
590 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field ");
595 field =
m_dict->find_field(
"layer_or_wheel");
599 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'layer' field ");
604 field =
m_dict->find_field(
"straw_layer");
608 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field ");
613 field =
m_dict->find_field(
"straw");
617 ATH_MSG_ERROR(
"TRT_ID::initLevelsFromDict - unable to find 'straw' field ");
635 ATH_MSG_DEBUG(
"decode index and bit fields for each level: ");
663 size_t begin = (context) ? context->
begin_index() : 0;
665 size_t end = (context) ? context->
end_index() : 0;
680 std::cout <<
"Do not know how to calculate straw id from hash yet!!" << std::endl;
716 size_t begin = (context) ? context->
begin_index() : 0;
717 size_t end = (context) ? context->
end_index() : 0;
748 if (range.match(expId)) {
750 if (not field.empty()) {
751 int max = field.get_maximum();
768 if (range.match(expId)) {
770 if (not field.empty()) {
771 return(field.get_maximum());
794 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
804 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
812 if (i % 10000 == 5) {
813 std::cout <<
"test_trt_ids: id, bin hash, hash: "
821 std::cout <<
"Checked hash calculation for " << nids <<
" hashes and found "
822 << nidsFailed <<
" failures to match between binary lookup and calculation "
831 for (; first != last; ++first, ++nids) {
839 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
842 << (std::string) exp_id);
847 if (
get_hash(
id, hashId, &context)) {
855 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
859 << std::hex << hashId << std::dec);
868 for (; first != last; ++first, ++nids) {
877 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
879 << (std::string) exp_id);
887 for (
int i = 0; i < nstraws; ++i) {
896 ATH_MSG_ERROR(
"TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
898 << (std::string) exp_id);
904 ATH_MSG_INFO(
"TRT_ID::test_trt_ids: Successfully tested "
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#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.
bool is_valid() const
Check if id is in a valid state.
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