Skip to content
Snippets Groups Projects
Commit 437d2ea2 authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'thread.MuonIdHelpers-20210524' into 'master'

MuonIdHelpers: Thread-safety fix.

See merge request atlas/athena!43809
parents 219b5413 2a731598
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef DETECTORDESCRIPTION_MUONIDHELPER_H
......@@ -83,7 +83,7 @@ class MuonIdHelper : public AtlasDetectorID
// Constructor
MuonIdHelper(std::string logName);
MuonIdHelper(const std::string& logName);
// Destructor
......@@ -331,7 +331,7 @@ class MuonIdHelper : public AtlasDetectorID
};
protected:
mutable std::unique_ptr<MsgStream> m_Log ATLAS_THREAD_SAFE;
std::string m_logName;
bool m_init;
};
......@@ -557,7 +557,6 @@ inline bool MuonIdHelper::isSmall(const int& stationNameIndex) const
// Access to name and technology maps
inline int MuonIdHelper::stationNameIndex(const std::string& name) const
{
// (*m_Log) << MSG::WARNING << "Bad habit: please avoid using string" << endmsg;
int index = -1;
std::vector< std::string >::const_iterator first = m_stationNameVector.begin();
std::vector< std::string >::const_iterator last = m_stationNameVector.end();
......@@ -575,7 +574,6 @@ inline int MuonIdHelper::stationNameIndex(const std::string& name) const
/*******************************************************************************/
inline int MuonIdHelper::technologyIndex(const std::string& name) const
{
// (*m_Log) << MSG::WARNING << "Bad habit: please avoid using string" << endmsg;
int index = -1;
std::vector< std::string >::const_iterator first = m_technologyNameVector.begin();
std::vector< std::string >::const_iterator last = m_technologyNameVector.end();
......
This diff is collapsed.
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonIdHelpers/MdtIdHelper.h"
......@@ -16,13 +16,19 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
{
int status = 0;
MsgStream log (m_msgSvc, m_logName);
// Check whether this helper should be reinitialized
if (!reinitialize(dict_mgr)) {
(*m_Log) << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
}
return (0);
}
else {
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG << "(Re)initialize" << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "(Re)initialize" << endmsg;
}
}
/// init base object
......@@ -36,9 +42,11 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if (!m_dict)
{
(*m_Log) << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
}
return 1;
}
......@@ -55,9 +63,11 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
}
else
{
(*m_Log) << MSG::ERROR
<< "initLevelsFromDict - unable to find 'multiLayer' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR
<< "initLevelsFromDict - unable to find 'multiLayer' field "
<< endmsg;
}
status = 1;
}
......@@ -68,8 +78,10 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
}
else
{
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'tubeLayer' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'tubeLayer' field "
<< endmsg;
}
status = 1;
}
......@@ -80,8 +92,10 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
}
else
{
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'tube' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'tube' field "
<< endmsg;
}
status = 1;
}
......@@ -90,7 +104,9 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
IdDictGroup* mdtGroup = m_dict->find_group ("mdt");
if (!mdtGroup)
{
(*m_Log) << MSG::ERROR << "Cannot find mdt group" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Cannot find mdt group" << endmsg;
}
}
else
{
......@@ -105,16 +121,18 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_lay_impl = region.m_implementation[m_TUBELAYER_INDEX];
m_tub_impl = region.m_implementation[m_CHANNEL_INDEX];
(*m_Log) << MSG::DEBUG << " MDT decode index and bit fields for each level: " << endmsg;
(*m_Log) << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " multilayer " << m_mla_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " layer " << m_lay_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " tube " << m_tub_impl.show_to_string() << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << " MDT decode index and bit fields for each level: " << endmsg;
log << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " multilayer " << m_mla_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " layer " << m_lay_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " tube " << m_tub_impl.show_to_string() << endmsg;
}
/**
* Build multirange for the valid set of identifiers
*/
......@@ -125,10 +143,12 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField))
{
(*m_Log) << MSG::ERROR
<< "Could not get value for label 'MuonSpectrometer' of field "
<< "'subdet' in dictionary " << atlasDict->m_name
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR
<< "Could not get value for label 'MuonSpectrometer' of field "
<< "'subdet' in dictionary " << atlasDict->m_name
<< endmsg;
}
return (1);
}
......@@ -140,13 +160,17 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
if (muon_range.size() > 0 )
{
(*m_Log) << MSG::INFO
<< "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO
<< "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
}
}
else
{
(*m_Log) << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "detector element" for all mdt regions
......@@ -157,12 +181,16 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "multiLayer");
if (muon_detectorElement_range.size() > 0 )
{
(*m_Log) << MSG::INFO << "MultiRange built successfully to detector element: "
<< "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to detector element: "
<< "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
}
}
else
{
(*m_Log) << MSG::ERROR << "Muon MDT detector element MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MDT detector element MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "tube" for all mdt regions
......@@ -174,12 +202,16 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
mdt_prefix, "tube");
if (muon_channel_range.size() > 0 )
{
(*m_Log) << MSG::INFO << "MultiRange built successfully to tube: "
<< "MultiRange size is " << muon_channel_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to tube: "
<< "MultiRange size is " << muon_channel_range.size() << endmsg;
}
}
else
{
(*m_Log) << MSG::ERROR << "Muon MDT channel MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MDT channel MultiRange is empty" << endmsg;
}
}
......@@ -203,9 +235,11 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if ( field.match( (ExpandedIdentifier::element_type) mdtField ) )
{
m_full_module_range.add(range);
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG
<< "module field size is " << (int) range.cardinality()
<< " field index = " << i << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG
<< "module field size is " << (int) range.cardinality()
<< " field index = " << i << endmsg;
}
}
}
}
......@@ -219,9 +253,11 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if ( field.match( (ExpandedIdentifier::element_type) mdtField ) )
{
m_full_detectorElement_range.add(range);
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG
<< "detector element field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG
<< "detector element field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
}
}
}
}
......@@ -235,9 +271,11 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if ( field.match( (ExpandedIdentifier::element_type) mdtField ) )
{
m_full_channel_range.add(range);
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG
<< "channel field size is " << (int) range.cardinality()
<< " field index = " << k << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG
<< "channel field size is " << (int) range.cardinality()
<< " field index = " << k << endmsg;
}
}
}
}
......@@ -246,7 +284,9 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if (m_full_module_range.size() == 0)
{
(*m_Log) << MSG::ERROR << "MDT MultiRange ID is empty for modules" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MDT MultiRange ID is empty for modules" << endmsg;
}
status = 1;
}
......@@ -254,7 +294,9 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if (m_full_detectorElement_range.size() == 0)
{
(*m_Log) << MSG::ERROR << "MDT MultiRange ID is empty for detector elements" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MDT MultiRange ID is empty for detector elements" << endmsg;
}
status = 1;
}
......@@ -262,20 +304,26 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if (m_full_channel_range.size() == 0)
{
(*m_Log) << MSG::ERROR << "MDT MultiRange ID is empty for channels" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MDT MultiRange ID is empty for channels" << endmsg;
}
status = 1;
}
// Setup the hash tables for MDT
(*m_Log) << MSG::INFO << "Initializing MDT hash indices ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing MDT hash indices ... " << endmsg;
}
status = init_hashes();
status = init_detectorElement_hashes();
status = init_id_to_hashes();
// Setup hash tables for finding neighbors
(*m_Log) << MSG::INFO << "Initializing MDT hash indices for finding neighbors ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing MDT hash indices for finding neighbors ... " << endmsg;
}
status = init_neighbors();
// retrieve the maximum number of tubes in any chamber
......@@ -297,10 +345,14 @@ int MdtIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
}
}
if (m_tubesMax == UINT_MAX) {
(*m_Log) << MSG::ERROR << "No maximum number of MDT tubes was retrieved" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "No maximum number of MDT tubes was retrieved" << endmsg;
}
status = 1;
} else {
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG << " Maximum number of MDT tubes is " << m_tubesMax << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << " Maximum number of MDT tubes is " << m_tubesMax << endmsg;
}
}
m_init = true;
return (status);
......@@ -697,11 +749,14 @@ bool MdtIdHelper::valid(const Identifier& id) const
if ((mlayer < multilayerMin(id)) ||
(mlayer > multilayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid multilayer=" << mlayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid multilayer=" << mlayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
}
return false;
}
......@@ -709,11 +764,14 @@ bool MdtIdHelper::valid(const Identifier& id) const
if ((layer < tubeLayerMin(id)) ||
(layer > tubeLayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid tubeLayer=" << layer
<< " tubeLayerMin=" << tubeLayerMin(id)
<< " tubeLayerMax=" << tubeLayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid tubeLayer=" << layer
<< " tubeLayerMin=" << tubeLayerMin(id)
<< " tubeLayerMax=" << tubeLayerMax(id)
<< endmsg;
}
return false;
}
......@@ -721,11 +779,14 @@ bool MdtIdHelper::valid(const Identifier& id) const
if ((tb < tubeMin(id)) ||
(tb > tubeMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid tube=" << tb
<< " tubeMin=" << tubeMin(id)
<< " tubeMax=" << tubeMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid tube=" << tb
<< " tubeMin=" << tubeMin(id)
<< " tubeMax=" << tubeMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -739,9 +800,12 @@ bool MdtIdHelper::validElement(const Identifier& id) const
if (('B' != name[0]) && ('E' != name[0]))
{
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
......@@ -749,12 +813,15 @@ bool MdtIdHelper::validElement(const Identifier& id) const
if (eta < stationEtaMin(id) ||
eta > stationEtaMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
......@@ -762,12 +829,15 @@ bool MdtIdHelper::validElement(const Identifier& id) const
if ((phi < stationPhiMin(id)) ||
(phi > stationPhiMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -782,31 +852,40 @@ bool MdtIdHelper::validElement(const Identifier& id, int stationName,
if (('B' != name[0]) && ('E' != name[0]))
{
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
if (stationEta < stationEtaMin(id) ||
stationEta > stationEtaMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
if ((stationPhi < stationPhiMin(id)) ||
(stationPhi > stationPhiMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -821,31 +900,40 @@ bool MdtIdHelper::validChannel(const Identifier& id, int stationName,
if ((multilayer < multilayerMin(id)) ||
(multilayer > multilayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid multilayer=" << multilayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid multilayer=" << multilayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
}
return false;
}
if ((tubeLayer < tubeLayerMin(id)) ||
(tubeLayer > tubeLayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid tubeLayer=" << tubeLayer
<< " tubeLayerMin=" << tubeLayerMin(id)
<< " tubeLayerMax=" << tubeLayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid tubeLayer=" << tubeLayer
<< " tubeLayerMin=" << tubeLayerMin(id)
<< " tubeLayerMax=" << tubeLayerMax(id)
<< endmsg;
}
return false;
}
if ((tube < tubeMin(id)) ||
(tube > tubeMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid tube=" << tube
<< " tubeMin=" << tubeMin(id)
<< " tubeMax=" << tubeMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid tube=" << tube
<< " tubeMin=" << tubeMin(id)
<< " tubeMax=" << tubeMax(id)
<< endmsg;
}
return false;
}
return true;
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonIdHelpers/MmIdHelper.h"
......@@ -16,12 +16,18 @@ MmIdHelper::MmIdHelper() : MuonIdHelper("MmIdHelper"),
int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
int status = 0;
MsgStream log (m_msgSvc, m_logName);
// Check whether this helper should be reinitialized
if (!reinitialize(dict_mgr)) {
(*m_Log) << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
}
return (0);
} else {
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG << "(Re)initialize " << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "(Re)initialize " << endmsg;
}
}
// init base object
......@@ -33,9 +39,11 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
m_dict = dict_mgr.find_dictionary ("MuonSpectrometer");
if(!m_dict) {
(*m_Log) << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
}
return 1;
}
......@@ -44,7 +52,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
int index = technologyIndex("MM");
if (index == -1) {
(*m_Log) << MSG::DEBUG << "initLevelsFromDict - there are no MM entries in the dictionary! " << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "initLevelsFromDict - there are no MM entries in the dictionary! " << endmsg;
}
return 0;
}
......@@ -52,7 +62,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
if (field) {
m_DETECTORELEMENT_INDEX = field->m_index;
} else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'mmMultilayer' field " << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'mmMultilayer' field " << endmsg;
}
status = 1;
}
......@@ -60,7 +72,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
if (field) {
m_GASGAP_INDEX = field->m_index;
} else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'mmGasGap' field " << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'mmGasGap' field " << endmsg;
}
status = 1;
}
......@@ -68,7 +82,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
if (field) {
m_CHANNEL_INDEX = field->m_index;
} else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find mmChannel' field " << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find mmChannel' field " << endmsg;
}
status = 1;
}
......@@ -78,7 +94,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
// save an index to the first region of MM
IdDictGroup* mmGroup = m_dict->find_group ("mm");
if(!mmGroup) {
(*m_Log) << MSG::ERROR << "Cannot find mm group" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Cannot find mm group" << endmsg;
}
} else {
m_GROUP_INDEX = mmGroup->regions()[0]->m_index;
}
......@@ -91,15 +109,17 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
m_gap_impl = region.m_implementation[m_GASGAP_INDEX];
m_cha_impl = region.m_implementation[m_CHANNEL_INDEX];
(*m_Log) << MSG::DEBUG << " MicroMegas decode index and bit fields for each level: " << endmsg;
(*m_Log) << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " multilayer " << m_mplet_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " gasgap " << m_gap_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " channel " << m_cha_impl.show_to_string() << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << " MicroMegas decode index and bit fields for each level: " << endmsg;
log << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " multilayer " << m_mplet_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " gasgap " << m_gap_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " channel " << m_cha_impl.show_to_string() << endmsg;
}
//
// Build multirange for the valid set of identifiers
......@@ -109,9 +129,11 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
int muonField = -1;
const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
(*m_Log) << MSG::ERROR << "Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary "
<< atlasDict->m_name
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary "
<< atlasDict->m_name
<< endmsg;
}
return (1);
}
......@@ -121,10 +143,14 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
Range prefix;
MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
if (muon_range.size() > 0 ) {
(*m_Log) << MSG::INFO << "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
}
} else {
(*m_Log) << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "detector element" for all mdt regions
......@@ -133,9 +159,13 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
Range detectorElement_prefix;
MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "mmMultilayer");
if (muon_detectorElement_range.size() > 0 ) {
(*m_Log) << MSG::INFO << "MultiRange built successfully to detector element: " << "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to detector element: " << "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
}
} else {
(*m_Log) << MSG::ERROR << "Muon MicroMegas detector element MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MicroMegas detector element MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "channel" for all MM regions
......@@ -144,9 +174,13 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
Range mm_prefix;
MultiRange muon_channel_range = m_dict->build_multirange(mm_region, mm_prefix, "mmChannel");
if (muon_channel_range.size() > 0 ) {
(*m_Log) << MSG::INFO << "MultiRange built successfully to channel: " << "MultiRange size is " << muon_channel_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to channel: " << "MultiRange size is " << muon_channel_range.size() << endmsg;
}
} else {
(*m_Log) << MSG::ERROR << "Muon MultiRange is empty for channels" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MultiRange is empty for channels" << endmsg;
}
}
// build MicroMegas module ranges
......@@ -160,7 +194,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
const Range::field& field = range[m_TECHNOLOGY_INDEX];
if ( field.match( (ExpandedIdentifier::element_type) mmField ) ) {
m_full_module_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG << "field size is " << (int) range.cardinality() << " field index = " << i << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "field size is " << (int) range.cardinality() << " field index = " << i << endmsg;
}
}
}
}
......@@ -171,7 +207,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
const Range::field& field = range[m_TECHNOLOGY_INDEX];
if ( field.match( (ExpandedIdentifier::element_type) mmField ) ) {
m_full_detectorElement_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG << "detector element field size is " << (int) range.cardinality() << " field index = " << j << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "detector element field size is " << (int) range.cardinality() << " field index = " << j << endmsg;
}
}
}
}
......@@ -182,31 +220,41 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
const Range::field& field = range[m_TECHNOLOGY_INDEX];
if ( field.match( (ExpandedIdentifier::element_type) mmField ) ) {
m_full_channel_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG << "channel field size is " << (int) range.cardinality() << " field index = " << j << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "channel field size is " << (int) range.cardinality() << " field index = " << j << endmsg;
}
}
}
}
// test to see that the multi range is not empty
if (m_full_module_range.size() == 0) {
(*m_Log) << MSG::ERROR << "MicroMegas MultiRange ID is empty for modules" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MicroMegas MultiRange ID is empty for modules" << endmsg;
}
status = 1;
}
// test to see that the detector element multi range is not empty
if (m_full_detectorElement_range.size() == 0) {
(*m_Log) << MSG::ERROR << "MicroMegas MultiRange ID is empty for detector elements" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MicroMegas MultiRange ID is empty for detector elements" << endmsg;
}
status = 1;
}
// test to see that the multi range is not empty
if (m_full_channel_range.size() == 0) {
(*m_Log) << MSG::ERROR << "MicroMegas MultiRange ID is empty for channels" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "MicroMegas MultiRange ID is empty for channels" << endmsg;
}
status = 1;
}
// Setup the hash tables for MicroMegas
(*m_Log) << MSG::INFO << "Initializing MicroMegas hash indices ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing MicroMegas hash indices ... " << endmsg;
}
status = init_hashes();
status = init_detectorElement_hashes(); // same as module hash
status = init_id_to_hashes();
......@@ -225,7 +273,9 @@ int MmIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr) {
*/
// Setup hash tables for finding neighbors
(*m_Log) << MSG::INFO << "Initializing MicroMegas hash indices for finding neighbors ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing MicroMegas hash indices for finding neighbors ... " << endmsg;
}
status = init_neighbors();
m_init = true;
......@@ -572,32 +622,41 @@ bool MmIdHelper::valid(const Identifier& id) const {
if ((mplet < multilayerMin(id)) ||
(mplet > multilayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid multilayer=" << mplet
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid multilayer=" << mplet
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
}
return false;
}
int gasG = gasGap(id);
if (gasG < gasGapMin(id) || gasG > gasGapMax(id)) {
(*m_Log) << MSG::WARNING
<< "Invalid gasGap=" << gasG
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid gasGap=" << gasG
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(id)
<< endmsg;
}
return false;
}
int element = channel(id);
if (element < channelMin(id) || element > channelMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid channel=" << element
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid channel=" << element
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -608,33 +667,42 @@ bool MmIdHelper::validElement(const Identifier& id) const {
std::string name = stationNameString(station);
if ('M' != name[0]) {
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
int eta = stationEta(id);
if (eta < stationEtaMin(id) || eta > stationEtaMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
int phi = stationPhi(id);
if (phi < stationPhiMin(id) || phi > stationPhiMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -646,29 +714,38 @@ bool MmIdHelper::validElement(const Identifier& id, int stationName, int station
std::string name = stationNameString(stationName);
if ('M' != name[0]) {
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
if (stationEta < stationEtaMin(id) || stationEta > stationEtaMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
if (stationPhi < stationPhiMin(id) || stationPhi > stationPhiMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -682,29 +759,38 @@ bool MmIdHelper::validChannel(const Identifier& id, int stationName, int station
if ((multilayer < multilayerMin(id)) ||
(multilayer > multilayerMax(id)) )
{
(*m_Log) << MSG::WARNING
<< "Invalid multilayer=" << multilayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid multilayer=" << multilayer
<< " multilayerMin=" << multilayerMin(id)
<< " multilayerMax=" << multilayerMax(id)
<< endmsg;
}
return false;
}
if (gasGap < gasGapMin(id) || gasGap > gasGapMax(id)) {
(*m_Log) << MSG::WARNING
<< "Invalid gasGap=" << gasGap
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid gasGap=" << gasGap
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(id)
<< endmsg;
}
return false;
}
if (channel < channelMin(id) || channel > channelMax(id) ) {
(*m_Log) << MSG::WARNING
<< "Invalid channel=" << channel
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid channel=" << channel
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
}
return false;
}
return true;
......
This diff is collapsed.
This diff is collapsed.
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonIdHelpers/TgcIdHelper.h"
......@@ -12,14 +12,20 @@ TgcIdHelper::TgcIdHelper() : MuonIdHelper("TgcIdHelper"), m_GASGAP_INDEX(0),
int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
{
int status = 0;
MsgStream log (m_msgSvc, m_logName);
// Check whether this helper should be reinitialized
if (!reinitialize(dict_mgr)) {
(*m_Log) << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
}
return (0);
}
else {
if (m_Log->level()<=MSG::DEBUG) (*m_Log) << MSG::DEBUG << "(Re)initialize" << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "(Re)initialize" << endmsg;
}
}
// init base object
......@@ -31,9 +37,11 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_dict = dict_mgr.find_dictionary ("MuonSpectrometer");
if(!m_dict) {
(*m_Log) << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR
<< " initialize_from_dict - cannot access MuonSpectrometer dictionary "
<< endmsg;
}
return 1;
}
......@@ -45,8 +53,10 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_GASGAP_INDEX = field->m_index;
}
else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'tgcGasGap' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'tgcGasGap' field "
<< endmsg;
}
status = 1;
}
......@@ -55,8 +65,10 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_ISSTRIP_INDEX = field->m_index;
}
else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find 'isStrip' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find 'isStrip' field "
<< endmsg;
}
status = 1;
}
......@@ -65,8 +77,10 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_CHANNEL_INDEX = field->m_index;
}
else {
(*m_Log) << MSG::ERROR << "initLevelsFromDict - unable to find channel' field "
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "initLevelsFromDict - unable to find channel' field "
<< endmsg;
}
status = 1;
}
......@@ -76,7 +90,9 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
// save an index to the first region of tgc
IdDictGroup* tgcGroup = m_dict->find_group ("tgc");
if(!tgcGroup) {
(*m_Log) << MSG::ERROR << "Cannot find tgc group" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Cannot find tgc group" << endmsg;
}
} else {
m_GROUP_INDEX = tgcGroup->regions()[0]->m_index;
}
......@@ -89,15 +105,17 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
m_ist_impl = region.m_implementation[m_ISSTRIP_INDEX];
m_cha_impl = region.m_implementation[m_CHANNEL_INDEX];
(*m_Log) << MSG::DEBUG << " TGC decode index and bit fields for each level: " << endmsg;
(*m_Log) << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " gas gap " << m_gap_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " is strip " << m_ist_impl.show_to_string() << endmsg;
(*m_Log) << MSG::DEBUG << " channel " << m_cha_impl.show_to_string() << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << " TGC decode index and bit fields for each level: " << endmsg;
log << MSG::DEBUG << " muon " << m_muon_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " station " << m_sta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " eta " << m_eta_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " phi " << m_phi_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " technology " << m_tec_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " gas gap " << m_gap_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " is strip " << m_ist_impl.show_to_string() << endmsg;
log << MSG::DEBUG << " channel " << m_cha_impl.show_to_string() << endmsg;
}
//
// Build multirange for the valid set of identifiers
......@@ -107,9 +125,11 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
int muonField = -1;
const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
(*m_Log) << MSG::ERROR << "Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary "
<< atlasDict->m_name
<< endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary "
<< atlasDict->m_name
<< endmsg;
}
return (1);
}
......@@ -119,10 +139,14 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
Range prefix;
MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
if (muon_range.size() > 0 ) {
(*m_Log) << MSG::INFO << "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to Technology: "
<< "MultiRange size is " << muon_range.size() << endmsg;
}
} else {
(*m_Log) << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "detector element" for all mdt regions
......@@ -133,12 +157,16 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "technology");
if (muon_detectorElement_range.size() > 0 )
{
(*m_Log) << MSG::INFO << "MultiRange built successfully to detector element: "
<< "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to detector element: "
<< "Multilayer MultiRange size is " << muon_detectorElement_range.size() << endmsg;
}
}
else
{
(*m_Log) << MSG::ERROR << "Muon TGC detector element MultiRange is empty" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon TGC detector element MultiRange is empty" << endmsg;
}
}
// Build MultiRange down to "channel" for all TGC regions
......@@ -147,10 +175,14 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
Range tgc_prefix;
MultiRange muon_channel_range = m_dict->build_multirange(tgc_region, tgc_prefix, "channel");
if (muon_channel_range.size() > 0 ) {
(*m_Log) << MSG::INFO << "MultiRange built successfully to channel: "
<< "MultiRange size is " << muon_channel_range.size() << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "MultiRange built successfully to channel: "
<< "MultiRange size is " << muon_channel_range.size() << endmsg;
}
} else {
(*m_Log) << MSG::ERROR << "Muon MultiRange is empty for channels" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "Muon MultiRange is empty for channels" << endmsg;
}
}
// build TGC module ranges
......@@ -164,8 +196,10 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
const Range::field& field = range[m_TECHNOLOGY_INDEX];
if ( field.match( (ExpandedIdentifier::element_type) tgcField ) ) {
m_full_module_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG << "field size is " << (int) range.cardinality()
<< " field index = " << i << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "field size is " << (int) range.cardinality()
<< " field index = " << i << endmsg;
}
}
}
}
......@@ -179,9 +213,11 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if ( field.match( (ExpandedIdentifier::element_type) tgcField ) )
{
m_full_detectorElement_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG
<< "detector element field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG
<< "detector element field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
}
}
}
}
......@@ -193,15 +229,19 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
const Range::field& field = range[m_TECHNOLOGY_INDEX];
if ( field.match( (ExpandedIdentifier::element_type) tgcField ) ) {
m_full_channel_range.add(range);
if (m_Log->level()<=MSG::DEBUG)(*m_Log) << MSG::DEBUG << "channel field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
if (m_msgSvc) {
log << MSG::DEBUG << "channel field size is " << (int) range.cardinality()
<< " field index = " << j << endmsg;
}
}
}
}
// test to see that the multi range is not empty
if (m_full_module_range.size() == 0) {
(*m_Log) << MSG::ERROR << "TGC MultiRange ID is empty for modules" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "TGC MultiRange ID is empty for modules" << endmsg;
}
status = 1;
}
......@@ -209,24 +249,32 @@ int TgcIdHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr)
if (m_full_detectorElement_range.size() == 0)
{
(*m_Log) << MSG::ERROR << "TGC MultiRange ID is empty for detector elements" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "TGC MultiRange ID is empty for detector elements" << endmsg;
}
status = 1;
}
// test to see that the multi range is not empty
if (m_full_channel_range.size() == 0) {
(*m_Log) << MSG::ERROR << "TGC MultiRange ID is empty for channels" << endmsg;
if (m_msgSvc) {
log << MSG::ERROR << "TGC MultiRange ID is empty for channels" << endmsg;
}
status = 1;
}
// Setup the hash tables for TGC
(*m_Log) << MSG::INFO << "Initializing TGC hash indices ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing TGC hash indices ... " << endmsg;
}
status = init_hashes();
status = init_detectorElement_hashes(); // same as module hash
status = init_id_to_hashes();
// Setup hash tables for finding neighbors
(*m_Log) << MSG::INFO << "Initializing TGC hash indices for finding neighbors ... " << endmsg;
if (m_msgSvc) {
log << MSG::INFO << "Initializing TGC hash indices for finding neighbors ... " << endmsg;
}
status = init_neighbors();
m_init = true;
......@@ -515,11 +563,14 @@ bool TgcIdHelper::valid(const Identifier& id) const {
if (gasG < gasGapMin() ||
gasG > gasGapMax(tripletChamber(station)))
{
(*m_Log) << MSG::WARNING
<< "Invalid gasGap=" << gasG
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(tripletChamber(station))
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid gasGap=" << gasG
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(tripletChamber(station))
<< endmsg;
}
return false;
}
......@@ -527,11 +578,14 @@ bool TgcIdHelper::valid(const Identifier& id) const {
if (isstrip < isStripMin(id) ||
isstrip > isStripMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid isStrip=" << isstrip
<< " isStripMin=" << isStripMin(id)
<< " isStripMax=" << isStripMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid isStrip=" << isstrip
<< " isStripMin=" << isStripMin(id)
<< " isStripMax=" << isStripMax(id)
<< endmsg;
}
return false;
}
......@@ -539,11 +593,14 @@ bool TgcIdHelper::valid(const Identifier& id) const {
if (element < channelMin(id) ||
element > channelMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid channel=" << element
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid channel=" << element
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -556,9 +613,12 @@ bool TgcIdHelper::validElement(const Identifier& id) const {
if ('T' != name[0])
{
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
......@@ -566,13 +626,16 @@ bool TgcIdHelper::validElement(const Identifier& id) const {
if (eta < stationEtaMin(id) ||
eta > stationEtaMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << eta
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
......@@ -580,13 +643,16 @@ bool TgcIdHelper::validElement(const Identifier& id) const {
if (phi < stationPhiMin(id) ||
phi > stationPhiMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << phi
<< " for stationName=" << name
<< " stationIndex=" << station
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -603,33 +669,42 @@ bool TgcIdHelper::validElement(const Identifier& id, int stationName,
if ('T' != name[0])
{
(*m_Log) << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationName=" << name
<< endmsg;
}
return false;
}
if (stationEta < stationEtaMin(id) ||
stationEta > stationEtaMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationEta=" << stationEta
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationEtaMin=" << stationEtaMin(id)
<< " stationEtaMax=" << stationEtaMax(id)
<< endmsg;
}
return false;
}
if (stationPhi < stationPhiMin(id) ||
stationPhi > stationPhiMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid stationPhi=" << stationPhi
<< " for stationName=" << name
<< " stationIndex=" << stationName
<< " stationPhiMin=" << stationPhiMin(id)
<< " stationPhiMax=" << stationPhiMax(id)
<< endmsg;
}
return false;
}
return true;
......@@ -646,31 +721,40 @@ bool TgcIdHelper::validChannel(const Identifier& id, int stationName,
if (gasGap < gasGapMin() ||
gasGap > gasGapMax(tripletChamber(stationName)))
{
(*m_Log) << MSG::WARNING
<< "Invalid gasGap=" << gasGap
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(tripletChamber(stationName))
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid gasGap=" << gasGap
<< " gasGapMin=" << gasGapMin(id)
<< " gasGapMax=" << gasGapMax(tripletChamber(stationName))
<< endmsg;
}
return false;
}
if (isStrip < isStripMin(id) ||
isStrip > isStripMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid isStrip=" << isStrip
<< " isStripMin=" << isStripMin(id)
<< " isStripMax=" << isStripMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid isStrip=" << isStrip
<< " isStripMin=" << isStripMin(id)
<< " isStripMax=" << isStripMax(id)
<< endmsg;
}
return false;
}
if (channel < channelMin(id) ||
channel > channelMax(id) )
{
(*m_Log) << MSG::WARNING
<< "Invalid channel=" << channel
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
if (m_msgSvc) {
MsgStream log (m_msgSvc, m_logName);
log << MSG::WARNING
<< "Invalid channel=" << channel
<< " channelMin=" << channelMin(id)
<< " channelMax=" << channelMax(id)
<< endmsg;
}
return false;
}
return true;
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment