73 size_t begin = (context) ? context->begin_index(): 0;
75 size_t end = (context) ? context->end_index() : 0;
118 size_t begin = (context) ? context->begin_index(): 0;
119 size_t end = (context) ? context->end_index() : 0;
134 std::vector<Identifier>::const_iterator it = std::lower_bound(
m_tower_vec.begin(),
m_tower_vec.end(),redId);
150 std::string errorMessage =
151 "Error in CaloLVL1_ID::get_hash, invalid context ";
168 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
185 ATH_MSG_ERROR(
"initialize_from_dict - cannot access LVL1Calorimeter dictionary");
195 if (
m_dict->get_label_value(
"subdet",
"Calorimeter", caloValue))
197 ATH_MSG_ERROR(
"Could not get value for label 'Calorimeter' of field 'subdet' in dictionary " <<
m_dict->name());
201 int lvl1CaloValue = -1;
205 if (
m_dict->get_label_value(
"DetZside",
"positive_lvl1_side", lvl1CaloValue))
207 ATH_MSG_ERROR(
"Could not get value for label 'positive_lvl1_side' of field 'DetZside in dictionary" <<
m_dict->name());
217 reg_id.
add(caloValue);
218 reg_id.
add(lvl1CaloValue);
257 int size = (1 << bits);
310 if (range.match(expId)) {
312 if (not eta_field.
empty()) {
314 if (-999 == result) {
318 if (etamin < result) result = etamin;
336 if (range.match(expId)) {
338 if (not eta_field.
empty()) {
340 if (result < etamax) result = etamax;
357 if (range.match(expId)) {
359 if (not phi_field.
empty()) {
361 if (result < phimax) result = phimax;
378 if (range.match(expId)) {
380 if (not lay_field.
empty()) {
382 if (result < laymax) result = laymax;
394 unsigned short index = id;
406 unsigned short index = id;
418 unsigned short index = id;
430 unsigned short index = id;
448 if(context && context->end_index() >=
m_ETA_INDEX) {
468 std::string errorMessage =
"CaloLVL1_ID::tower_id() result is not OK: ID, range = "
483 std::string errorMessage =
"CaloLVL1_ID::tower_id(regionId) result is not OK: ID= "
491 std::string errorMessage =
"CaloLVL1_ID::tower_id(regionId,field values) result is not OK: ID, range = "
504 std::string errorMessage =
"CaloLVL1_ID::region_id() result is not OK: ID, range = "
518 std::string errorMessage =
"CaloLVL1_ID::layer_id(field values) result is not OK: ID, range = "
532 std::string errorMessage =
"CaloLVL1_ID::layer_id(towerId, layer) result is not OK: ID= "
540 std::string errorMessage =
"CaloLVL1_ID::layer_id(towerId) result is not OK: ID, range = "
551 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized");
573 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find lvl1 region ");
584 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
588 field =
m_dict->find_field(
"DetZside") ;
594 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'DetZside' field ");
598 field =
m_dict->find_field(
"LVL1sampling") ;
604 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'LVL1sampling' field ");
608 field =
m_dict->find_field(
"region") ;
614 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'region' field ");
618 field =
m_dict->find_field(
"eta") ;
624 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'eta' field ");
628 field =
m_dict->find_field(
"phi") ;
634 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'phi' field ");
638 field =
m_dict->find_field(
"layer") ;
644 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'layer' field ");
660 ATH_MSG_DEBUG(
"decode index and bit fields for each level: ");
678 unsigned int nids = 0;
679 std::set<Identifier> ids;
683 auto first = rit.
begin();
684 auto last = rit.
end();
685 for (; first != last; ++first) {
692 if(!(ids.insert(tow_id)).second)
706 std::set<Identifier>::const_iterator first = ids.begin();
707 std::set<Identifier>::const_iterator last = ids.end();
708 for (;first != last && nids <
m_tower_vec.size(); ++first) {
722 auto first = rit.
begin();
723 auto last = rit.
end();
724 for (; first != last; ++first)
733 if(!(ids.insert(lay_id)).second)
749 for (;first != last && nids <
m_layer_vec.size(); ++first) {
763 auto first = rit.
begin();
764 auto last = rit.
end();
765 for (; first != last; ++first) {
770 if(!(ids.insert(reg_id)).second)
785 for (;first != last && nids <
m_region_vec.size(); ++first) {
806 auto first = rit.
begin();
807 auto last = rit.
end();
808 for (; first != last; ++first) {
831 if (
get_hash(
id, hash_id,&tcontext))
833 ATH_MSG_ERROR(
"init_neighbors - unable to get hash, compact");
850 if (
get_hash(
id, hash_id,&tcontext))
852 ATH_MSG_ERROR(
"init_neighbors - unable to get previous phi hash, exp/compact");
864 if (
get_hash(
id, hash_id,&tcontext))
866 ATH_MSG_ERROR(
"init_neighbors - unable to get next phi hash, exp/compact");
877 if (
get_hash(
id, hash_id,&tcontext))
879 ATH_MSG_ERROR(
"init_neighbors - unable to get previous eta hash, exp/compact");
891 if (
get_hash(
id, hash_id,&tcontext))
893 ATH_MSG_ERROR(
"init_neighbors - unable to get next eta hash, exp/compact");
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
size_t size() const
Number of registered mappings.
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 calo_field_value() const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
const std::string & group() const
Group name for this helper.
ExpandedIdentifier calo_exp(void) const
AtlasDetectorID(const std::string &name, const std::string &group)
Exception class for Calo Identifiers.
small class holding the starting hash value, the min eta and the number of phi bins of each region
IdDictFieldImplementation m_region_impl
size_type m_tower_hash_max
int get_prev_in_eta(const IdentifierHash &id, IdentifierHash &prev) const
access to hashes for neighbours in eta – towers only (no extended) return == 0 for neighbours found
size_type m_lvl1_region_index
MultiRange m_full_layer_range
int get_prev_in_phi(const IdentifierHash &id, IdentifierHash &prev) const
access to hashes for neighbours in phi – towers only (no extended) return == 0 for neighbours found
IdentifierHash tower_hash(Identifier towerId) const
create hash id from tower id
int phi_max(const Identifier regId) const
min value of phi index (-999 == failure)
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
Identifier region_id(int pos_neg_z, int sampling, int region) const
build a region (of towers) identifier
int region(const Identifier id) const
return region according to :
std::vector< unsigned short > m_next_phi_vec
void region_id_checks(int pos_neg_z, int sampling, int region) const
size_type m_layer_hash_max
size_type m_DETZSIDE_INDEX
size_type m_region_hash_max
void layer_id_checks(int pos_neg_z, int sampling, int region, int eta, int phi, int layer) const
IdDictFieldImplementation m_layer_impl
int get_next_in_eta(const IdentifierHash &id, IdentifierHash &next) const
access to hashes for neighbours in eta – towers only (no extended) return == 0 for neighbours found
IdDictFieldImplementation m_lvl1_impl
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
int layer_max(const Identifier regId) const
max value of phi index (-999 == failure)
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
MultiRange m_full_region_range
IdDictFieldImplementation m_eta_impl
std::vector< unsigned short > m_next_eta_vec
IdContext layer_context() const
access to IdContext's which define which levels of fields are contained in the id
IdDictFieldImplementation m_sampling_impl
std::vector< Identifier > m_tower_vec
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
size_type m_SAMPLING_INDEX
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
int layer(const Identifier id) const
return layer according to :
std::vector< Identifier > m_region_vec
MultiRange m_full_tower_range
IdDictFieldImplementation m_phi_impl
IdDictFieldImplementation m_pnz_reg_impl
IdentifierHash tower_hash_binary_search(Identifier towerId) const
create hash id from tower id – method NOT optimised, please use tower_hash() above
const IdDictDictionary * m_dict
int pos_neg_z(const Identifier id) const
return pos_neg_z according to :
std::vector< Identifier > m_layer_vec
std::vector< unsigned short > m_prev_eta_vec
std::vector< HashCalc > m_hash_calcs
int sampling(const Identifier id) const
return sampling according to :
IdDictFieldImplementation m_calo_impl
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
int eta(const Identifier id) const
return eta according to :
std::vector< unsigned short > m_prev_phi_vec
int get_next_in_phi(const IdentifierHash &id, IdentifierHash &next) const
access to hashes for neighbours in phi – towers only (no extended) return == 0 for neighbours found
IdContext tower_context() const
access to IdContext's which define which levels of fields are contained in the id
void tower_id_checks(int pos_neg_z, int sampling, int region, int eta, int phi) const
Identifier layer_id(int pos_neg_z, int sampling, int region, int eta, int phi, int layer) const
build a layer identifier
int phi(const Identifier id) const
return phi according to :
ConstRangeIterator end() const
ConstRangeIterator begin() const
void add(element_type value)
Append a value into a new field.
void clear()
Erase all fields.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Identifier::size_type size_type
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
bool get_previous(element_type current, element_type &previous) const
Returns false if previous/next is at end of range, or not possible.
element_type get_minimum() const
Query the values.
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
bool get_next(element_type current, element_type &next) const
element_type get_maximum() const
This is a "hash" representation of an Identifier.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.