53 if (range.match(expId)) {
55 if (not eta_field.
empty()) {
79 if (range.match(expId)) {
81 if (not eta_field.
empty()) {
100 if (range.match(expId)) {
102 if (not phi_field.
empty()) {
126 if (range.match(expId)) {
128 if (not phi_field.
empty()) {
143 neighbourList.clear();
146 ATH_MSG_WARNING(
"neighbours not initialized !!! returning empty list");
151 ATH_MSG_WARNING(
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
160 neighbourList.insert(neighbourList.end(),
168 neighbourList.insert(neighbourList.end(),
176 neighbourList.insert(neighbourList.end(),
201 ATH_MSG_DEBUG(
"Request to reinitialize not satisfied - tags have not changed");
217 if (!
dict()->find_group(
"lar_mini_fcal")) {
218 ATH_MSG_INFO(
"initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.");
225 ATH_MSG_WARNING(
"initialize_from_dict - cannot initialize MiniFCAL part of LArCalorimeter dictionary");
233 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
234 ATH_MSG_ERROR(
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary " << atlasDict->
name());
240 int larFcalField = -1;
241 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
242 ATH_MSG_ERROR(
"Could not get value for label 'LArMiniFCAL' of field 'part' in dictionary " << atlasDict->
name());
254 std::string
str =
"lar_mini_fcal";
301 std::string errorMessage =
"LArMiniFCAL_ID::module_id() result is not OK: ID, range = "
317 std::string errorMessage =
"LArMiniFCAL_ID::channel_id() result is not OK: ID, range = "
332 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID = "
340 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID, range = "
369 ATH_MSG_ERROR(
"initLevelsFromDict - dictionary NOT initialized");
389 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'subdet' field");
398 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'part' field");
407 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'barrel-endcap' field");
416 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'module' field");
436 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'eta' field");
445 ATH_MSG_ERROR(
"initLevelsFromDict - unable to find 'phi' field");
473 ATH_MSG_DEBUG(
"decode index and bit fields for each level: ");
487 if (
channels().init (*
this,
"channels",
492 if (
regions().init (*
this,
"regions",
511 fin.open(
file.c_str());
530 bool isComment =
true;
532 int isamp,idepth, iphi,ieta;
537 fin.getline(aLine,
sizeof(aLine)-1);
538 sLine = std::string(aLine);
539 }
while (sLine.empty() && !fin.eof());
540 isComment = ( sLine.find(
'#') != std::string::npos );
543 while ( sLine.empty() && !fin.eof()) {
544 fin.getline(aLine,
sizeof(aLine)-1);
545 sLine = std::string(aLine);
547 std::istringstream es( sLine.c_str() );
549 if ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
552 while ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
553 if (!ic.is_valid())
continue;
556 vec[ic].insert(
vec[ic].end(),inext);
560 }
while (!fin.eof()) ;
571 std::string f2d,f3dnext,f3dprev;
576 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
577 ATH_MSG_ERROR(
"init_neighbours: cannot find neighbours files: "
578 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev);
579 throw std::runtime_error(
"LArMiniFCAL_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
std::vector< size_t > vec
static const Attributes_t empty
virtual std::string dictionaryVersion(void) const override
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.
int lar_fcal_field_value() const
virtual void setDictVersion(const IdDictMgr &dict_mgr, const std::string &name) override
ExpandedIdentifier lar_fcal_exp(void) const
int lar_field_value() const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
size_type hash_max() const
Return one more than the largest hash code.
const HashGroup & regions() const
Return the HashGroup for regions.
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
IdContext region_context() const
Return the context for regions.
size_type channel_hash_max() const
One more than the largest channel (cell) hash code.
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier region_id(IdentifierHash hashId) const
Return the region Identifier for a given hash code (no checking).
int fill_vec_of_dict_regions(const std::string &group_name="")
Initialize the list of detector regions.
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
const HashGroup & channels() const
Return the HashGroup for channels (cells).
void clear()
Erase all fields.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
size_type end_index() const
MultiRange build_multirange() const
Get MultiRange for full dictionary.
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & name() const
Dictionary name.
const IdDictField * find_field(const std::string &name) const
const IdDictRegion * find_region(const std::string ®ion_name) const
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.
const IdDictFieldImplementation & implementation(size_t i) const
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.
Exception class for LAr Identifiers.
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
IdDictFieldImplementation m_depth_impl
void module_id_checks(int pos_neg, int module) const
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
int init_neighbors_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
IdDictFieldImplementation m_phi_impl
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 = all2D,...
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
IdDictFieldImplementation m_module_impl
MultiRange m_full_depth_range
int depth(const Identifier id) const
depth [0,3]
MultiRange m_full_module_range
IdDictFieldImplementation m_pn_impl
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
IdDictFieldImplementation m_lar_impl
std::vector< short int > m_vecOfPhiMin
int init_neighbors_3d_next(const std::string &filename)
MultiRange m_full_channel_range
size_type m_MiniFCAL_INDEX
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
IdContext module_context() const
context for modules – method kept for backward compatibility.
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
size_type m_fcal_region_index
IdDictFieldImplementation m_fcal_impl
IdDictFieldImplementation m_eta_impl
int phi_min_init(const Identifier regId) const
void channel_id_checks(int pos_neg, int module, int depth, int eta, int phi) const
std::vector< std::set< IdentifierHash > > m_neighbors_2d_vec
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
int phi(const Identifier id) const
phi [0,15]
int init_neighbors(const IdDictMgr &dict_mgr)
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
int init_neighbors_3d_prev(const std::string &filename)
int init_neighbors_2d(const std::string &filename)
std::vector< std::set< IdentifierHash > > m_neighbors_3d_next_vec
std::vector< std::set< IdentifierHash > > m_neighbors_3d_prev_vec
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
std::string depth
tag string for intendation
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs