|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "GaudiKernel/MsgStream.h"
29 m_trt_region_index(0),
33 m_PHI_MODULE_INDEX(3),
34 m_LAYER_OR_WHEEL_INDEX(4),
35 m_STRAW_LAYER_INDEX(5),
39 m_straw_layer_hash_max(0),
59 log << MSG::ERROR <<
" TRT_ID::barrel_ec_id result is NOT ok. ID, range "
60 << (std::string)
id <<
" "
63 std::cout <<
" ERROR TRT_ID::barrel_ec_id result is NOT ok. ID, range "
64 << (std::string)
id <<
" "
73 int layer_or_wheel)
const {
85 log << MSG::ERROR <<
" TRT_ID::module_id result is NOT ok. ID, range "
86 << (std::string)
id <<
" "
89 std::cout <<
" ERROR TRT_ID::module_id result is NOT ok. ID, range "
90 << (std::string)
id <<
" "
113 log << MSG::ERROR <<
" TRT_ID::straw_id result is NOT ok. ID, range "
114 << (std::string)
id <<
" "
117 log << MSG::ERROR <<
" TRT_ID::straw_id result is NOT ok. ID, range "
118 << (std::string)
id <<
" "
128 int straw_layer)
const {
140 log << MSG::ERROR <<
" TRT_ID::layer_id result is NOT ok. ID, range "
141 << (std::string)
id <<
" "
144 std::cout <<
" ERROR TRT_ID::layer_id result is NOT ok. ID, range "
145 << (std::string)
id <<
" "
159 std::cout <<
"INFO Initialize from dictionary cout " <<
m_msgSvc << std::endl;
166 log << MSG::INFO <<
"Request to reinitialize not satisfied - tags have not changed" <<
endmsg;
168 std::cout <<
" INFO Request to reinitialize not satisfied - tags have not changed" << std::endl;
175 std::cout <<
" DEBUG (Re)initialize" << std::endl;
196 log << MSG::ERROR <<
" TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary "
199 std::cout <<
" ERROR TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary "
221 log << MSG::ERROR <<
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
225 std::cout <<
" ERROR Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
236 log << MSG::ERROR <<
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
240 std::cout <<
" ERROR Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
250 <<
"Set barrel field values: "
254 std::cout <<
" DEBUG TRT_ID::initialize_from_dict "
255 <<
"Set barrel field values: "
269 if (atlasDict->
get_label_value(
"subdet",
"InnerDetector", inDetField)) {
271 log << MSG::ERROR <<
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
275 std::cout <<
" ERROR Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
287 log << MSG::ERROR <<
"Could not get value for label 'TRT' of field 'part' in dictionary "
291 std::cout <<
" ERROR Could not get value for label 'TRT' of field 'part' in dictionary "
300 <<
"Found field values: InDet/TRT "
305 std::cout <<
" DEBUG TRT_ID::initialize_from_dict "
306 <<
"Found field values: InDet/TRT "
333 std::cout <<
" DEBUG TRT_ID::initialize_from_dict "
368 unsigned int nids = 0;
369 std::set<Identifier>
ids;
373 for (
const auto & exp_id: rit) {
377 if (!(
ids.insert(
id)).second) {
379 log << MSG::ERROR <<
" TRT_ID::init_hashes "
380 <<
" Error: duplicated id for module id. nid " << nids
382 <<
" id " << std::string(exp_id)
385 std::cout <<
" ERROR TRT_ID::init_hashes "
386 <<
" Error: duplicated id for module id. nid " << nids
388 <<
" id " << std::string(exp_id)
397 log << MSG::ERROR <<
" TRT_ID::init_hashes "
398 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
402 std::cout <<
" ERROR TRT_ID::init_hashes "
403 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
413 std::cout <<
" DEBUG TRT_ID::init_hashes "
420 std::set<Identifier>::const_iterator
first =
ids.begin();
421 std::set<Identifier>::const_iterator last =
ids.end();
435 for (
const auto & exp_id: rit) {
440 if (!(
ids.insert(
id)).second) {
442 log << MSG::ERROR <<
" TRT_ID::init_hashes "
443 <<
" Error: duplicated id for straw layer id. nid " << nids
445 <<
" id " << std::string(exp_id)
447 std::cout <<
" ERROR TRT_ID::init_hashes "
448 <<
" Error: duplicated id for straw layer id. nid " << nids
450 <<
" id " << std::string(exp_id)
460 log << MSG::ERROR <<
" TRT_ID::init_hashes "
461 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
465 std::cout <<
" ERROR TRT_ID::init_hashes "
466 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
476 std::cout <<
" DEBUG TRT_ID::init_hashes "
508 unsigned int hcIndex = 0;
552 start = lay_min * 32 + str_lay_min;
592 start = lay_min * 32 + str_lay_min;
644 unsigned int nids = 0;
645 std::set<Identifier>
ids;
650 for (
const auto & exp_id:rit) {
656 if (!(
ids.insert(
id)).second) {
658 log << MSG::ERROR <<
" TRT_ID::init_hashes "
659 <<
" Error: duplicated id for straw id. nid " << nids
661 <<
" id " << std::string(exp_id)
664 std::cout <<
" ERROR TRT_ID::init_hashes "
665 <<
" Error: duplicated id for straw id. nid " << nids
667 <<
" id " << std::string(exp_id)
676 log << MSG::ERROR <<
" TRT_ID::init_hashes "
677 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
681 std::cout <<
" ERROR TRT_ID::init_hashes "
682 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
692 std::cout <<
" DEBUG TRT_ID::init_hashes "
699 std::set<Identifier>::const_iterator
first =
ids.begin();
700 std::set<Identifier>::const_iterator last =
ids.end();
713 log << MSG::ERROR <<
" TRT_ID::initLevelsFromDict - dictionary NOT initialized "
716 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - dictionary NOT initialized "
738 log << MSG::WARNING <<
"TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper "
740 log << MSG::WARNING <<
"TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout "
743 std::cout <<
" WARNING TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper "
745 std::cout <<
" WARNING TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout "
757 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'subdet' field "
760 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'subdet' field "
770 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'part' field "
773 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'part' field "
783 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field "
786 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field "
797 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field "
800 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field "
811 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'layer' field "
814 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'layer' field "
825 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field "
828 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field "
839 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'straw' field "
842 std::cout <<
" ERROR TRT_ID::initLevelsFromDict - unable to find 'straw' field "
871 std::cout <<
" DEBUG decode index and bit fields for each level: " << std::endl;
916 std::cout <<
"Do not know how to calculate straw id from hash yet!!" << std::endl;
984 if (
range.match(expId)) {
986 if (not
field.empty()) {
1004 if (
range.match(expId)) {
1006 if (not
field.empty()) {
1007 return(
field.get_maximum());
1033 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
1043 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
1051 if (
i % 10000 == 5) {
1052 std::cout <<
"test_trt_ids: id, bin hash, hash: "
1060 std::cout <<
"Checked hash calculation for " << nids <<
" hashes and found "
1061 << nidsFailed <<
" failures to match between binary lookup and calculation "
1079 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
1082 << (std::string) exp_id <<
endmsg;
1084 std::cout <<
" ERROR TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
1087 << (std::string) exp_id << std::endl;
1092 if (
get_hash(
id, hashId, &context)) {
1094 log << MSG::ERROR <<
"Unable to set trt hash id for det elem "
1098 std::cout <<
" ERROR Unable to set trt hash id for det elem "
1107 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
1111 << hashId << MSG::dec
1114 std::cout <<
" ERROR TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
1118 << hashId << std::dec
1138 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
1140 << (std::string) exp_id <<
endmsg;
1142 std::cout <<
" ERROR TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
1144 << (std::string) exp_id << std::endl;
1152 for (
int i = 0;
i < nstraws; ++
i) {
1162 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
1164 << (std::string) exp_id <<
endmsg;
1166 std::cout <<
" ERROR TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
1168 << (std::string) exp_id << std::endl;
1175 log << MSG::INFO <<
"TRT_ID::test_trt_ids: Successful tested "
1179 std::cout <<
" INFO TRT_ID::test_trt_ids: Successful tested "
IdDictRegion * find_region(const std::string ®ion_name) const
IdDictFieldImplementation m_bec_impl
void test_trt_ids(void)
Tests of packing.
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
size_type m_LAYER_OR_WHEEL_INDEX
MultiRange m_full_straw_range
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
MultiRange build_multirange() const
Get MultiRange for full dictionary.
size_type m_trt_region_index
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
std::vector< HashCalc > m_hash_calcs
size_type m_PHI_MODULE_INDEX
void module_id_checks(int barrel_ec, int phi_module, int layer_or_wheel) const
int straw_max(const Identifier &id) const
MultiRange m_full_straw_layer_range
size_type m_STRAW_LAYER_INDEX
void reset_straw_hash_vector(void)
int initLevelsFromDict(void)
IdDictFieldImplementation m_phi_mod_impl
IdentifierHash straw_hash(Identifier straw_id) const
straw hash from id - optimized
std::string show_to_string(void) const
IdContext module_context(void) const
module id
hash_vec m_straw_layer_vec
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
int get_straw_layer_hash_calc(const ExpandedIdentifier &id, IdentifierHash &hash_id) const
Special method for timing tests.
void barrel_ec_id_checks(int barrel_ec) const
size_type end_index() const
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
size_type m_BARREL_EC_INDEX
IdDictFieldImplementation m_trt_impl
IMessageSvc * m_msgSvc
pointer to the message service
std::vector< Identifier >::const_iterator const_id_iterator
int trt_field_value() const
size_type m_straw_hash_max
IdDictFieldImplementation m_str_lay_impl
const IdDictDictionary * m_dict
IdDictField * find_field(const std::string &name) const
void init_straw_hash_vector(void)
The init will use up ~2 MB of memory, so one should do init, use straw_id and then reset.
IdentifierHash module_hash(Identifier module_id) const
module hash from id - optimized
std::vector< intPair > m_hash_calcs_barrel_indexes
bool match(element_type value) const
The basic match operation.
size_type begin_index() const
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)
int straw(const Identifier &id) const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
size_type m_module_hash_max
IdContext straw_context(void) const
straw id
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)
IdentifierHash straw_hash_bin(Identifier straw_id) const
size_type m_straw_layer_hash_max
IdContext straw_layer_context(void) const
straw_layer id
void straw_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
std::vector< IdDictRegion * > m_regions
IdDictFieldImplementation m_indet_impl
void get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context=0) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int straw_layer(const Identifier &id) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override final
Set the IdDictionary.
int layer_or_wheel(const Identifier &id) const
bool is_valid() const
Check if id is in a valid state.
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 get_label_value(const std::string &field, const std::string &label, int &value) const
int straw_layer_max(const Identifier &id) const
Max values for each field (-999 == failure)
std::vector< intPair > m_hash_calcs_endcap_indexes
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
int phi_module(const Identifier &id) const
MultiRange m_full_module_range
int match(const ExpandedIdentifier &id) const
Match an identifier.
IdDictFieldImplementation m_straw_impl
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
void layer_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
IdDictFieldImplementation m_lay_wheel_impl
Range::field m_barrel_field
size_type cardinality() const
Computes a possible cardinality from all ranges.
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)
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.
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: