|
ATLAS Offline Software
|
Go to the documentation of this file.
15 #define MAX_BUFFER_LEN 1024
20 m_slar (supercell ? 1 : 0)
47 if (
range.match(expId)) {
49 if (not eta_field.
empty()) {
73 if (
range.match(expId)) {
75 if (not eta_field.
empty()) {
94 if (
range.match(expId)) {
96 if (not phi_field.
empty()) {
120 if (
range.match(expId)) {
122 if (not phi_field.
empty()) {
145 std::string strg =
"initialize_from_dictionary";
171 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
172 std::stringstream strm ;
173 strm << atlasDict->
m_name ;
174 strg =
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
180 std::cout << strg << std::endl;
187 int larFcalField = -1;
188 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
189 std::stringstream strm ;
190 strm << atlasDict->
m_name ;
191 strg =
"Could not get value for label 'LArFCAL' of field 'part' in dictionary "
197 std::cout << strg << std::endl;
212 std::string strg0 =
" initialize_from_dict : " ;
221 std::cout << strg0 << std::endl;
222 std::cout << strg1 << std::endl;
223 std::cout << strg2 << std::endl;
259 std::string errorMessage =
"LArFCAL_Base_ID::module_id() result is not OK: ID, range = "
274 std::string errorMessage =
"LArFCAL_Base_ID::channel_id() result is not OK: ID, range = "
289 std::string errorMessage =
"LArFCAL_Base_ID::channel_id(modId) result is not OK: ID = "
297 std::string errorMessage =
"LArFCAL_Base_ID::channel_id(modId) result is not OK: ID, range = "
328 std::string strg =
"initLevelsFromDict - dictionary NOT initialized ";
333 std::cout << strg << std::endl;
352 std::stringstream strm ;
354 std::string strg =
"initLevelsFromDict - unable to find fcal region index: id, reg "
355 + (std::string)
id + strm.str();
360 std::cout << strg << std::endl;
370 std::string strg =
"initLevelsFromDict - unable to find 'subdet' field ";
375 std::cout << strg << std::endl;
385 std::string strg =
"initLevelsFromDict - unable to find 'part' field ";
390 std::cout << strg << std::endl;
400 std::string strg =
"initLevelsFromDict - unable to find 'barrel-endcap' field ";
405 std::cout << strg << std::endl;
415 std::string strg =
"initLevelsFromDict - unable to find 'module' field ";
421 std::cout << strg << std::endl;
432 std::string strg =
"initLevelsFromDict - unable to find 'eta' field ";
437 std::cout << strg << std::endl;
447 std::string strg =
"initLevelsFromDict - unable to find 'phi' field ";
452 std::cout << strg << std::endl;
463 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'is-slar-fcal' field "
467 std::cout <<
"LArFCAL_Base_ID::initLevelsFromDict - unable to find 'is-slar-fcal' field "
506 std::cout <<
"decode index and bit fields for each level: " << std::endl;
538 std::vector<IdentifierHash>& neighbourList)
const
542 neighbourList.clear();
547 log << MSG::WARNING <<
"neighbours not initialized !!! returning empty list" <<
endmsg;
550 std::cout <<
" neighbours not initialized !!! returning empty list " << std::endl;
558 log << MSG::WARNING <<
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
562 std::cout <<
" neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
572 neighbourList.insert(neighbourList.end(),
580 neighbourList.insert(neighbourList.end(),
588 neighbourList.insert(neighbourList.end(),
600 std::cout <<
" NO FCAL neighbours (yet) in the context of " <<
dictionaryVersion() << std::endl;
623 std::cout <<
"LarFCal_Base_ID::Could not find input file " <<
filename << std::endl;
629 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
632 std::cout <<
"LarFCal_Base_ID::Could not open file " <<
file << std::endl;
645 bool isComment =
true;
652 fin.getline(aLine,
sizeof(aLine)-1);
653 sLine = std::string(aLine);
654 }
while (sLine.empty() && !
fin.eof());
655 isComment = ( sLine.find(
'#') != std::string::npos );
658 unsigned int ic, inext;
660 while ( sLine.empty() && !
fin.eof()) {
661 fin.getline(aLine,
sizeof(aLine)-1);
662 sLine = std::string(aLine);
664 std::istringstream es( sLine.c_str() );
666 if ( es >> AorC >> isamp >>
dot >> iphi >>
dot >> ieta ) {
667 thisCell =
channel_id((AorC==
'A'||AorC==
'S'?2:-2),isamp,ieta,iphi);
669 while ( es >> AorC >> isamp >>
dot >> iphi >>
dot >> ieta ) {
670 nextCell =
channel_id((AorC==
'A'||AorC==
'S'?2:-2),isamp,ieta,iphi);
676 }
while (!
fin.eof()) ;
691 std::cout <<
"LarFCal_Base_ID::init_neighbours " << std::endl;
695 std::string f2d,f3dnext,f3dprev;
698 f2d =
"FCalSuperCells2DNeighborsNew-April2014.txt";
699 f3dnext =
"FCalSuperCells3DNeighborsNextNew-April2014.txt";
700 f3dprev =
"FCalSuperCells3DNeighborsPrevNew-April2014.txt";
707 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
709 log << MSG::ERROR <<
"init_neighbours: cannot find neighbours files: "
710 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
714 std::cout <<
"LarFCal_Base_ID::init_neighbours cannot find neighbours files: "
715 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
718 throw std::runtime_error(
"LArFCAL_Base_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
731 std::cout <<
"LarFCal_Base_ID::init_neighbours status: " <<
status << std::endl;
MultiRange build_multirange() const
Get MultiRange for full dictionary.
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
IdDictFieldImplementation m_fcal_impl
virtual int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
Scalar phi() const
phi method
std::vector< std::set< IdentifierHash > > m_neighbours_3d_next_vec
LArFCAL_Base_ID(const std::string &name, bool supercell)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
int init_neighbours_2d(const std::string &filename)
std::string show_to_string(void) const
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
size_type channel_hash_max() const
One more than the largest channel (cell) hash code.
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
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.
size_type end_index() const
IdContext region_context() const
Return the context for regions.
IdContext module_context(void) const
context for modules – method kept for backward compatibility.
int module(const Identifier id) const
module [1,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 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 eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
IdDictFieldImplementation m_eta_impl
int lar_field_value() const
int unpack(Identifier id) const
Identifier manipulation methods.
IdDictFieldImplementation m_lar_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
MultiRange m_full_channel_range
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
void module_id_checks(int pos_neg, int module) const
int phi(const Identifier id) const
phi [0,15]
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
void channel_id_checks(int pos_neg, int module, int eta, int phi) const
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
Base class to factor out code common among Calo ID helpers.
int init_neighbours_3d_prev(const std::string &filename)
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
std::vector< IdDictRegion * > m_regions
MultiRange m_full_module_range
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
bool m_quiet
If true, suppress DEBUG/INFO messages.
def dot(G, fn, nodesToHighlight=[])
size_type m_fcal_region_index
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
std::vector< std::set< IdentifierHash > > m_neighbours_3d_prev_vec
IdDictFieldImplementation m_phi_impl
int get_label_value(const std::string &field, const std::string &label, int &value) const
int init_neighbours_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
std::vector< short int > m_vecOfPhiMin
IdDictFieldImplementation m_pn_impl
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 match(const ExpandedIdentifier &id) const
Match an identifier.
int init_neighbours_3d_next(const std::string &filename)
IdDictFieldImplementation m_module_impl
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
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_neighbours_2d_vec
int phi_min_init(const Identifier regId) const
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
ExpandedIdentifier lar_fcal_exp(void) const
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
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
int init_neighbours(const IdDictMgr &dict_mgr)
Exception class for LAr Identifiers.
IdDictFieldImplementation m_slar_impl
int initLevelsFromDict(const std::string &group_name)
size_type hash_max() const
Return one more than the largest hash code.