32 const std::string&
group,
64 return "Tile_Base_ID::to_string - unknown context";
69 return "Tile_Base_ID::to_string - can not expand ID";
71 return (std::string)(exp_id);
88 return "Tile_Base_ID::to_string - unknown context";
92 if (
get_id ( hash_id,
id, &context ) == 0 ) {
95 return "Tile_Base_ID::to_string - can not expand ID";
97 return (std::string)(exp_id);
100 return "Tile_Base_ID::to_string - can not get ID from hash_id";
159Tile_Base_ID::module (
const Identifier &
id )
const
262 && (
side(
id) == 0 );
411 get_id(hash_id,result,&context);
428 std::string errorMessage =
"Tile_Base_ID::region_id() result is not OK: ID, range = "
482 std::string errorMessage =
"Tile_Base_ID::module_id() result is not OK: ID, range = "
526 int module,
int tower,
538 std::string errorMessage =
"Tile_Base_ID::tower_id() result is not OK: ID, range = "
563 int module,
int tower)
const
594 int module,
int tower,
607 std::string errorMessage =
"Tile_Base_ID::cell_id() result is not OK: ID, range = "
633 int module,
int tower,
653 int pmt,
bool checks )
const
665 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) could not pack ID: "
679 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) result is not OK: ID = "
680 + result.getString() ;
689 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
707 int module,
int tower,
720 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
747 int module,
int tower,
755 int pmt,
int adc,
bool checks )
const
768 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) could not pack ID: "
782 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) result is not OK: ID = "
783 + result.getString() ;
792 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
810 int adc,
bool checks )
const
822 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) could not pack ID: "
836 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) result is not OK: ID = "
837 + result.getString() ;
846 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
877 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
923 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
935 id << module <<
tower;
941 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
960 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
978 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
996 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
1014 if (!dict()->pack32(
id,0,
id.fields() - 1,compactId)) {
1022 if (hash_id <
channels().hash_max()) {
1025 std::string errorMessage =
"Tile_Base_ID::cell_id(hash_id) - hash_id out of range ";
1036 std::string errorMessage =
"Tile_Base_ID::cell_hash(cell_id) - cell_id out of range ";
1084 size_t begin = (context) ? context->begin_index(): 0;
1086 size_t end = (context) ? context->end_index() : 0;
1091 if (hash_id <
m_adcs.hash_max()) {
1092 id =
m_adcs.id (hash_id);
1095 ATH_MSG_ERROR(
"get_id: adc hash_id is out of range " << hash_id
1096 <<
" > " <<
m_adcs.hash_max());
1099 if (hash_id <
m_pmts.hash_max()) {
1100 id =
m_pmts.id (hash_id);
1103 ATH_MSG_ERROR(
"get_id: pmt hash_id is out of range " << hash_id
1104 <<
" >= " <<
m_pmts.hash_max());
1107 if (hash_id <
channels().hash_max()) {
1111 ATH_MSG_ERROR(
"get_id: cell hash_id is out of range " << hash_id
1112 <<
" >= " <<
channels().hash_max());
1115 if (hash_id <
m_towers.hash_max()) {
1119 ATH_MSG_ERROR(
"get_id: tower hash_id is out of range " << hash_id
1127 ATH_MSG_ERROR(
"get_id: module hash_id is out of range " << hash_id
1131 if (hash_id <
regions().hash_max()) {
1135 ATH_MSG_ERROR(
"get_id: region hash_id is out of range " << hash_id
1136 <<
" >= " <<
regions().hash_max());
1152 size_t begin = (context) ? context->begin_index(): 0;
1153 size_t end = (context) ? context->end_index() : 0;
1157 result =
m_adcs.get_hash (
id, hash_id);
1176 const std::string& group_name)
1182 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
1189 ATH_MSG_DEBUG(
"calling base initialize_base_from_dictionary");
1192 if(CaloIDHelper::initialize_base_from_dictionary(dict_mgr,
1203 if (atlasDict->
get_label_value(
"subdet",
"TileCalorimeter", tileField)) {
1204 ATH_MSG_ERROR(
"Could not get value for label 'TileCalorimeter' of field 'subdet' in dictionary "
1205 << atlasDict->
name());
1211 tile_id.
add(tileField);
1215 m_full_adc_range = dict()->build_multirange(reg_id, group_name, prefix,
"adc");
1216 m_full_pmt_range = dict()->build_multirange(reg_id, group_name, prefix,
"pmt");
1217 m_full_cell_range = dict()->build_multirange(reg_id, group_name, prefix,
"sampling");
1223 int tilehwField = -1;
1224 if (dict()->get_label_value(
"section",
"Online", tilehwField)) {
1225 ATH_MSG_ERROR(
"Could not get value for label 'Online' of field 'section' in dictionary "
1230 reg_id.
add(tilehwField);
1240 int tiletbField = -1;
1241 if (dict()->get_label_value(
"section",
"Testbeam", tiletbField)) {
1242 ATH_MSG_ERROR(
"Could not get value for label 'Testbeam' of field 'section' in dictionary "
1246 reg_id = std::move(tile_id);
1247 reg_id.
add(tiletbField);
1272 std::string neighbourFile;
1274 neighbourFile =
"TileSuperCellNeighbour.txt";
1279 if (neighbourFile.empty())
throw std::runtime_error(
"TileID: Cannot find the Tile Neighbour file name");
1280 if(
m_neighbour.initialize(
this, neighbourFile))
return (1);
1308 return m_pmts.hash_max();
1313 return m_adcs.hash_max();
1495 if (range.match(expId)) {
1497 if (not eta_field.
empty()) {
1499 if (-999 == result) {
1503 if (etamin < result) result = etamin;
1520 if (range.match(expId)) {
1522 if (not eta_field.
empty()) {
1524 if (result < etamax) result = etamax;
1565 if (range.match(expId)) {
1567 if (not phi_field.
empty()) {
1569 if (result < phimax) result = phimax;
1584 size_t begin = (context) ? context->begin_index() : 0;
1585 size_t end = (context) ? context->end_index() :
m_ADC_INDEX;
1591 else if ( 0 == begin) {
1593 result = dict()->unpack(
group(),
id,
empty, end, exp_id);
1596 result = dict()->unpack(
group(),
id, context->prefix_id(), end, exp_id);
1604 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized ");
1621 ATH_MSG_ERROR(
"initLevelsFromDict - cannot find " << group_name
1622 <<
" group' field ");
1629 const IdDictField* field = dict()->find_field(
"subdet") ;
1634 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field ");
1638 field = dict()->find_field(
"section") ;
1643 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'section' field ");
1647 field = dict()->find_field(
"side") ;
1652 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'side' field ");
1656 field = dict()->find_field(
"module") ;
1661 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'module' field ");
1665 field = dict()->find_field(
"tower") ;
1670 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'tower' field ");
1674 field = dict()->find_field(
"sampling") ;
1679 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'sampling' field ");
1683 field = dict()->find_field(
"pmt") ;
1688 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'pmt' field ");
1692 field = dict()->find_field(
"adc") ;
1697 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'adc' field ");
1712 ATH_MSG_DEBUG(
"initLevelsFromDict decode index and bit fields for each level: " );
1762 std::vector<IdentifierHash>& neighbourList)
const
1767 ATH_MSG_WARNING(
"get_neighbours: neighbours not initialized !!! returning empty list");
1768 neighbourList.resize(0);
1772 neighbourList.clear();
1779 bool prevPhi = corners2DOnly || (option &
prevInPhi);
1780 bool nextPhi = corners2DOnly || (option &
nextInPhi);
1781 bool prevEta = corners2DOnly || (option &
prevInEta);
1782 bool nextEta = corners2DOnly || (option &
nextInEta);
1784 std::vector<IdentifierHash> inpList;
1785 std::vector<IdentifierHash>::iterator inpItr;
1786 std::vector<IdentifierHash>::iterator inpLast;
1788 inpList.push_back(id_orig);
1791 if (prevPhi)
m_neighbour.prev_phi(id_orig,neighbourList);
1792 if (nextPhi)
m_neighbour.next_phi(id_orig,neighbourList);
1797 }
else if (corners2DOnly) {
1799 inpList = std::move(neighbourList);
1800 neighbourList.clear();
1804 inpList.insert (inpList.end(), neighbourList.begin(), neighbourList.end());
1809 inpItr = inpList.begin();
1810 inpLast = inpList.end();
1811 for ( ; inpItr != inpLast; ++inpItr) {
1813 if (prevEta)
m_neighbour.prev_eta(
id,neighbourList);
1814 if (nextEta)
m_neighbour.next_eta(
id,neighbourList);
1820 inpItr = inpList.begin();
1821 inpLast = inpList.end();
1822 for ( ; inpItr != inpLast; ++inpItr) {
1830 if (prevSmp)
m_neighbour.prev_samp(id_orig,neighbourList);
1831 if (nextSmp)
m_neighbour.next_samp(id_orig,neighbourList);
1835 if (!neighbourList.empty()) result = 0;
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#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).
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
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...
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & name() const
Dictionary name.
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