 |
ATLAS Offline Software
|
Go to the documentation of this file.
22 #include "GaudiKernel/MsgStream.h"
36 const std::string&
group,
39 , m_supercell (supercell ? 1 : 0)
40 , m_tile_region_index(0)
42 , m_SECTION_INDEX(999)
68 return "Tile_Base_ID::to_string - unknown context";
73 return "Tile_Base_ID::to_string - can not expand ID";
75 return (std::string)(exp_id);
92 return "Tile_Base_ID::to_string - unknown context";
96 if (
get_id ( hash_id,
id, &context ) == 0 ) {
99 return "Tile_Base_ID::to_string - can not expand ID";
101 return (std::string)(exp_id);
104 return "Tile_Base_ID::to_string - can not get ID from hash_id";
125 IdentifierHash hash_id;
136 IdentifierHash hash_id;
266 && (
side(
id) == 0 );
412 IdentifierHash hash_id =
index;
432 std::string errorMessage =
"Tile_Base_ID::region_id() result is not OK: ID, range = "
486 std::string errorMessage =
"Tile_Base_ID::module_id() result is not OK: ID, range = "
542 std::string errorMessage =
"Tile_Base_ID::tower_id() result is not OK: ID, range = "
567 int module,
int tower)
const
611 std::string errorMessage =
"Tile_Base_ID::cell_id() result is not OK: ID, range = "
657 int pmt,
bool checks )
const
669 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) could not pack ID: "
683 std::string errorMessage =
"Tile_Base_ID::pmt_id(cell_id,pmt) result is not OK: ID = "
693 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
724 std::string errorMessage =
"Tile_Base_ID::pmt_id() result is not OK: ID, range = "
759 int pmt,
int adc,
bool checks )
const
772 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) could not pack ID: "
786 std::string errorMessage =
"Tile_Base_ID::adc_id(cell_id,pmt,adc) result is not OK: ID = "
796 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
814 int adc,
bool checks )
const
826 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) could not pack ID: "
840 std::string errorMessage =
"Tile_Base_ID::adc_id(pmt_id,adc) result is not OK: ID = "
850 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
881 std::string errorMessage =
"Tile_Base_ID::adc_id() result is not OK: ID, range = "
927 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
945 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
964 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
982 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
1000 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
1018 if (!
dict()->pack32(
id,0,
id.
fields() - 1,compactId)) {
1026 if (hash_id <
channels().hash_max()) {
1029 std::string errorMessage =
"Tile_Base_ID::cell_id(hash_id) - hash_id out of range ";
1036 IdentifierHash ret = 0;
1040 std::string errorMessage =
"Tile_Base_ID::cell_hash(cell_id) - cell_id out of range ";
1100 log << MSG::ERROR <<
"get_id: adc hash_id is out of range " << hash_id
1109 log << MSG::ERROR <<
"get_id: pmt hash_id is out of range " << hash_id
1113 if (hash_id <
channels().hash_max()) {
1118 log << MSG::ERROR <<
"get_id: cell hash_id is out of range " << hash_id
1127 log << MSG::ERROR <<
"get_id: tower hash_id is out of range " << hash_id
1136 log << MSG::ERROR <<
"get_id: module hash_id is out of range " << hash_id
1140 if (hash_id <
regions().hash_max()) {
1145 log << MSG::ERROR <<
"get_id: region hash_id is out of range " << hash_id
1156 IdentifierHash& hash_id,
1214 if (atlasDict->
get_label_value(
"subdet",
"TileCalorimeter", tileField)) {
1215 log << MSG::ERROR <<
"Could not get value for label 'TileCalorimeter' of field 'subdet' in dictionary "
1216 << atlasDict->
name()
1223 tile_id.
add(tileField);
1235 int tilehwField = -1;
1236 if (
dict()->get_label_value(
"section",
"Online", tilehwField)) {
1237 log << MSG::ERROR <<
"Could not get value for label 'Online' of field 'section' in dictionary "
1243 reg_id.
add(tilehwField);
1253 int tiletbField = -1;
1254 if (
dict()->get_label_value(
"section",
"Testbeam", tiletbField)) {
1255 log << MSG::ERROR <<
"Could not get value for label 'Testbeam' of field 'section' in dictionary "
1260 reg_id = std::move(tile_id);
1261 reg_id.
add(tiletbField);
1288 std::string neighbourFile;
1290 neighbourFile =
"TileSuperCellNeighbour.txt";
1295 if (neighbourFile.empty())
throw std::runtime_error(
"TileID: Cannot find the Tile Neighbour file name");
1511 if (
range.match(expId)) {
1513 if (not eta_field.
empty()) {
1536 if (
range.match(expId)) {
1538 if (not eta_field.
empty()) {
1581 if (
range.match(expId)) {
1583 if (not phi_field.
empty()) {
1607 else if ( 0 ==
begin) {
1622 log << MSG::ERROR <<
"initLevelsFromDict - dictionary NOT initialized "
1640 log << MSG::ERROR <<
"initLevelsFromDict - cannot find " <<
group_name
1641 <<
" group' field " <<
endmsg;
1653 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'subdet' field "
1663 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'section' field "
1673 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'side' field "
1683 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'module' field "
1693 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'tower' field "
1703 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'sampling' field "
1713 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'pmt' field "
1723 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'adc' field "
1740 log <<
MSG::DEBUG <<
"initLevelsFromDict decode index and bit fields for each level: " <<
endmsg ;
1791 std::vector<IdentifierHash>& neighbourList)
const
1798 log << MSG::WARNING <<
"get_neighbours: neighbours not initialized !!! returning empty list" <<
endmsg;
1800 neighbourList.resize(0);
1804 neighbourList.clear();
1811 bool prevPhi = corners2DOnly || (option &
prevInPhi);
1812 bool nextPhi = corners2DOnly || (option &
nextInPhi);
1813 bool prevEta = corners2DOnly || (option &
prevInEta);
1814 bool nextEta = corners2DOnly || (option &
nextInEta);
1816 std::vector<IdentifierHash> inpList;
1820 inpList.push_back(id_orig);
1829 }
else if (corners2DOnly) {
1831 inpList = std::move(neighbourList);
1832 neighbourList.clear();
1836 inpList.insert (inpList.end(), neighbourList.begin(), neighbourList.end());
1841 inpItr = inpList.begin();
1842 inpLast = inpList.end();
1843 for ( ; inpItr != inpLast; ++inpItr) {
1844 IdentifierHash
id = (*inpItr);
1852 inpItr = inpList.begin();
1853 inpLast = inpList.end();
1854 for ( ; inpItr != inpLast; ++inpItr) {
1855 IdentifierHash
id = (*inpItr);
1867 if (!neighbourList.empty())
result = 0;
Identifier module_id(int section, int side, int module) const
JetConstituentVector::iterator iterator
IdDictFieldImplementation m_tower_impl
int eta_min(const Identifier &id) const
max values (-999 == failure)
bool is_tile_aux(const Identifier &id) const
int decode_section(int section) const
int next_eta(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
id_range pmt_range() const
MultiRange build_multirange() const
Get MultiRange for full dictionary.
bool is_positive(const Identifier &id) const
MultiRange m_full_adc_range
id_iterator tower_begin() const
iterator over set of tower Identifiers
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
IdContext adc_context() const
id for ADCs
id_range reg_range() const
size_type cell_hash_max() const
int next_samp(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
id_iterator end() const
Return an end iterator over the group's Identifiers.
id_range range() const
Return an iterator range over the group's Identifiers.
IdDictFieldImplementation m_section_impl
IdContext module_context() const
id for modules
std::string show_to_string(void) const
bool is_tile_gap(const Identifier &id) const
size_type tower_hash_max() const
id_iterator cell_end() const
const IdDictRegion & region(size_t i) const
Region at index i.
IdDictFieldImplementation m_system_impl
int pmt(const Identifier &id) const
const std::vector< Identifier > & region_ids() const
provide access to id vectors, accessed via hash
element_type get_minimum() const
Query the values.
id_range cell_range() const
int init(T &parent, const std::string &type, const MultiRange &full_range, Identifier(T::*idfunc)(const ExpandedIdentifier &) const, size_type end_index)
Initialize.
size_type end_index() const
int side(const Identifier &id) const
void add(element_type value)
Append a value into a new field.
id_iterator module_end() const
Identifier id(IdentifierHash hashId) const
Return the identifier for a given hash code (no checking).
int sample(const Identifier &id) const
int encode_section(int section) const
id_iterator begin() const
Return a begin iterator over the group's Identifiers.
bool is_tile_extbarrel(const Identifier &id) const
int initLevelsFromDict(const std::string &group_name)
IMessageSvc * m_msgSvc
pointer to the message service
const std::vector< Identifier > & cell_ids() const
const std::string & find_metadata(const std::string &name) const
Access to meta data, name/value pairs.
element_type get_maximum() const
TileNeighbour m_neighbour
int tower(const Identifier &id) const
const std::string & name() const
Dictionary name.
id_iterator cell_begin() const
iterator over set of cell Identifiers
size_type pmt_hash_max() const
int system(const Identifier &id) const
int get_hash(Identifier id, IdentifierHash &hash_id) const
Look up the hash code corresponding to an Identifier.
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
int prev_samp(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
IdDictFieldImplementation m_module_impl
bool is_high_gain(const Identifier &id) const
ExpandedIdentifier tile_exp(void) const
IdDictField * find_field(const std::string &name) const
const HashGroup & regions() const
Return the HashGroup for regions.
int region(int section, int side) const
size_type region_hash_max() const
hash tables max size
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
int prev_eta(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int prev_phi(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
int get_field(const Identifier &id, size_type index) const
unpack one field from Identifier
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
int initialize(const Tile_Base_ID *tileID, const std::string &filename="TileNeighbour.txt")
size_type m_SECTION_INDEX
CaloIDHelper::HashGroup m_pmts
Identifier tile_det(int section) const
build identifier for any Tilecal section
Identifier::size_type size_type
size_type m_tile_region_index
Identifier region_id(int index) const
build single region, module, tower, cell, pmt, adc identifiers
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
size_type begin_index() 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)
IdDictGroup * find_group(const std::string &group_name) const
int adc(const Identifier &id) const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Identifier tile_gap() const
build identifier for Tile Gap detector (ITC + gap/crack scintillators)
bool is_tile_gapscin(const Identifier &id) const
int module(const Identifier &id) const
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
Identifier tower_id(int section, int side, int module, int tower) const
void remove_range(const ExpandedIdentifier &id)
Remove a Range made from a single ExpandedIdentifier.
const std::vector< Identifier > & ids() const
Return a vector of all Identifiers for this group.
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
Base class to factor out code common among Calo ID helpers.
Identifier tile_system() const
build identifier for whole TileCal
id_range module_range() const
id_range adc_range() const
Identifier tile_extbarrel() const
build identifier for Tile Extended Barrel
size_type adc_hash_max() const
Exception class for Tile Identifiers.
bool is_tile(Identifier id) const
const std::string & group() const
Group name for this helper.
id_iterator tower_end() const
const std::vector< Identifier > & module_ids() const
int region_eta_max(const Identifier &id) const
id_iterator module_begin() const
iterator over set of module Identifiers
Factor out code common between TileID and Tile_SuperCell_ID.
bool m_quiet
If true, suppress DEBUG/INFO messages.
id_iterator reg_end() const
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
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)
id_iterator pmt_begin() const
iterator over set of pmt Identifiers
Identifier adc_id(const Identifier &cell_id, int pmt, int adc) const
int tile_field_value() const
int get_label_value(const std::string &field, const std::string &label, int &value) const
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...
const ExpandedIdentifier & prefix_id() const
Accessors.
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
id_iterator adc_begin() const
iterator over set of adc Identifiers
id_iterator adc_end() const
MultiRange m_full_module_range
CaloIDHelper::HashGroup m_towers
IdDictFieldImplementation m_pmt_impl
int phi_max(const Identifier &id) const
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
const std::vector< Identifier > & tower_ids() const
IdDictFieldImplementation m_adc_impl
Identifier tile_barrel() const
build identifier for Tile Barrel
def init(v_theApp, v_rootStream=None)
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,...
int region_eta_min(const Identifier &id) const
const HashGroup & channels() const
Return the HashGroup for channels (cells).
int prev_samp_wide(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
IdDictFieldImplementation m_sample_impl
IdDictFieldImplementation m_side_impl
int match(const ExpandedIdentifier &id) const
Match an identifier.
MultiRange m_full_cell_range
IdContext cell_context() const
id for cells
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
CaloIDHelper::HashGroup m_adcs
size_type module_hash_max() const
CaloIDHelper::HashGroup m_modules
std::string to_string(const Identifier &id, int level=0) const
MultiRange m_full_pmt_range
int eta_max(const Identifier &id) const
const std::vector< Identifier > & adc_ids() const
Identifier pmt_id(const Identifier &any_id) const
id_iterator pmt_end() const
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
bool is_supercell(const Identifier &id) const
bool is_twosides(const Identifier &id) const
id_range tower_range() const
bool is_negative(const Identifier &id) const
IdContext tower_context() const
id for towers
MultiRange m_full_tower_range
const std::vector< Identifier > & pmt_ids() const
boost::iterator_range< id_iterator > id_range
Type for range over identifiers.
int next_phi(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
IdentifierHash cell_hash(const Identifier &cell_id) const
fast conversion from ID to hash for cells
int next_samp_wide(const IdentifierHash &id, std::vector< IdentifierHash > &neighbourList) const
MultiRange m_full_region_range
int section(const Identifier &id) const
bool is_tile_barrel(const Identifier &id) const
Test of an Identifier to see if it belongs to a particular part of the calorimeter.
Identifier cell_id(const Identifier &any_id) const
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
bool is_low_gain(const Identifier &id) const
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Tile_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
IdContext pmt_context() const
id for PMTs
id_iterator reg_begin() const
iterator over set of region Identifiers
size_type hash_max() const
Return one more than the largest hash code.
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).