 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "GaudiKernel/MsgStream.h"
29 m_is_initialized(false),
30 m_fcal_region_index(0),
32 m_MiniFCAL_INDEX(999),
51 if (
range.match(expId)) {
53 if (not eta_field.
empty()) {
77 if (
range.match(expId)) {
79 if (not eta_field.
empty()) {
98 if (
range.match(expId)) {
100 if (not phi_field.
empty()) {
124 if (
range.match(expId)) {
126 if (not phi_field.
empty()) {
141 neighbourList.clear();
146 log << MSG::WARNING <<
"neighbours not initialized !!! returning empty list" <<
endmsg;
149 std::cout <<
" neighbours not initialized !!! returning empty list " << std::endl;
157 log << MSG::WARNING <<
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
161 std::cout <<
" neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
171 neighbourList.insert(neighbourList.end(),
179 neighbourList.insert(neighbourList.end(),
187 neighbourList.insert(neighbourList.end(),
199 std::cout <<
" NO MiniFCAL neighbours (yet) in the context of " <<
dictionaryVersion() << std::endl;
216 std::string strg =
"initialize_from_dictionary";
221 log <<
MSG::DEBUG <<
"Request to reinitialize not satisfied - tags have not changed" <<
endmsg;
237 if (!
dict()->find_group(
"lar_mini_fcal")) {
238 strg =
" initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.";
246 strg =
" initialize_from_dict - cannot initialize MiniFCAL part of LArCalorimeter dictionary ";
251 std::cout << strg << std::endl;
260 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
261 std::stringstream strm ;
262 strm << atlasDict->
name();
263 strg =
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
269 std::cout << strg << std::endl;
276 int larFcalField = -1;
277 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
278 std::stringstream strm ;
279 strm << atlasDict->
name();
280 strg =
"Could not get value for label 'LArMiniFCAL' of field 'part' in dictionary "
286 std::cout << strg << std::endl;
299 std::string
str =
"lar_mini_fcal";
305 std::string strg0 =
"initialize_from_dict : " ;
316 std::cout << strg0 << std::endl;
317 std::cout << strg1 << std::endl;
318 std::cout << strg2 << std::endl;
319 std::cout << strg2a<< std::endl;
360 std::string errorMessage =
"LArMiniFCAL_ID::module_id() result is not OK: ID, range = "
376 std::string errorMessage =
"LArMiniFCAL_ID::channel_id() result is not OK: ID, range = "
391 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID = "
399 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID, range = "
430 std::string strg =
"initLevelsFromDict - dictionary NOT initialized ";
435 std::cout << strg << std::endl;
456 std::string strg =
"initLevelsFromDict - unable to find 'subdet' field ";
461 std::cout << strg << std::endl;
471 std::string strg =
"initLevelsFromDict - unable to find 'part' field ";
476 std::cout << strg << std::endl;
486 std::string strg =
"initLevelsFromDict - unable to find 'barrel-endcap' field ";
491 std::cout << strg << std::endl;
501 std::string strg =
"initLevelsFromDict - unable to find 'module' field ";
506 std::cout << strg << std::endl;
517 std::string strg =
"initLevelsFromDict - unable to find 'depth' field ";
522 std::cout << strg << std::endl;
533 std::string strg =
"initLevelsFromDict - unable to find 'eta' field ";
538 std::cout << strg << std::endl;
548 std::string strg =
"initLevelsFromDict - unable to find 'phi' field ";
553 std::cout << strg << std::endl;
574 std::stringstream strm ;
576 std::string strg =
"initLevelsFromDict - unable to find fcal region index: id, reg "
577 + (std::string)
id + strm.str();
582 std::cout << strg << std::endl;
612 std::cout <<
"decode index and bit fields for each level: " << std::endl;
652 std::cout <<
"LArMiniFCAL_ID::init_neighbors_from_file " << std::endl;
667 std::cout <<
"LArMiniFCAL_ID::Could not find input file " <<
filename << std::endl;
673 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
676 std::cout <<
"LArMiniFCAL_ID::Could not open file " <<
file << std::endl;
689 bool isComment =
true;
691 int isamp,idepth, iphi,ieta;
696 fin.getline(aLine,
sizeof(aLine)-1);
697 sLine = std::string(aLine);
698 }
while (sLine.empty() && !
fin.eof());
699 isComment = ( sLine.find(
'#') != std::string::npos );
702 while ( sLine.empty() && !
fin.eof()) {
703 fin.getline(aLine,
sizeof(aLine)-1);
704 sLine = std::string(aLine);
706 std::istringstream es( sLine.c_str() );
708 if ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
711 while ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
712 if (!
ic.is_valid())
continue;
719 }
while (!
fin.eof()) ;
733 std::cout <<
"LArMiniFCAL_ID::init_neighbors " << std::endl;
737 std::string f2d,f3dnext,f3dprev;
742 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
744 log << MSG::ERROR <<
"init_neighbours: cannot find neighbours files: "
745 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
749 std::cout <<
"LArMiniFCAL_ID::init_neighbours cannot find neighbours files: "
750 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
753 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.