77 size_t begin = (context) ? context->begin_index(): 0;
79 size_t end = (context) ? context->end_index() : 0;
122 size_t begin = (context) ? context->begin_index(): 0;
123 size_t end = (context) ? context->end_index() : 0;
138 std::vector<Identifier>::const_iterator it = std::lower_bound(
m_tower_vec.begin(),
m_tower_vec.end(),redId);
154 std::string errorMessage =
155 "Error in CaloLVL1_ID::get_hash, invalid context ";
172 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
189 ATH_MSG_ERROR(
"initialize_from_dict - cannot access LVL1Calorimeter dictionary");
199 if (
m_dict->get_label_value(
"subdet",
"Calorimeter", caloValue))
201 ATH_MSG_ERROR(
"Could not get value for label 'Calorimeter' of field 'subdet' in dictionary " <<
m_dict->name());
205 int lvl1CaloValue = -1;
209 if (
m_dict->get_label_value(
"DetZside",
"positive_lvl1_side", lvl1CaloValue))
211 ATH_MSG_ERROR(
"Could not get value for label 'positive_lvl1_side' of field 'DetZside in dictionary" <<
m_dict->name());
221 reg_id.
add(caloValue);
222 reg_id.
add(lvl1CaloValue);
261 int size = (1 << bits);
314 if (range.match(expId)) {
316 if (not eta_field.
empty()) {
318 if (-999 == result) {
322 if (etamin < result) result = etamin;
340 if (range.match(expId)) {
342 if (not eta_field.
empty()) {
344 if (result < etamax) result = etamax;
361 if (range.match(expId)) {
363 if (not phi_field.
empty()) {
365 if (result < phimax) result = phimax;
382 if (range.match(expId)) {
384 if (not lay_field.
empty()) {
386 if (result < laymax) result = laymax;
398 unsigned short index = id;
410 unsigned short index = id;
422 unsigned short index = id;
434 unsigned short index = id;
452 if(context && context->end_index() >=
m_ETA_INDEX) {
472 std::string errorMessage =
"CaloLVL1_ID::tower_id() result is not OK: ID, range = "
487 std::string errorMessage =
"CaloLVL1_ID::tower_id(regionId) result is not OK: ID= "
495 std::string errorMessage =
"CaloLVL1_ID::tower_id(regionId,field values) result is not OK: ID, range = "
508 std::string errorMessage =
"CaloLVL1_ID::region_id() result is not OK: ID, range = "
522 std::string errorMessage =
"CaloLVL1_ID::layer_id(field values) result is not OK: ID, range = "
536 std::string errorMessage =
"CaloLVL1_ID::layer_id(towerId, layer) result is not OK: ID= "
544 std::string errorMessage =
"CaloLVL1_ID::layer_id(towerId) result is not OK: ID, range = "
555 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized");
577 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find lvl1 region ");
588 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
592 field =
m_dict->find_field(
"DetZside") ;
598 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'DetZside' field ");
602 field =
m_dict->find_field(
"LVL1sampling") ;
608 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'LVL1sampling' field ");
612 field =
m_dict->find_field(
"region") ;
618 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'region' field ");
622 field =
m_dict->find_field(
"eta") ;
628 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'eta' field ");
632 field =
m_dict->find_field(
"phi") ;
638 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'phi' field ");
642 field =
m_dict->find_field(
"layer") ;
648 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'layer' field ");
664 ATH_MSG_DEBUG(
"decode index and bit fields for each level: ");
682 unsigned int nids = 0;
683 std::set<Identifier> ids;
687 auto first = rit.
begin();
688 auto last = rit.
end();
689 for (; first != last; ++first) {
696 if(!(ids.insert(tow_id)).second)
710 std::set<Identifier>::const_iterator first = ids.begin();
711 std::set<Identifier>::const_iterator last = ids.end();
712 for (;first != last && nids <
m_tower_vec.size(); ++first) {
726 auto first = rit.
begin();
727 auto last = rit.
end();
728 for (; first != last; ++first)
737 if(!(ids.insert(lay_id)).second)
753 for (;first != last && nids <
m_layer_vec.size(); ++first) {
767 auto first = rit.
begin();
768 auto last = rit.
end();
769 for (; first != last; ++first) {
774 if(!(ids.insert(reg_id)).second)
789 for (;first != last && nids <
m_region_vec.size(); ++first) {
810 auto first = rit.
begin();
811 auto last = rit.
end();
812 for (; first != last; ++first) {
835 if (
get_hash(
id, hash_id,&tcontext))
837 ATH_MSG_ERROR(
"init_neighbors - unable to get hash, compact");
854 if (
get_hash(
id, hash_id,&tcontext))
856 ATH_MSG_ERROR(
"init_neighbors - unable to get previous phi hash, exp/compact");
868 if (
get_hash(
id, hash_id,&tcontext))
870 ATH_MSG_ERROR(
"init_neighbors - unable to get next phi hash, exp/compact");
881 if (
get_hash(
id, hash_id,&tcontext))
883 ATH_MSG_ERROR(
"init_neighbors - unable to get previous eta hash, exp/compact");
895 if (
get_hash(
id, hash_id,&tcontext))
897 ATH_MSG_ERROR(
"init_neighbors - unable to get next eta hash, exp/compact");
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
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.
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs