|
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),
58 log << MSG::ERROR <<
" TRT_ID::barrel_ec_id result is NOT ok. ID, range "
59 << (std::string)
id <<
" "
67 int layer_or_wheel)
const {
78 log << MSG::ERROR <<
" TRT_ID::module_id result is NOT ok. ID, range "
79 << (std::string)
id <<
" "
100 log << MSG::ERROR <<
" TRT_ID::straw_id result is NOT ok. ID, range "
101 << (std::string)
id <<
" "
110 int straw_layer)
const {
121 log << MSG::ERROR <<
" TRT_ID::layer_id result is NOT ok. ID, range "
122 << (std::string)
id <<
" "
135 log << MSG::INFO <<
"Request to reinitialize not satisfied - tags have not changed" <<
endmsg;
157 log << MSG::ERROR <<
" TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary "
177 log << MSG::ERROR <<
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
187 log << MSG::ERROR <<
"Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
196 <<
"Set barrel field values: "
210 if (atlasDict->get_label_value(
"subdet",
"InnerDetector", inDetField)) {
211 log << MSG::ERROR <<
"Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
222 log << MSG::ERROR <<
"Could not get value for label 'TRT' of field 'part' in dictionary "
230 <<
"Found field values: InDet/TRT "
278 unsigned int nids = 0;
279 std::set<Identifier>
ids;
283 for (
const auto & exp_id: rit) {
287 if (!(
ids.insert(
id)).second) {
288 log << MSG::ERROR <<
" TRT_ID::init_hashes "
289 <<
" Error: duplicated id for module id. nid " << nids
291 <<
" id " << std::string(exp_id)
299 log << MSG::ERROR <<
" TRT_ID::init_hashes "
300 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
312 std::set<Identifier>::const_iterator
first =
ids.begin();
313 std::set<Identifier>::const_iterator last =
ids.end();
327 for (
const auto & exp_id: rit) {
332 if (!(
ids.insert(
id)).second) {
333 log << MSG::ERROR <<
" TRT_ID::init_hashes "
334 <<
" Error: duplicated id for straw layer id. nid " << nids
336 <<
" id " << std::string(exp_id)
345 log << MSG::ERROR <<
" TRT_ID::init_hashes "
346 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
382 unsigned int hcIndex = 0;
425 start = lay_min * 32 + str_lay_min;
465 start = lay_min * 32 + str_lay_min;
517 unsigned int nids = 0;
518 std::set<Identifier>
ids;
523 for (
const auto & exp_id:rit) {
529 if (!(
ids.insert(
id)).second) {
530 log << MSG::ERROR <<
" TRT_ID::init_hashes "
531 <<
" Error: duplicated id for straw id. nid " << nids
533 <<
" id " << std::string(exp_id)
541 log << MSG::ERROR <<
" TRT_ID::init_hashes "
542 <<
" Error: set size NOT EQUAL to hash max. size " <<
ids.size()
554 std::set<Identifier>::const_iterator
first =
ids.begin();
555 std::set<Identifier>::const_iterator last =
ids.end();
567 log << MSG::ERROR <<
" TRT_ID::initLevelsFromDict - dictionary NOT initialized "
588 log << MSG::WARNING <<
"TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper "
590 log << MSG::WARNING <<
"TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout "
601 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'subdet' field "
610 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'part' field "
619 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field "
629 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field "
639 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'layer' field "
649 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field "
659 log << MSG::ERROR <<
"TRT_ID::initLevelsFromDict - unable to find 'straw' field "
723 std::cout <<
"Do not know how to calculate straw id from hash yet!!" << std::endl;
791 if (
range.match(expId)) {
793 if (not
field.empty()) {
811 if (
range.match(expId)) {
813 if (not
field.empty()) {
814 return(
field.get_maximum());
838 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
848 std::cout <<
"test_trt_ids - bad match: id, bin hash, hash: "
856 if (
i % 10000 == 5) {
857 std::cout <<
"test_trt_ids: id, bin hash, hash: "
865 std::cout <<
"Checked hash calculation for " << nids <<
" hashes and found "
866 << nidsFailed <<
" failures to match between binary lookup and calculation "
883 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
886 << (std::string) exp_id <<
endmsg;
891 if (
get_hash(
id, hashId, &context)) {
892 log << MSG::ERROR <<
"Unable to set trt hash id for det elem "
900 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
904 << hashId << MSG::dec
923 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
925 << (std::string) exp_id <<
endmsg;
933 for (
int i = 0;
i < nstraws; ++
i) {
942 log << MSG::ERROR <<
"TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
944 << (std::string) exp_id <<
endmsg;
950 log << MSG::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: