|
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),
31 m_minifcal_region_index(0),
33 m_MiniFCAL_INDEX(999),
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();
148 log << MSG::WARNING <<
"neighbours not initialized !!! returning empty list" <<
endmsg;
151 std::cout <<
" neighbours not initialized !!! returning empty list " << std::endl;
159 log << MSG::WARNING <<
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
163 std::cout <<
" neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
173 neighbourList.insert(neighbourList.end(),
181 neighbourList.insert(neighbourList.end(),
189 neighbourList.insert(neighbourList.end(),
201 std::cout <<
" NO MiniFCAL neighbours (yet) in the context of " <<
dictionaryVersion() << std::endl;
218 std::string strg =
"initialize_from_dictionary";
223 log <<
MSG::DEBUG <<
"Request to reinitialize not satisfied - tags have not changed" <<
endmsg;
239 if (!
dict()->find_group(
"lar_mini_fcal")) {
240 strg =
" initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.";
248 strg =
" initialize_from_dict - cannot initialize MiniFCAL part of LArCalorimeter dictionary ";
253 std::cout << strg << std::endl;
262 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
263 std::stringstream strm ;
264 strm << atlasDict->
m_name ;
265 strg =
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
271 std::cout << strg << std::endl;
278 int larFcalField = -1;
279 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
280 std::stringstream strm ;
281 strm << atlasDict->
m_name ;
282 strg =
"Could not get value for label 'LArMiniFCAL' of field 'part' in dictionary "
288 std::cout << strg << std::endl;
301 std::string
str =
"lar_mini_fcal";
307 std::string strg0 =
"initialize_from_dict : " ;
318 std::cout << strg0 << std::endl;
319 std::cout << strg1 << std::endl;
320 std::cout << strg2 << std::endl;
321 std::cout << strg2a<< std::endl;
362 std::string errorMessage =
"LArMiniFCAL_ID::module_id() result is not OK: ID, range = "
378 std::string errorMessage =
"LArMiniFCAL_ID::channel_id() result is not OK: ID, range = "
393 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID = "
401 std::string errorMessage =
"LArMiniFCAL_ID::channel_id(modId) result is not OK: ID, range = "
432 std::string strg =
"initLevelsFromDict - dictionary NOT initialized ";
437 std::cout << strg << std::endl;
458 std::string strg =
"initLevelsFromDict - unable to find 'subdet' field ";
463 std::cout << strg << std::endl;
473 std::string strg =
"initLevelsFromDict - unable to find 'part' field ";
478 std::cout << strg << std::endl;
488 std::string strg =
"initLevelsFromDict - unable to find 'barrel-endcap' field ";
493 std::cout << strg << std::endl;
503 std::string strg =
"initLevelsFromDict - unable to find 'module' field ";
508 std::cout << strg << std::endl;
519 std::string strg =
"initLevelsFromDict - unable to find 'depth' field ";
524 std::cout << strg << std::endl;
535 std::string strg =
"initLevelsFromDict - unable to find 'eta' field ";
540 std::cout << strg << std::endl;
550 std::string strg =
"initLevelsFromDict - unable to find 'phi' field ";
555 std::cout << strg << std::endl;
576 std::stringstream strm ;
578 std::string strg =
"initLevelsFromDict - unable to find fcal region index: id, reg "
579 + (std::string)
id + strm.str();
584 std::cout << strg << std::endl;
620 std::cout <<
"decode index and bit fields for each level: " << std::endl;
660 std::cout <<
"LArMiniFCAL_ID::init_neighbors_from_file " << std::endl;
675 std::cout <<
"LArMiniFCAL_ID::Could not find input file " <<
filename << std::endl;
681 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
684 std::cout <<
"LArMiniFCAL_ID::Could not open file " <<
file << std::endl;
697 bool isComment =
true;
699 int isamp,idepth, iphi,ieta;
704 fin.getline(aLine,
sizeof(aLine)-1);
705 sLine = std::string(aLine);
706 }
while (sLine.empty() && !
fin.eof());
707 isComment = ( sLine.find(
'#') != std::string::npos );
710 while ( sLine.empty() && !
fin.eof()) {
711 fin.getline(aLine,
sizeof(aLine)-1);
712 sLine = std::string(aLine);
714 std::istringstream es( sLine.c_str() );
716 if ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
719 while ( es >> AorC >> isamp >>
dot >> idepth >>
dot >> iphi >>
dot >> ieta ) {
720 if (!
ic.is_valid())
continue;
727 }
while (!
fin.eof()) ;
741 std::cout <<
"LArMiniFCAL_ID::init_neighbors " << std::endl;
745 std::string f2d,f3dnext,f3dprev;
750 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
752 log << MSG::ERROR <<
"init_neighbours: cannot find neighbours files: "
753 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
757 std::cout <<
"LArMiniFCAL_ID::init_neighbours cannot find neighbours files: "
758 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
761 throw std::runtime_error(
"LArMiniFCAL_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
IdContext module_context(void) const
context for modules – method kept for backward compatibility.
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)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
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
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.
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]
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.
size_type m_minifcal_region_index
std::vector< IdDictRegion * > m_regions
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
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.
regions_type::const_iterator regions_const_it
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
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...
std::vector< IdDictFieldImplementation > m_implementation
int lar_fcal_field_value() const
Exception class for LAr Identifiers.
int initLevelsFromDict(void)
size_type hash_max() const
Return one more than the largest hash code.