 |
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "GaudiKernel/MsgStream.h"
33 m_is_initialized(false),
34 m_fcal_region_index(0),
36 m_MiniFCAL_INDEX(999),
55 if (
range.match(expId)) {
57 if (not eta_field.
empty()) {
81 if (
range.match(expId)) {
83 if (not eta_field.
empty()) {
102 if (
range.match(expId)) {
104 if (not phi_field.
empty()) {
128 if (
range.match(expId)) {
130 if (not phi_field.
empty()) {
145 neighbourList.clear();
150 log << MSG::WARNING <<
"neighbours not initialized !!! returning empty list" <<
endmsg;
153 std::cout <<
" neighbours not initialized !!! returning empty list " << std::endl;
161 log << MSG::WARNING <<
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
165 std::cout <<
" neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
175 neighbourList.insert(neighbourList.end(),
183 neighbourList.insert(neighbourList.end(),
191 neighbourList.insert(neighbourList.end(),
203 std::cout <<
" NO MiniFCAL neighbours (yet) in the context of " <<
dictionaryVersion() << std::endl;
220 std::string strg =
"initialize_from_dictionary";
225 log <<
MSG::DEBUG <<
"Request to reinitialize not satisfied - tags have not changed" <<
endmsg;
241 if (!
dict()->find_group(
"lar_mini_fcal")) {
242 strg =
" initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.";
250 strg =
" initialize_from_dict - cannot initialize MiniFCAL part of LArCalorimeter dictionary ";
255 std::cout << strg << std::endl;
264 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
265 std::stringstream strm ;
266 strm << atlasDict->
name();
267 strg =
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
273 std::cout << strg << std::endl;
280 int larFcalField = -1;
281 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
282 std::stringstream strm ;
283 strm << atlasDict->
name();
284 strg =
"Could not get value for label 'LArMiniFCAL' of field 'part' in dictionary "
290 std::cout << strg << std::endl;
303 std::string
str =
"lar_mini_fcal";
309 std::string strg0 =
"initialize_from_dict : " ;
320 std::cout << strg0 << std::endl;
321 std::cout << strg1 << std::endl;
322 std::cout << strg2 << std::endl;
323 std::cout << strg2a<< std::endl;
364 std::string errorMessage =
"LArMiniFCAL_ID::module_id() result is not OK: ID, range = "
380 std::string errorMessage =
"LArMiniFCAL_ID::channel_id() result is not OK: ID, range = "
395 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID = "
403 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID, range = "
434 std::string strg =
"initLevelsFromDict - dictionary NOT initialized ";
439 std::cout << strg << std::endl;
460 std::string strg =
"initLevelsFromDict - unable to find 'subdet' field ";
465 std::cout << strg << std::endl;
475 std::string strg =
"initLevelsFromDict - unable to find 'part' field ";
480 std::cout << strg << std::endl;
490 std::string strg =
"initLevelsFromDict - unable to find 'barrel-endcap' field ";
495 std::cout << strg << std::endl;
505 std::string strg =
"initLevelsFromDict - unable to find 'module' field ";
510 std::cout << strg << std::endl;
521 std::string strg =
"initLevelsFromDict - unable to find 'depth' field ";
526 std::cout << strg << std::endl;
537 std::string strg =
"initLevelsFromDict - unable to find 'eta' field ";
542 std::cout << strg << std::endl;
552 std::string strg =
"initLevelsFromDict - unable to find 'phi' field ";
557 std::cout << strg << std::endl;
578 std::stringstream strm ;
580 std::string strg =
"initLevelsFromDict - unable to find fcal region index: id, reg "
581 + (std::string)
id + strm.str();
586 std::cout << strg << std::endl;
616 std::cout <<
"decode index and bit fields for each level: " << std::endl;
656 std::cout <<
"LArMiniFCAL_ID::init_neighbors_from_file " << std::endl;
671 std::cout <<
"LArMiniFCAL_ID::Could not find input file " <<
filename << std::endl;
677 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
680 std::cout <<
"LArMiniFCAL_ID::Could not open file " <<
file << std::endl;
693 bool isComment =
true;
695 int isamp,idepth, iphi,ieta;
700 fin.getline(aLine,
sizeof(aLine)-1);
701 sLine = std::string(aLine);
702 }
while (sLine.empty() && !
fin.eof());
703 isComment = ( sLine.find(
'#') != std::string::npos );
706 while ( sLine.empty() && !
fin.eof()) {
707 fin.getline(aLine,
sizeof(aLine)-1);
708 sLine = std::string(aLine);
710 std::istringstream es( sLine.c_str() );
712 if ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
715 while ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
716 if (!
ic.is_valid())
continue;
723 }
while (!
fin.eof()) ;
737 std::cout <<
"LArMiniFCAL_ID::init_neighbors " << std::endl;
741 std::string f2d,f3dnext,f3dprev;
746 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
748 log << MSG::ERROR <<
"init_neighbours: cannot find neighbours files: "
749 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
753 std::cout <<
"LArMiniFCAL_ID::init_neighbours cannot find neighbours files: "
754 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
757 throw std::runtime_error(
"LArMiniFCAL_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
IdDictRegion * find_region(const std::string ®ion_name) const
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
MultiRange build_multirange() const
Get MultiRange for full dictionary.
MultiRange m_full_module_range
@ depth
pointing depth of the shower as calculated in egammaqgcld
MultiRange m_full_channel_range
Scalar phi() const
phi method
int init_neighbors(const IdDictMgr &dict_mgr)
std::string show_to_string(void) const
size_type channel_hash_max() const
One more than the largest channel (cell) hash code.
Scalar eta() const
pseudorapidity method
int fill_vec_of_dict_regions(const std::string &group_name="")
Initialize the list of detector regions.
element_type get_minimum() const
Query the values.
int module(const Identifier id) const
module [0]
size_type end_index() const
IdDictFieldImplementation m_module_impl
IdContext region_context() const
Return the context for regions.
int depth(const Identifier id) const
depth [0,3]
IMessageSvc * m_msgSvc
pointer to the message service
const std::string & find_metadata(const std::string &name) const
Access to meta data, name/value pairs.
Identifier region_id(IdentifierHash hashId) const
Return the region Identifier for a given hash code (no checking).
element_type get_maximum() const
std::vector< size_t > vec
const std::string & name() const
Dictionary name.
int lar_field_value() const
IdDictFieldImplementation m_lar_impl
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
IdDictFieldImplementation m_depth_impl
IdDictField * find_field(const std::string &name) const
const HashGroup & regions() const
Return the HashGroup for regions.
virtual std::string dictionaryVersion(void) const override
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
const IdDictFieldImplementation & implementation(size_t i) const
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
int phi_min_init(const Identifier regId) const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
int phi(const Identifier id) const
phi [0,15]
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
IdDictFieldImplementation m_pn_impl
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
Base class to factor out code common among Calo ID helpers.
std::vector< std::set< IdentifierHash > > m_neighbors_3d_next_vec
bool m_quiet
If true, suppress DEBUG/INFO messages.
def dot(G, fn, nodesToHighlight=[])
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
IdContext module_context() const
context for modules – method kept for backward compatibility.
int init_neighbors_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
void module_id_checks(int pos_neg, int module) const
int get_label_value(const std::string &field, const std::string &label, int &value) const
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
size_type m_MiniFCAL_INDEX
virtual void setDictVersion(const IdDictMgr &dict_mgr, const std::string &name) override
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
def init(v_theApp, v_rootStream=None)
const HashGroup & channels() const
Return the HashGroup for channels (cells).
int init_neighbors_3d_next(const std::string &filename)
int match(const ExpandedIdentifier &id) const
Match an identifier.
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,...
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
IdDictFieldImplementation m_eta_impl
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
std::vector< std::set< IdentifierHash > > m_neighbors_3d_prev_vec
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
size_type m_fcal_region_index
IdDictFieldImplementation m_phi_impl
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
std::vector< short int > m_vecOfPhiMin
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
MultiRange m_full_depth_range
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
std::vector< std::set< IdentifierHash > > m_neighbors_2d_vec
ExpandedIdentifier lar_fcal_exp(void) const
int init_neighbors_3d_prev(const std::string &filename)
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
IdDictFieldImplementation m_fcal_impl
int init_neighbors_2d(const std::string &filename)
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
void channel_id_checks(int pos_neg, int module, int depth, int eta, int phi) const
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
int lar_fcal_field_value() const
Exception class for LAr Identifiers.
size_type hash_max() const
Return one more than the largest hash code.