26 const std::string&
group) :
67 size_t begin = (context) ? context->
begin_index(): 0;
69 size_t end = (context) ? context->
end_index() : 0;
102 size_t begin = (context) ? context->
begin_index(): 0;
103 size_t end = (context) ? context->
end_index() : 0;
126 std::string errorMessage =
127 "Error in JGTowerBase_ID::get_hash, invalid context ";
140 int sc =
get_hash(regId, regHash, ®ionContext);
152 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
168 ATH_MSG_ERROR(
"initialize_from_dict - cannot access Calorimeter dictionary");
177 if (
m_dict->get_label_value(
"subdet",
"Calorimeter", caloValue))
179 ATH_MSG_ERROR(
"Could not get value for label 'Calorimeter' of field 'subdet' in dictionary " <<
m_dict->name());
183 int jgtowerCaloValue = -1;
187 if (
m_dict->get_label_value(
"DetZside",
"positive_lvl1_side", jgtowerCaloValue))
189 ATH_MSG_ERROR(
"Could not get value for label 'positive_lvl1_side' of field 'DetZside' in dictionary " <<
m_dict->name());
199 reg_id.
add(caloValue);
200 reg_id.
add(jgtowerCaloValue);
240 int size = (1 << bits);
293 if (range.match(expId)) {
295 if (not eta_field.
empty()) {
319 if (range.match(expId)) {
321 if (not eta_field.
empty()) {
340 if (range.match(expId)) {
342 if (not phi_field.
empty()) {
384 unsigned short index = id;
396 unsigned short index = id;
408 unsigned short index = id;
420 unsigned short index = id;
455 std::string errorMessage =
"JGTowerBase_ID::tower_id() result is not OK: ID, range = "
469 std::string errorMessage =
"JGTowerBase_ID::tower_id(regionId) result is not OK: ID= "
477 std::string errorMessage =
"JGTowerBase_ID::tower_id(regionId,field values) result is not OK: ID, range = "
490 std::string errorMessage =
"JGTowerBase_ID::region_id() result is not OK: ID, range = "
500 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized");
521 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find jgtower region");
532 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field");
536 field =
m_dict->find_field(
"DetZside") ;
542 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'DetZside' field");
546 field =
m_dict->find_field(t_pre+
"sampling") ;
552 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find '" << t_pre <<
"sampling' field");
556 field =
m_dict->find_field(t_pre+
"region") ;
562 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'region' field");
566 field =
m_dict->find_field(t_pre+
"eta") ;
572 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'eta' field");
576 field =
m_dict->find_field(t_pre+
"phi") ;
582 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'phi' field");
596 ATH_MSG_DEBUG(
"decode index and bit fields for each level:");
613 unsigned int nids = 0;
614 std::set<Identifier> ids;
618 auto first = rit.
begin();
619 auto last = rit.
end();
620 for (; first != last; ++first) {
627 if(!(ids.insert(tow_id)).second)
641 std::set<Identifier>::const_iterator first = ids.begin();
642 std::set<Identifier>::const_iterator last = ids.end();
643 for (;first != last && nids <
m_tower_vec.size(); ++first) {
655 auto first = rit.
begin();
656 auto last = rit.
end();
657 for (; first != last; ++first) {
662 if(!(ids.insert(reg_id)).second)
677 for (;first != last && nids <
m_region_vec.size(); ++first) {
698 auto first = rit.
begin();
699 auto last = rit.
end();
700 for (; first != last; ++first) {
723 if (
get_hash(
id, hash_id,&tcontext))
725 ATH_MSG_ERROR(
"init_neighbors - unable to get hash, compact");
730 unsigned short index = hash_id;
742 if (
get_hash(
id, hash_id,&tcontext))
744 ATH_MSG_ERROR(
"init_neighbors - unable to get previous phi hash, exp/compact");
756 if (
get_hash(
id, hash_id,&tcontext))
758 ATH_MSG_ERROR(
"init_neighbors - unable to get next phi hash, exp/compact");
769 if (
get_hash(
id, hash_id,&tcontext))
771 ATH_MSG_ERROR(
"init_neighbors - unable to get previous eta hash, exp/compact");
783 if (
get_hash(
id, hash_id,&tcontext))
785 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...
Factor out code common between JTower_ID and GTower_ID.
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.
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...
size_type begin_index() const
size_type end_index() const
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.
small class holding the starting hash value, the min eta and the number of phi bins of each region
int sampling(const Identifier id) const
return sampling according to :
int fill_vec_of_dict_regions(const std::string &group_name="")
float eta0(const Identifier regId) const
Return the minimum eta of region, or NOT_VALID.
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
IdDictFieldImplementation m_region_impl
size_type m_calo_region_hash_max
int region(const Identifier id) const
return region according to :
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
std::vector< unsigned short > m_next_phi_vec
IdentifierHash tower_hash_binary_search(Identifier towerId) const
create hash id from tower id – method NOT optimised, please use tower_hash() above
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
int pos_neg(const Identifier id) const
Test wether given tower or layer is part of the Tile Calorimeter.
float phiGranularity(const Identifier regId) const
Return the phi granularity of a region, or NOT_VALID.
std::vector< Identifier > m_tower_vec
size_type m_tower_hash_max
IdDictFieldImplementation m_sampling_impl
JGTowerBase_ID(const std::string &name, const std::string &group)
const IdDictDictionary * m_dict
size_type m_SAMPLING_INDEX
int phi_max(const Identifier regId) const
min value of phi index (-999 == failure)
int phi(const Identifier id) const
return phi according to :
IdentifierHash calo_region_hash(const Identifier id) const
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 initLevelsFromDict(const std::string &t_pre)
std::vector< unsigned short > m_prev_phi_vec
IdentifierHash tower_hash(Identifier towerId) const
create hash id from tower id
std::vector< HashCalc > m_hash_calcs
size_type m_jgtower_region_index
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
virtual int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &t_pre)
initialization from the identifier dictionary
IdContext tower_context() const
access to IdContext's which define which levels of fields are contained in the id
MultiRange m_full_tower_range
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)
std::vector< unsigned short > m_next_eta_vec
std::vector< unsigned short > m_prev_eta_vec
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
Identifier tower_id(int pos_neg, int sampling, int region, int eta, int phi) const
build a tower identifier
MultiRange m_full_reg_range
std::vector< const IdDictRegion * > m_vecOfDictRegions
List of IdDictRegion objects.
IdDictFieldImplementation m_eta_impl
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
void tower_id_checks(int pos_neg, int sampling, int region, int eta, int phi) const
Identifier region_id(int pos_neg, int sampling, int region) const
build a region (of towers) identifier
IdDictFieldImplementation m_jgtower_impl
float etaGranularity(const Identifier regId) const
Return the eta granularity of a region, or NOT_VALID.
IdDictFieldImplementation m_phi_impl
std::vector< Identifier > m_region_vec
float phi0(const Identifier regId) const
Return the minimum phi of region, or NOT_VALID.
IdDictFieldImplementation m_pnz_reg_impl
int eta(const Identifier id) const
return eta according to :
void region_id_checks(int pos_neg, int sampling, int region) const
IdDictFieldImplementation m_calo_impl
size_type m_DETZSIDE_INDEX
virtual ~JGTowerBase_ID()
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
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