 |
ATLAS Offline Software
|
Go to the documentation of this file.
15 #define MAX_BUFFER_LEN 1024
19 const std::string&
group,
22 m_slar (supercell ? 1 : 0)
40 if (
range.match(expId)) {
42 if (not eta_field.
empty()) {
66 if (
range.match(expId)) {
68 if (not eta_field.
empty()) {
87 if (
range.match(expId)) {
89 if (not phi_field.
empty()) {
113 if (
range.match(expId)) {
115 if (not phi_field.
empty()) {
138 std::string strg =
"initialize_from_dictionary";
164 if (atlasDict->
get_label_value(
"subdet",
"LArCalorimeter", larField)) {
165 std::stringstream strm ;
166 strm << atlasDict->
name();
167 strg =
"Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
173 std::cout << strg << std::endl;
180 int larFcalField = -1;
181 if (
dict()->get_label_value(
"part",
"LArFCAL", larFcalField)) {
182 std::stringstream strm ;
183 strm << atlasDict->
name();
184 strg =
"Could not get value for label 'LArFCAL' of field 'part' in dictionary "
190 std::cout << strg << std::endl;
205 std::string strg0 =
" initialize_from_dict : " ;
214 std::cout << strg0 << std::endl;
215 std::cout << strg1 << std::endl;
216 std::cout << strg2 << std::endl;
252 std::string errorMessage =
"LArFCAL_Base_ID::module_id() result is not OK: ID, range = "
267 std::string errorMessage =
"LArFCAL_Base_ID::channel_id() result is not OK: ID, range = "
282 std::string errorMessage =
"LArFCAL_Base_ID::channel_id(modId) result is not OK: ID = "
290 std::string errorMessage =
"LArFCAL_Base_ID::channel_id(modId) result is not OK: ID, range = "
321 std::string strg =
"initLevelsFromDict - dictionary NOT initialized ";
326 std::cout << strg << std::endl;
345 std::stringstream strm ;
347 std::string strg =
"initLevelsFromDict - unable to find fcal region index: id, reg "
348 + (std::string)
id + strm.str();
353 std::cout << strg << std::endl;
363 std::string strg =
"initLevelsFromDict - unable to find 'subdet' field ";
368 std::cout << strg << std::endl;
378 std::string strg =
"initLevelsFromDict - unable to find 'part' field ";
383 std::cout << strg << std::endl;
393 std::string strg =
"initLevelsFromDict - unable to find 'barrel-endcap' field ";
398 std::cout << strg << std::endl;
408 std::string strg =
"initLevelsFromDict - unable to find 'module' field ";
414 std::cout << strg << std::endl;
425 std::string strg =
"initLevelsFromDict - unable to find 'eta' field ";
430 std::cout << strg << std::endl;
440 std::string strg =
"initLevelsFromDict - unable to find 'phi' field ";
445 std::cout << strg << std::endl;
456 log << MSG::ERROR <<
"initLevelsFromDict - unable to find 'is-slar-fcal' field "
460 std::cout <<
"LArFCAL_Base_ID::initLevelsFromDict - unable to find 'is-slar-fcal' field "
499 std::cout <<
"decode index and bit fields for each level: " << std::endl;
531 std::vector<IdentifierHash>& neighbourList)
const
535 neighbourList.clear();
540 log << MSG::WARNING <<
"neighbours not initialized !!! returning empty list" <<
endmsg;
543 std::cout <<
" neighbours not initialized !!! returning empty list " << std::endl;
551 log << MSG::WARNING <<
"neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
555 std::cout <<
" neighbours requested for non-existing channel -- id/max " <<
id <<
"/"
565 neighbourList.insert(neighbourList.end(),
573 neighbourList.insert(neighbourList.end(),
581 neighbourList.insert(neighbourList.end(),
593 std::cout <<
" NO FCAL neighbours (yet) in the context of " <<
dictionaryVersion() << std::endl;
616 std::cout <<
"LarFCal_Base_ID::Could not find input file " <<
filename << std::endl;
622 log << MSG::ERROR <<
"Could not open file " <<
file <<
endmsg;
625 std::cout <<
"LarFCal_Base_ID::Could not open file " <<
file << std::endl;
638 bool isComment =
true;
645 fin.getline(aLine,
sizeof(aLine)-1);
646 sLine = std::string(aLine);
647 }
while (sLine.empty() && !
fin.eof());
648 isComment = ( sLine.find(
'#') != std::string::npos );
651 unsigned int ic, inext;
653 while ( sLine.empty() && !
fin.eof()) {
654 fin.getline(aLine,
sizeof(aLine)-1);
655 sLine = std::string(aLine);
657 std::istringstream es( sLine.c_str() );
659 if ( es >> AorC >> isamp >>
dot >> iphi >>
dot >> ieta ) {
660 thisCell =
channel_id((AorC==
'A'||AorC==
'S'?2:-2),isamp,ieta,iphi);
662 while ( es >> AorC >> isamp >>
dot >> iphi >>
dot >> ieta ) {
663 nextCell =
channel_id((AorC==
'A'||AorC==
'S'?2:-2),isamp,ieta,iphi);
669 }
while (!
fin.eof()) ;
684 std::cout <<
"LarFCal_Base_ID::init_neighbours " << std::endl;
688 std::string f2d,f3dnext,f3dprev;
691 f2d =
"FCalSuperCells2DNeighborsNew-April2014.txt";
692 f3dnext =
"FCalSuperCells3DNeighborsNextNew-April2014.txt";
693 f3dprev =
"FCalSuperCells3DNeighborsPrevNew-April2014.txt";
700 if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
702 log << MSG::ERROR <<
"init_neighbours: cannot find neighbours files: "
703 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
707 std::cout <<
"LarFCal_Base_ID::init_neighbours cannot find neighbours files: "
708 <<
" f2d: " << f2d <<
" f3dnext: " << f3dnext <<
" f3dprev: " << f3dprev
711 throw std::runtime_error(
"LArFCAL_Base_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
724 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
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
const IdDictRegion & region(size_t i) const
Region at index i.
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.
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,...
const std::string & name() const
Dictionary name.
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]
const IdDictFieldImplementation & implementation(size_t i) const
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
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
MultiRange m_full_module_range
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.
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
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
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...
int lar_fcal_field_value() const
int init_neighbours(const IdDictMgr &dict_mgr)
Exception class for LAr Identifiers.
IdDictFieldImplementation m_slar_impl
LArFCAL_Base_ID(const std::string &name, const std::string &group, bool supercell)
int initLevelsFromDict(const std::string &group_name)
size_type hash_max() const
Return one more than the largest hash code.