34 const std::string&
group,
66 return "Tile_Base_ID::to_string - unknown context";
71 return "Tile_Base_ID::to_string - can not expand ID";
73 return (std::string)(exp_id);
90 return "Tile_Base_ID::to_string - unknown context";
94 if (
get_id ( hash_id,
id, &context ) == 0 ) {
97 return "Tile_Base_ID::to_string - can not expand ID";
99 return (std::string)(exp_id);
102 return "Tile_Base_ID::to_string - can not get ID from hash_id";
161Tile_Base_ID::module (
const Identifier &
id )
const
264 && (
side(
id) == 0 );
430 std::string errorMessage =
"Tile_Base_ID::region_id() result is not OK: ID, range = "
484 std::string errorMessage =
"Tile_Base_ID::module_id() result is not OK: ID, range = "
528 int module,
int tower,
540 std::string errorMessage =
"Tile_Base_ID::tower_id() result is not OK: ID, range = "
565 int module,
int tower)
const
596 int module,
int tower,
609 std::string errorMessage =
"Tile_Base_ID::cell_id() result is not OK: ID, range = "
635 int module,
int tower,
655 int pmt,
bool checks )
const
667 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) could not pack ID: "
681 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) result is not OK: ID = "
691 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
709 int module,
int tower,
722 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
749 int module,
int tower,
757 int pmt,
int adc,
bool checks )
const
770 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) could not pack ID: "
784 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) result is not OK: ID = "
794 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
812 int adc,
bool checks )
const
824 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) could not pack ID: "
838 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) result is not OK: ID = "
848 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
879 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
925 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
937 id << module <<
tower;
943 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
962 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
980 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
998 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
1016 if (!
dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
1024 if (hash_id <
channels().hash_max()) {
1027 std::string errorMessage =
"Tile_Base_ID::cell_id(hash_id) - hash_id out of range ";
1038 std::string errorMessage =
"Tile_Base_ID::cell_hash(cell_id) - cell_id out of range ";
1086 size_t begin = (context) ? context->
begin_index(): 0;
1088 size_t end = (context) ? context->
end_index() : 0;
1093 if (hash_id <
m_adcs.hash_max()) {
1094 id =
m_adcs.id (hash_id);
1097 ATH_MSG_ERROR(
"get_id: adc hash_id is out of range " << hash_id
1098 <<
" > " <<
m_adcs.hash_max());
1101 if (hash_id <
m_pmts.hash_max()) {
1102 id =
m_pmts.id (hash_id);
1105 ATH_MSG_ERROR(
"get_id: pmt hash_id is out of range " << hash_id
1106 <<
" >= " <<
m_pmts.hash_max());
1109 if (hash_id <
channels().hash_max()) {
1113 ATH_MSG_ERROR(
"get_id: cell hash_id is out of range " << hash_id
1114 <<
" >= " <<
channels().hash_max());
1117 if (hash_id <
m_towers.hash_max()) {
1121 ATH_MSG_ERROR(
"get_id: tower hash_id is out of range " << hash_id
1129 ATH_MSG_ERROR(
"get_id: module hash_id is out of range " << hash_id
1133 if (hash_id <
regions().hash_max()) {
1137 ATH_MSG_ERROR(
"get_id: region hash_id is out of range " << hash_id
1138 <<
" >= " <<
regions().hash_max());
1154 size_t begin = (context) ? context->
begin_index(): 0;
1155 size_t end = (context) ? context->
end_index() : 0;
1178 const std::string& group_name)
1184 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
1191 ATH_MSG_DEBUG(
"calling base initialize_base_from_dictionary");
1205 if (atlasDict->
get_label_value(
"subdet",
"TileCalorimeter", tileField)) {
1206 ATH_MSG_ERROR(
"Could not get value for label 'TileCalorimeter' of field 'subdet' in dictionary "
1207 << atlasDict->
name());
1213 tile_id.
add(tileField);
1225 int tilehwField = -1;
1226 if (
dict()->get_label_value(
"section",
"Online", tilehwField)) {
1227 ATH_MSG_ERROR(
"Could not get value for label 'Online' of field 'section' in dictionary "
1232 reg_id.
add(tilehwField);
1242 int tiletbField = -1;
1243 if (
dict()->get_label_value(
"section",
"Testbeam", tiletbField)) {
1244 ATH_MSG_ERROR(
"Could not get value for label 'Testbeam' of field 'section' in dictionary "
1248 reg_id = std::move(tile_id);
1249 reg_id.
add(tiletbField);
1274 std::string neighbourFile;
1276 neighbourFile =
"TileSuperCellNeighbour.txt";
1281 if (neighbourFile.empty())
throw std::runtime_error(
"TileID: Cannot find the Tile Neighbour file name");
1282 if(
m_neighbour.initialize(
this, neighbourFile))
return (1);
1310 return m_pmts.hash_max();
1315 return m_adcs.hash_max();
1497 if (range.match(expId)) {
1499 if (not eta_field.
empty()) {
1522 if (range.match(expId)) {
1524 if (not eta_field.
empty()) {
1567 if (range.match(expId)) {
1569 if (not phi_field.
empty()) {
1586 size_t begin = (context) ? context->
begin_index() : 0;
1593 else if ( 0 == begin) {
1606 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized ");
1623 ATH_MSG_ERROR(
"initLevelsFromDict - cannot find " << group_name
1624 <<
" group' field ");
1636 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
1645 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'section' field ");
1654 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'side' field ");
1663 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'module' field ");
1672 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'tower' field ");
1681 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'sampling' field ");
1690 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'pmt' field ");
1699 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'adc' field ");
1714 ATH_MSG_DEBUG(
"initLevelsFromDict decode index and bit fields for each level: " );
1764 std::vector<IdentifierHash>& neighbourList)
const
1769 ATH_MSG_WARNING(
"get_neighbours: neighbours not initialized !!! returning empty list");
1770 neighbourList.resize(0);
1774 neighbourList.clear();
1781 bool prevPhi = corners2DOnly || (option &
prevInPhi);
1782 bool nextPhi = corners2DOnly || (option &
nextInPhi);
1783 bool prevEta = corners2DOnly || (option &
prevInEta);
1784 bool nextEta = corners2DOnly || (option &
nextInEta);
1786 std::vector<IdentifierHash> inpList;
1787 std::vector<IdentifierHash>::iterator inpItr;
1788 std::vector<IdentifierHash>::iterator inpLast;
1790 inpList.push_back(id_orig);
1793 if (prevPhi)
m_neighbour.prev_phi(id_orig,neighbourList);
1794 if (nextPhi)
m_neighbour.next_phi(id_orig,neighbourList);
1799 }
else if (corners2DOnly) {
1801 inpList = std::move(neighbourList);
1802 neighbourList.clear();
1806 inpList.insert (inpList.end(), neighbourList.begin(), neighbourList.end());
1811 inpItr = inpList.begin();
1812 inpLast = inpList.end();
1813 for ( ; inpItr != inpLast; ++inpItr) {
1815 if (prevEta)
m_neighbour.prev_eta(
id,neighbourList);
1816 if (nextEta)
m_neighbour.next_eta(
id,neighbourList);
1822 inpItr = inpList.begin();
1823 inpLast = inpList.end();
1824 for ( ; inpItr != inpLast; ++inpItr) {
1832 if (prevSmp)
m_neighbour.prev_samp(id_orig,neighbourList);
1833 if (nextSmp)
m_neighbour.next_samp(id_orig,neighbourList);
1837 if (!neighbourList.empty())
result = 0;
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Factor out code common between TileID and Tile_SuperCell_ID.
static const Attributes_t empty
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
bool is_tile(Identifier id) const
ExpandedIdentifier tile_exp(void) const
int tile_field_value() const
const std::string & group() const
Group name for this helper.
Identifier id(IdentifierHash hashId) const
Return the identifier for a given hash code (no checking).
const std::vector< Identifier > & ids() const
Return a vector of all Identifiers for this group.
id_iterator end() const
Return an end iterator over the group's Identifiers.
id_iterator begin() const
Return a begin iterator over the group's Identifiers.
id_range range() const
Return an iterator range over the group's Identifiers.
int get_hash(Identifier id, IdentifierHash &hash_id) const
Look up the hash code corresponding to an Identifier.
size_type hash_max() const
Return one more than the largest hash code.
const HashGroup & regions() const
Return the HashGroup for regions.
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
const std::string & name() const
Return the name for this helper.
const HashGroup & channels() const
Return the HashGroup for channels (cells).
void add(element_type value)
Append a value into a new field.
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
const ExpandedIdentifier & prefix_id() const
Accessors.
int unpack(const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix...
MultiRange build_multirange() const
Get MultiRange for full dictionary.
int get_label_value(const std::string &field, const std::string &label, int &value) const
IdDictGroup * find_group(const std::string &group_name)
const std::string & name() const
Dictionary name.
const IdDictField * find_field(const std::string &name) const
const IdDictRegion & region(size_t i) const
Region at index i.
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
const std::string & find_metadata(const std::string &name) const
Access to meta data, name/value pairs.
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...
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.
Exception class for Tile Identifiers.
const std::vector< Identifier > & region_ids() const
provide access to id vectors, accessed via hash
id_iterator module_begin() const
iterator over set of module Identifiers
IdDictFieldImplementation m_side_impl
id_range tower_range() const
MultiRange m_full_tower_range
bool is_twosides(const Identifier &id) const
int sample(const Identifier &id) const
IdDictFieldImplementation m_adc_impl
Identifier tile_barrel() const
build identifier for Tile Barrel
Tile_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
int decode_section(int section) const
int region_eta_max(const Identifier &id) const
id_iterator tower_begin() const
iterator over set of tower Identifiers
const std::vector< Identifier > & adc_ids() const
int tower(const Identifier &id) const
id_iterator module_end() const
Identifier tile_system() const
build identifier for whole TileCal
CaloIDHelper::HashGroup m_modules
MultiRange m_full_adc_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)
size_type module_hash_max() const
bool is_tile_aux(const Identifier &id) const
id_iterator pmt_begin() const
iterator over set of pmt Identifiers
int get_neighbours(const IdentifierHash &id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = prevInPhi,...
CaloIDHelper::HashGroup m_towers
size_type cell_hash_max() const
IdContext adc_context() const
id for ADCs
int adc(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)
Identifier tower_id(int section, int side, int module, int tower) const
IdDictFieldImplementation m_tower_impl
id_iterator reg_end() const
IdContext cell_context() const
id for cells
IdDictFieldImplementation m_section_impl
IdContext pmt_context() const
id for PMTs
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
bool is_supercell(const Identifier &id) const
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
const std::vector< Identifier > & tower_ids() const
Identifier tile_det(int section) const
build identifier for any Tilecal section
size_type pmt_hash_max() const
const std::vector< Identifier > & pmt_ids() const
bool is_low_gain(const Identifier &id) const
IdentifierHash cell_hash(const Identifier &cell_id) const
fast conversion from ID to hash for cells
const std::vector< Identifier > & cell_ids() const
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
id_range module_range() const
IdContext module_context() const
id for modules
CaloIDHelper::HashGroup m_pmts
MultiRange m_full_module_range
bool is_tile_barrel(const Identifier &id) const
Test of an Identifier to see if it belongs to a particular part of the calorimeter.
int encode_section(int section) const
CaloIDHelper::HashGroup m_adcs
MultiRange m_full_pmt_range
std::string to_string(const Identifier &id, int level=0) const
IdDictFieldImplementation m_pmt_impl
int eta_max(const Identifier &id) const
id_iterator cell_begin() const
iterator over set of cell Identifiers
id_range pmt_range() const
int system(const Identifier &id) const
Identifier tile_extbarrel() const
build identifier for Tile Extended Barrel
const std::vector< Identifier > & module_ids() const
id_iterator reg_begin() const
iterator over set of region Identifiers
Identifier cell_id(const Identifier &any_id) const
TileNeighbour m_neighbour
int region_eta_min(const Identifier &id) const
Identifier adc_id(const Identifier &cell_id, int pmt, int adc) const
id_range reg_range() const
id_iterator adc_end() const
size_type m_SECTION_INDEX
id_iterator cell_end() const
int side(const Identifier &id) const
size_type adc_hash_max() const
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
id_range cell_range() const
id_iterator adc_begin() const
iterator over set of adc Identifiers
Identifier region_id(int index) const
build single region, module, tower, cell, pmt, adc identifiers
IdContext tower_context() const
id for towers
size_type m_tile_region_index
int initLevelsFromDict(const std::string &group_name)
int pmt(const Identifier &id) const
IdDictFieldImplementation m_module_impl
int section(const Identifier &id) const
int eta_min(const Identifier &id) const
max values (-999 == failure)
id_iterator pmt_end() const
bool is_tile_extbarrel(const Identifier &id) const
bool is_tile_gap(const Identifier &id) const
id_range adc_range() const
IdDictFieldImplementation m_sample_impl
Identifier tile_gap() const
build identifier for Tile Gap detector (ITC + gap/crack scintillators)
bool is_high_gain(const Identifier &id) const
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
IdDictFieldImplementation m_system_impl
Identifier pmt_id(const Identifier &any_id) const
int get_field(const Identifier &id, size_type index) const
unpack one field from Identifier
size_type region_hash_max() const
hash tables max size
bool is_tile_gapscin(const Identifier &id) const
bool is_positive(const Identifier &id) const
Identifier module_id(int section, int side, int module) const
int phi_max(const Identifier &id) const
bool is_negative(const Identifier &id) const
int region(int section, int side) const
MultiRange m_full_cell_range
id_iterator tower_end() const
size_type tower_hash_max() const
MultiRange m_full_region_range
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs