Skip to content
Snippets Groups Projects
Commit ea6b0525 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'muonCondMigration' into 'master'

MT Migration of Muon Condition Summary Services

See merge request atlas/athena!24880
parents 687c8a3b 3a01856c
No related branches found
No related tags found
No related merge requests found
Showing
with 2603 additions and 16 deletions
......@@ -18,6 +18,7 @@ atlas_depends_on_subdirs( PUBLIC
MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces
MuonSpectrometer/MuonCnv/MuonContainerManager
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData
MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry
MuonSpectrometer/MuonDigitContainer
MuonSpectrometer/MuonIdHelpers
......@@ -35,7 +36,7 @@ atlas_add_component( MuonRPC_CnvTools
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamData ByteStreamData_test GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib RPCcablingInterfaceLib MuonContainerManager MuonCondInterface MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonTrigCoinData TrkSurfaces TrigT1RPChardwareLib RPChardware )
LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamData ByteStreamData_test GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib RPCcablingInterfaceLib MuonContainerManager MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonTrigCoinData TrkSurfaces TrigT1RPChardwareLib RPChardware )
# Install files from the package:
atlas_install_headers( MuonRPC_CnvTools )
......
......@@ -62,7 +62,6 @@ Muon::RpcRdoToPrepDataTool::RpcRdoToPrepDataTool( const std::string& type, const
m_rpcCabling(nullptr),
//m_padHashIdHelper(0),
m_rpcRdoDecoderTool("Muon::RpcRDO_Decoder", this),
m_rSummarySvc("RPCCondSummarySvc", name),
m_fullEventDone(false)
{
declareInterface<Muon::IMuonRdoToPrepDataTool>(this);
......@@ -185,14 +184,10 @@ StatusCode Muon::RpcRdoToPrepDataTool::initialize() {
m_processingData = true;
}
if (m_RPCInfoFromDb){
StatusCode status = m_rSummarySvc.retrieve();
if (status != StatusCode::SUCCESS) {
ATH_MSG_WARNING ( "Could not retrieve RPC Info from Db" );
return StatusCode::FAILURE;
}
}
ATH_CHECK(m_readKey.initialize());
}
// check if initializing of DataHandle objects success
ATH_CHECK( m_rdoContainerKey.initialize() );
......@@ -1335,10 +1330,12 @@ StatusCode Muon::RpcRdoToPrepDataTool::processPad(const RpcPad *rdoColl,
//correct prd time from cool db
if (m_RPCInfoFromDb){
ATH_MSG_DEBUG( " Time correction from COOL " << " size of RPC_TimeMapforStrip " <<m_rSummarySvc->RPC_TimeMapforStrip().size() );
SG::ReadCondHandle<RpcCondDbData> readHandle{m_readKey};
const RpcCondDbData* readCdo{*readHandle};
ATH_MSG_DEBUG( " Time correction from COOL " << " size of RPC_TimeMapforStrip " <<readCdo->getStripTimeMap().size() );
std::vector<double> StripTimeFromCool;
if( m_rSummarySvc->RPC_TimeMapforStrip().find(channelId) != m_rSummarySvc->RPC_TimeMapforStrip().end()){
StripTimeFromCool = m_rSummarySvc->RPC_TimeMapforStrip ().find(channelId)->second ;
if( readCdo->getStripTimeMap().find(channelId) != readCdo->getStripTimeMap().end()){
StripTimeFromCool = readCdo->getStripTimeMap().find(channelId)->second ;
ATH_MSG_DEBUG(" Time "<< time << " Time correction from COOL for jstrip " <<StripTimeFromCool.at(0) );
time -= StripTimeFromCool.at(0) ;
}
......
......@@ -15,7 +15,7 @@
#include "MuonPrepRawData/MuonPrepDataContainer.h"
#include "MuonTrigCoinData/RpcCoinDataContainer.h"
#include "MuonCondInterface/IRPCConditionsSvc.h"
#include "MuonCondData/RpcCondDbData.h"
#include "MuonRDO/RpcCoinMatrix.h"
#include "MuonRDO/RpcPadContainer.h"
......@@ -39,7 +39,7 @@ class RpcPadIdHash;
class IdentifierHash;
class RpcPad;
class RpcPadContainer;
class RpcCondDbData;
namespace Muon {
......@@ -128,8 +128,8 @@ private:
// ServiceHandle<IROBDataProviderSvc> m_robDataProvider;
ToolHandle<Muon::IRPC_RDO_Decoder> m_rpcRdoDecoderTool;
ServiceHandle<IRPCConditionsSvc> m_rSummarySvc;
SG::ReadCondHandleKey<RpcCondDbData> m_readKey{this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"};
//keepTrackOfFullEventDecoding
bool m_fullEventDone;
......
################################################################################
# Package: MuonCondAlg
################################################################################
# Declare the package name:
atlas_subdir( MuonCondAlg )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Control/AthenaKernel
Control/StoreGate
Database/AthenaPOOL/AthenaPoolUtilities
DetectorDescription/Identifier
GaudiKernel
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc
MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTool
PRIVATE
Event/EventInfo
MuonSpectrometer/MuonIdHelpers )
# External dependencies:
find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
# Component(s) in the package:
atlas_add_library( MuonCondAlgLib
src/*.cxx
PUBLIC_HEADERS MuonCondAlg
INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvc MuonCondTool StoreGateLib SGtests MuonIdHelpersLib
PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo )
atlas_add_component( MuonCondAlg
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities Identifier GaudiKernel MuonCondData MuonCondInterface MuonCondSvc MuonCondTool EventInfo MuonIdHelpersLib MuonCondAlgLib )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUONCONDALG_CSCCONDDBALG_H
#define MUONCONDALG_CSCCONDDBALG_H
//STL includes
#include <string>
#include <sstream>
#include <vector>
#include <zlib.h>
//Gaudi includes
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/ToolHandle.h"
//Athena includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "Identifier/Identifier.h"
#include "Identifier/IdentifierHash.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "MuonIdHelpers/MuonIdHelperTool.h"
#include "MuonCondData/CscCondDbData.h"
#include "MuonCondSvc/MdtStringUtils.h"
//forward declarations
class Identifier;
class IdentifierHash;
class MuonIdHelper;
class StatusCode;
namespace Muon {
class MuonIdHelperTool;
}
class CscCondDbAlg: public AthAlgorithm{
public:
CscCondDbAlg( const std::string & name, ISvcLocator* svc);
virtual ~CscCondDbAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute () override;
private:
virtual StatusCode loadDataHv (EventIDRange &, std::unique_ptr<CscCondDbData>&);
virtual StatusCode loadDataStat (EventIDRange &, std::unique_ptr<CscCondDbData>&);
virtual StatusCode cacheVersion1(std::string , std::unique_ptr<CscCondDbData>&);
virtual StatusCode cacheVersion2(std::string , std::unique_ptr<CscCondDbData>&);
virtual StatusCode onlineToOfflineIds(const unsigned int &, Identifier &, Identifier &) const;
bool m_isOnline{false};
bool m_isData{false};
bool m_isRun1{false};
bool m_phiSwapVersion1Strings{false};
bool m_onlineOfflinePhiFlip{false};
ServiceHandle<ICondSvc> m_condSvc;
ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
std::string m_defaultDatabaseReadVersion;
SG::WriteCondHandleKey<CscCondDbData> m_writeKey{this, "WriteKey", "CscCondDbData", "Key of output CSC condition data"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_hv {this, "ReadKey_HV", "/CSC/DCS/LAYERSTATE", "Key of input CSC condition data HV"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_stat{this, "ReadKey_ST", "/CSC/STAT" , "Key of input CSC condition data stat"};
};
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUONCONDALG_MDTCONDDBALG_H
#define MUONCONDALG_MDTCONDDBALG_H
//STL includes
#include <string>
#include <vector>
#include <zlib.h>
//Gaudi includes
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/ToolHandle.h"
//Athena includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "Identifier/Identifier.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "MuonIdHelpers/MuonIdHelperTool.h"
#include "MuonCondInterface/IMDT_MapConversion.h"
#include "MuonCondData/MdtCondDbData.h"
#include "MuonCondSvc/MdtStringUtils.h"
//forward declarations
class Identifier;
class MuonIdHelper;
class StatusCode;
class IMDT_MapConversion;
namespace Muon {
class MuonIdHelperTool;
}
class MdtCondDbAlg: public AthAlgorithm{
public:
MdtCondDbAlg( const std::string & name, ISvcLocator* svc);
virtual ~MdtCondDbAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute () override;
private:
virtual StatusCode loadDataPsHv (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadDataPsLv (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadDataHv (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadDataLv (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadDataDroppedChambers(EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadMcDroppedChambers (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadMcDeadElements (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadMcDeadTubes (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
virtual StatusCode loadMcNoisyChannels (EventIDRange &, std::unique_ptr<MdtCondDbData>&);
bool m_isOnline{false};
bool m_isData{false};
bool m_isRun1{false};
bool m_checkOnSetPoint{false};
ServiceHandle<ICondSvc> m_condSvc;
ToolHandle<IMDT_MapConversion> m_condMapTool;
ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
SG::WriteCondHandleKey<MdtCondDbData> m_writeKey{this, "WriteKey", "MdtCondDbData", "Key of output MDT condition data"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_pshv {this, "ReadKey_DataR1_HV", "/MDT/DCS/PSHVMLSTATE" , "Key of input MDT condition data for Run 1 data HV"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_psv0 {this, "ReadKey_DataR1_V0", "/MDT/DCS/PSV0SETPOINTS" , "Key of input MDT condition data for Run 1 data V0"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_psv1 {this, "ReadKey_DataR1_V1", "/MDT/DCS/PSV1SETPOINTS" , "Key of input MDT condition data for Run 1 data V1"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_pslv {this, "ReadKey_DataR1_LV", "/MDT/DCS/PSLVCHSTATE" , "Key of input MDT condition data for Run 1 data LV"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_droppedChambers{this, "ReadKey_DataR1_DC", "/MDT/DCS/DROPPEDCH" , "Key of input MDT condition data for Run 1 data dropped chambers"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_hv {this, "ReadKey_DataR2_HV", "/MDT/DCS/HV" , "Key of input MDT condition data for Run 2 data HV"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_lv {this, "ReadKey_DataR2_LV", "/MDT/DCS/LV" , "Key of input MDT condition data for Run 2 data LV"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_droppedChambers{this, "ReadKey_MC_DC" , "/MDT/DCS/DROPPEDCH" , "Key of input MDT condition data for MC dropped chambers"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadElements {this, "ReadKey_MC_DE" , "/MDT/DQMF/DEAD_ELEMENT" , "Key of input MDT condition data for MC dead elements"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadTubes {this, "ReadKey_MC_DT" , "/MDT/TUBE_STATUS/DEAD_TUBE", "Key of input MDT condition data for MC dead tubes"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_noisyChannels {this, "ReadKey_MC_NC" , "/MDT/DCS/PSLVCHSTATE" , "Key of input MDT condition data for MC noisy channels"};
};
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUONCONDALG_RPCCONDDBALG_H
#define MUONCONDALG_RPCCONDDBALG_H
//STL includes
#include <string>
#include <sstream>
#include <vector>
#include <zlib.h>
//Gaudi includes
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/ToolHandle.h"
//Athena includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "Identifier/Identifier.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "MuonIdHelpers/MuonIdHelperTool.h"
#include "MuonCondData/RpcCondDbData.h"
#include "MuonCondSvc/MdtStringUtils.h"
//forward declarations
class Identifier;
class MuonIdHelper;
class StatusCode;
namespace Muon {
class MuonIdHelperTool;
}
class RpcCondDbAlg: public AthAlgorithm{
public:
RpcCondDbAlg( const std::string & name, ISvcLocator* svc);
virtual ~RpcCondDbAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute () override;
private:
virtual StatusCode loadDataDeadPanels (EventIDRange &, std::unique_ptr<RpcCondDbData>&);
virtual StatusCode loadDataOffPanels (EventIDRange &, std::unique_ptr<RpcCondDbData>&);
virtual StatusCode loadMcElementStatus(EventIDRange &, std::unique_ptr<RpcCondDbData>&);
bool m_isOnline{false};
bool m_isData{false};
bool m_isRun1{false};
ServiceHandle<ICondSvc> m_condSvc;
ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
SG::WriteCondHandleKey<RpcCondDbData> m_writeKey{this, "WriteKey", "RpcCondDbData", "Key of output RPC condition data"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_deadPanels {this, "ReadKey_DA_DP", "/RPC/DCS/DeadRopanels" , "Key of input RPC condition data for data dead panels"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_offPanels {this, "ReadKey_DA_OP", "/RPC/DCS/OffRopanels" , "Key of input RPC condition data for data off panels"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_mc_deadElements{this, "ReadKey_MC_DE", "/RPC/DQMF/ELEMENT_STATUS", "Key of input RPC condition data for MC dead elements"};
float m_panelEfficiency;
};
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUONCONDALG_TGCCONDDBALG_H
#define MUONCONDALG_TGCCONDDBALG_H
//STL includes
#include <string>
#include <vector>
#include <zlib.h>
//Gaudi includes
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/ToolHandle.h"
//Athena includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "Identifier/Identifier.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "MuonIdHelpers/MuonIdHelperTool.h"
#include "MuonCondData/TgcCondDbData.h"
#include "MuonCondSvc/MdtStringUtils.h"
//forward declarations
class Identifier;
class MuonIdHelper;
class StatusCode;
namespace Muon {
class MuonIdHelperTool;
}
class TgcCondDbAlg: public AthAlgorithm{
public:
TgcCondDbAlg( const std::string & name, ISvcLocator* svc);
virtual ~TgcCondDbAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute () override;
private:
virtual StatusCode loadDetectorStatus(EventIDRange &, std::unique_ptr<TgcCondDbData>&);
bool m_isOnline{false};
bool m_isData{false};
bool m_isRun1{false};
ServiceHandle<ICondSvc> m_condSvc;
ToolHandle<Muon::MuonIdHelperTool> m_idHelper;
SG::WriteCondHandleKey<TgcCondDbData> m_writeKey{this, "WriteKey", "TgcCondDbData", "Key of output TGC condition data"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_detectorStatus{this, "ReadKey", "/TGC/1/DetectorStatus", "Key of input TGC condition data"};
};
#endif
# Doxyfile 1.3.9.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = MuonCondAlg
PROJECT_NUMBER = MuonCondAlg-00-03-04
OUTPUT_DIRECTORY = /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondAlg
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src ../MuonCondAlg ../doc ../share
FILE_PATTERNS = *.cxx *.h *.py *.xml *.mk
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH = ../doc ../cmt ../share
EXAMPLE_PATTERNS = *.cxx *.html requirements *.py
EXAMPLE_RECURSIVE = YES
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = YES
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES = /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondInterface.tag
GENERATE_TAGFILE = /afs/cern.ch/atlas/maxidisk/d98/13.0.10/InstallArea/doc/MuonCondAlg.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = YES
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = gif
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/**
@page MuonCondAlg_page MuonCondAlg package
@author Constantin.Heidegger@cern.ch
@section MuonCondAlg_MuonCondAlgIntro Introduction
This package contains the algorithms
responsible to retrieve the
conditions information from the
COOL Database and provide it to the clients
*/
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg,RpcCondDbAlg,CscCondDbAlg,TgcCondDbAlg
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if not athenaCommonFlags.isOnline:
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"MdtCondDbAlg"):
condSequence += MdtCondDbAlg("MdtCondDbAlg")
if not hasattr(condSequence,"RpcCondDbAlg"):
condSequence += RpcCondDbAlg("RpcCondDbAlg")
## to be added later:
# if not hasattr(condSequence,"CscCondDbAlg"):
# condSequence += CscCondDbAlg("CscCondDbAlg")
## keep as template:
# if not hasattr(condSequence,"TgcCondDbAlg"):
# condSequence += TgcCondDbAlg("TgcCondDbAlg")
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonTopCondAlgConfigRUN2 import CscCondDbAlg
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if not athenaCommonFlags.isOnline:
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"CscCondDbAlg"):
condSequence += CscCondDbAlg("CscCondDbAlg")
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if not athenaCommonFlags.isOnline:
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"MdtCondDbAlg"):
condSequence += MdtCondDbAlg("MdtCondDbAlg")
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
## Configuration Access to OFFLINE DB (COMP200)
import copy
from IOVDbSvc.CondDB import conddb
from AthenaCommon import CfgMgr
from AthenaCommon.AppMgr import ToolSvc, ServiceMgr
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.Logging import logging
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
def addFolder(parent, db, folder):
log = logging.getLogger(parent.getName())
log.info("Adding folder %s:%s to IOVDbSvc", db, folder)
conddb.addFolder(db, folder, className='CondAttrListCollection');
class MdtCondDbAlg(CfgMgr.MdtCondDbAlg):
def __init__(self,name="MdtCondDbAlg",**kwargs):
if athenaCommonFlags.isOnline:
kwargs['isOnline'] = True # COOL folders not available online
else:
kwargs['isOnline'] = False # COOL folders not available online
if globalflags.DataSource != 'data':
kwargs['isData'] = False
if globalflags.DataSource == 'data':
kwargs['isData'] = True
kwargs['isRun1'] = False
super(MdtCondDbAlg,self).__init__(name,**kwargs)
if globalflags.DataSource == 'data':
addFolder(self, "DCS_OFL", "/MDT/DCS/HV")
addFolder(self, "DCS_OFL", "/MDT/DCS/LV")
else: # if MC or simulation
addFolder(self, "DCS_OFL", "/MDT/DCS/DROPPEDCH" )
addFolder(self, "DCS_OFL", "/MDT/DCS/PSLVCHSTATE")
class RpcCondDbAlg(CfgMgr.RpcCondDbAlg):
def __init__(self,name="RpcCondDbAlg",**kwargs):
if athenaCommonFlags.isOnline:
kwargs['isOnline'] = True # COOL folders not available online
else:
kwargs['isOnline'] = False # COOL folders not available online
if globalflags.DataSource != 'data':
kwargs['isData'] = False
if globalflags.DataSource == 'data':
kwargs['isData'] = True
kwargs['isRun1'] = False
super(RpcCondDbAlg,self).__init__(name,**kwargs)
if globalflags.DataSource == 'data':
addFolder(self, "DCS_OFL", "/RPC/DCS/DeadRopanels" )
addFolder(self, "DCS_OFL", "/RPC/DCS/OffRopanels" )
addFolder(self, "RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS")
else: # if MC or simulation
addFolder(self, "RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS")
class CscCondDbAlg(CfgMgr.CscCondDbAlg):
def __init__(self,name="CscCondDbAlg",**kwargs):
if athenaCommonFlags.isOnline:
kwargs['isOnline'] = True # COOL folders not available online
else:
kwargs['isOnline'] = False # COOL folders not available online
if globalflags.DataSource != 'data':
kwargs['isData'] = False
if globalflags.DataSource == 'data':
kwargs['isData'] = True
kwargs['isRun1'] = False
super(CscCondDbAlg,self).__init__(name,**kwargs)
addFolder(self, "CSC_OFL", "/CSC/STAT")
class TgcCondDbAlg(CfgMgr.TgcCondDbAlg):
def __init__(self,name="TgcCondDbAlg",**kwargs):
if athenaCommonFlags.isOnline:
kwargs['isOnline'] = True # COOL folders not available online
else:
kwargs['isOnline'] = False # COOL folders not available online
if globalflags.DataSource != 'data':
kwargs['isData'] = False
if globalflags.DataSource == 'data':
kwargs['isData'] = True
kwargs['isRun1'] = False
super(TgcCondDbAlg,self).__init__(name,**kwargs)
addFolder(self, "", "") # which folder?
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonTopCondAlgConfigRUN2 import RpcCondDbAlg
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if not athenaCommonFlags.isOnline:
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"RpcCondDbAlg"):
condSequence += RpcCondDbAlg("RpcCondDbAlg")
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonTopCondAlgConfigRUN2 import TgcCondDbAlg
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if not athenaCommonFlags.isOnline:
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"TgcCondDbAlg"):
condSequence += TgcCondDbAlg("TgcCondDbAlg")
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonCondAlg/CscCondDbAlg.h"
// constructor
CscCondDbAlg::CscCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
AthAlgorithm(name, pSvcLocator),
m_condSvc("CondSvc", name),
m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"),
m_defaultDatabaseReadVersion("02-00")
{
declareProperty("IdHelper" , m_idHelper );
declareProperty("defaultDatabaseReadVersion", m_defaultDatabaseReadVersion, "02-00");
declareProperty("phiSwapVersion1Strings" , m_phiSwapVersion1Strings = true );
declareProperty("onlineOfflinePhiFlip" , m_onlineOfflinePhiFlip = true );
declareProperty("isOnline" , m_isOnline );
declareProperty("isData" , m_isData );
declareProperty("isRun1" , m_isRun1 );
}
// Initialize
StatusCode
CscCondDbAlg::initialize(){
ATH_MSG_DEBUG( "initializing " << name() );
ATH_CHECK(m_condSvc .retrieve());
ATH_CHECK(m_idHelper.retrieve());
ATH_CHECK(m_writeKey.initialize());
ATH_CHECK(m_readKey_folder_da_hv .initialize());
ATH_CHECK(m_readKey_folder_da_stat.initialize());
if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
// execute
StatusCode
CscCondDbAlg::execute(){
ATH_MSG_DEBUG( "execute " << name() );
if(m_isOnline) {
ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );
return StatusCode::SUCCESS;
}
// launching Write Cond Handle
SG::WriteCondHandle<CscCondDbData> writeHandle{m_writeKey};
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< " In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
std::unique_ptr<CscCondDbData> writeCdo{std::make_unique<CscCondDbData>()};
EventIDRange rangeW;
StatusCode sc = StatusCode::SUCCESS;
// retrieving data
if(m_isData) {
//if(loadDataHv (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; // keep for future development
if(loadDataStat(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
}
else {
if(loadDataStat(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
}
if(sc.isFailure()){
ATH_MSG_WARNING("Could not read data from the DB");
return StatusCode::FAILURE;
}
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record CscCondDbData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
// loadDataHv
StatusCode
CscCondDbAlg::loadDataHv(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_hv};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
std::map<Identifier, int> layerMap;
int hv_state, lv_state, hv_setpoint0, hv_setpoint1;
unsigned int chan_index = 0;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
unsigned int chanNum = readCdo->chanNum (chan_index);
std::string csc_chan_name = readCdo->chanName(chanNum);
const coral::AttributeList& atr = itr->second;
if(atr.size()){
hv_state = *(static_cast<const int*>((atr["HVState" ]).addressOfData()));
lv_state = *(static_cast<const int*>((atr["LVState" ]).addressOfData()));
hv_setpoint0 = *(static_cast<const int*>((atr["HVSetpoint0"]).addressOfData()));
hv_setpoint1 = *(static_cast<const int*>((atr["HVSetpoint1"]).addressOfData()));
std::string delimiter = "_";
std::vector<std::string> tokens;
MuonCalib::MdtStringUtils::tokenize(csc_chan_name,tokens,delimiter);
if((hv_state!=1 or lv_state!=1 or hv_setpoint0 <1000 or hv_setpoint1 <1000) && tokens.size()!=0){
std::string layer = tokens[1];
std::string number_layer = tokens[1].substr(1,2);
int wirelayer = atoi(const_cast<char*>(number_layer.c_str()));
int eta=0;
std::string eta_side = tokens[0].substr(0,1);
if (eta_side == "A") eta = +1;
if (eta_side == "C") eta = -1;
std::string chamber_name;
std::string size_side = tokens[0].substr(1,1);
if (size_side == "L") chamber_name = "CSL";
if (size_side == "S") chamber_name = "CSS";
int phi=0;
std::string sector_side = tokens[0].substr(2,4);
if (sector_side == "01" || sector_side == "02") phi=1;
if (sector_side == "03" || sector_side == "04") phi=2;
if (sector_side == "05" || sector_side == "06") phi=3;
if (sector_side == "07" || sector_side == "08") phi=4;
if (sector_side == "09" || sector_side == "10") phi=5;
if (sector_side == "11" || sector_side == "12") phi=6;
if (sector_side == "13" || sector_side == "14") phi=7;
if (sector_side == "15" || sector_side == "16") phi=8;
Identifier ChamberId = m_idHelper->cscIdHelper().elementID(chamber_name, eta, phi);
Identifier WireLayerId = m_idHelper->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1);
std::string WireLayerstring = chamber_name+"_"+eta_side+"_"+sector_side+"_"+layer;
writeCdo->setDeadLayer(WireLayerstring, WireLayerId);
if(layerMap.count(ChamberId)==0) layerMap[ChamberId] = 0;
++layerMap[ChamberId];
if(layerMap[ChamberId]==3) writeCdo->setDeadStation(chamber_name, ChamberId);
}
}
chan_index++;
}
return StatusCode::SUCCESS;
}
// loadDataStat
StatusCode
CscCondDbAlg::loadDataStat(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_stat};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
const coral::AttributeList& atr = itr->second;
std::string data = atr["Data"].data<std::string>();
ATH_MSG_DEBUG("Data is: "<<data);
std::istringstream ss(data);
if(!ss.good()) {
ATH_MSG_WARNING("Failed forming stringstream during caching");
continue;
}
std::string version;
ss >> version;
if(version == "1" || atoi(version.c_str()) == 1){
if(!cacheVersion1(data, writeCdo).isSuccess()) {
ATH_MSG_ERROR("Failed caching from COOL string version 1");
return StatusCode::FAILURE;
}
}
else if(version == "02-00") {
if(!cacheVersion2(data, writeCdo).isSuccess()) {
ATH_MSG_ERROR("Failed caching from COOL string version 02-00");
return StatusCode::FAILURE;
}
}
else {
// Old version was treated as an actual number rather than string. It was always
// set to 1 or sometimes 1.00000, so we convert to integer here and check
ATH_MSG_WARNING("Don't recognize CSC COOL string version " << version << ". Will treat as default version " << m_defaultDatabaseReadVersion);
if(m_defaultDatabaseReadVersion == "1"){
if(!cacheVersion1(data, writeCdo).isSuccess()) {
ATH_MSG_ERROR("Failed caching from COOL string version 1");
return StatusCode::FAILURE;
}
}
else if(m_defaultDatabaseReadVersion == "02-00"){
if(!cacheVersion2(data, writeCdo).isSuccess()) {
ATH_MSG_ERROR("Failed caching from COOL string version 02-00");
return StatusCode::FAILURE;
}
}
}
}
return StatusCode::SUCCESS;
}
// cacheVersion1
StatusCode
CscCondDbAlg::cacheVersion1(std::string data, std::unique_ptr<CscCondDbData>& writeCdo){
// ATTENTION: careful, this is untested yet!
std::string valueStr;
std::istringstream ss(data);
bool started = false;
while(ss.good()) {
ss >> valueStr;
if(valueStr == "END") break;
if(valueStr == "<BEGIN_DATA>"){
started = true;
continue;
}
if(!started) continue;
ATH_MSG_DEBUG("current element " << valueStr);
int index = atoi(valueStr.c_str());
// swapping version 1 strings
if(m_phiSwapVersion1Strings){
Identifier chanId;
IdContext context = m_idHelper->cscIdHelper().channel_context();
m_idHelper->cscIdHelper().get_id((IdentifierHash)index, chanId, &context);
int stationEta = m_idHelper->cscIdHelper().stationEta (chanId); // +1 Wheel A -1 Wheel C
int measuresPhi = m_idHelper->cscIdHelper().measuresPhi(chanId); // 0 eta 1 phi
if(stationEta > 0 && measuresPhi ==1){
int stationName = m_idHelper->cscIdHelper().stationName (chanId); // CSL or CSS
int stationPhi = m_idHelper->cscIdHelper().stationPhi (chanId); // PhiSector from 1-8
int chamberLayer = m_idHelper->cscIdHelper().chamberLayer(chanId); // Either 1 or 2 (but always 2)
int wireLayer = m_idHelper->cscIdHelper().wireLayer (chanId); // layer in chamber 1-4
int strip = 49 - m_idHelper->cscIdHelper().strip (chanId);
Identifier newId = m_idHelper->cscIdHelper().channelID(stationName,stationEta,stationPhi,chamberLayer, wireLayer,measuresPhi,strip);
IdentifierHash hash ;
m_idHelper->cscIdHelper().get_channel_hash(newId, hash);
ATH_MSG_VERBOSE("Swapped phi strip "<< m_idHelper->cscIdHelper().show_to_string(chanId) <<
" (" << index << ") to " << m_idHelper->cscIdHelper().show_to_string(newId) <<
" (" << hash << ")");
index = hash;
}
else {
ATH_MSG_VERBOSE("Not swapping " << m_idHelper->cscIdHelper().show_to_string(chanId));
}
}
writeCdo->setDeadChannelHash((IdentifierHash) index);
}
return StatusCode::SUCCESS;
}
// cacheVersion2
StatusCode
CscCondDbAlg::cacheVersion2(std::string data, std::unique_ptr<CscCondDbData>& writeCdo) {
std::istringstream ss(data);
std::string valueStr;
unsigned int chanAddress = 0;
bool started = false;
while(ss.good()) {
ss >> valueStr;
if(valueStr == "<END_DATA>") break;
if(valueStr == "<BEGIN_DATA>"){
started = true;
continue;
}
if(!started) continue;
ATH_MSG_DEBUG("current element " << valueStr);
std::istringstream iss(valueStr);
// use new iss to translate the hex
if(chanAddress==0){
iss >> std::hex >> chanAddress;
continue;
}
// next element is the status bit
unsigned int token;
iss >> token;
ATH_MSG_DEBUG("channel address: " << chanAddress << " and token " << token);
//remaining categories need offline identifiers
Identifier chamberId;
Identifier channelId;
if(!onlineToOfflineIds(chanAddress, chamberId, channelId).isSuccess())
ATH_MSG_ERROR("Cannon get offline Ids from online Id" << std::hex << chanAddress << std::dec);
IdentifierHash chanHash;
m_idHelper->cscIdHelper().get_channel_hash(channelId, chanHash);
writeCdo->setChannelStatus(chanHash, token);
chanAddress = 0;
}
return StatusCode::SUCCESS;
}
// onlineToOfflineIds
StatusCode
CscCondDbAlg::onlineToOfflineIds(const unsigned int & onlineId, Identifier &elementId, Identifier &channelId) const {
int stationName = ((onlineId >> 16)&0x1) + 50;
int phi = ((onlineId >> 13)&0x7)+1;
int eta = ((((onlineId >> 12)&0x1) == 1) ? 1:-1);
int chamLay = ((onlineId>>11)&0x1) +1;
int wireLay = ((onlineId>>9)&0x3) +1;
int measuresPhi = ((onlineId >> 8)&0x1);
int strip;
//Online and offline phi ids are flipped on A wheel
if(m_onlineOfflinePhiFlip && measuresPhi && eta == 1){
strip = 48 - ((onlineId)&0xff) ; //equivalent: 49 -( onlineId&0xff +1)
}
else {
strip = ((onlineId)&0xff) +1;
}
elementId = m_idHelper->cscIdHelper().elementID(stationName,eta,phi);
channelId = m_idHelper->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip);
return StatusCode::SUCCESS;
}
/*
keep for future development:
// loadDataDeadChambers
StatusCode
CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){
ATH_CHECK(m_readKey_folder_da_chambers.initialize());
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_chambers};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
std::vector<std::string> goodChambers;
std::vector<std::string> deadChambers;
CondAttrListCollection::const_iterator itr;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
const coral::AttributeList& atr = itr->second;
std::string chamber_enabled = *(static_cast<const std::string*>((atr["enabledChambers"]).addressOfData()));
std::string delimiter = " ";
std::vector<std::string> tokens;
MuonCalib::MdtStringUtils::tokenize(chamber_enabled,tokens,delimiter);
for (unsigned int i=0; i<tokens.size(); i++) goodChambers.push_back(tokens[i]);
}
std::string chamber_all[] = {"A01","A02","A03","A04","A05","A06","A07","A08","A09","A10","A11","A12","A13","A14","A15","A16",
"C01","C02","C03","C04","C05","C06","C07","C08","C09","C10","C11","C12","C13","C14","C15","C16"};
std::vector<std::string> chamber_v(chamber_all,chamber_all+32);
sort(chamber_v.begin(), chamber_v.end());
for(unsigned int i=0; i<chamber_v.size(); ++i){
if(!binary_search(goodChambers.begin(), goodChambers.end(), chamber_v[i]))
deadChambers.push_back(chamber_v[i]);
}
for(unsigned int i=0; i<deadChambers.size(); ++i){
int eta = 0;
std::string eta_side = deadChambers[i].substr(0,1);
if(eta_side == "A") eta = +1;
if(eta_side == "C") eta = -1;
int phi = 0;
std::string sector_side = deadChambers[i].substr(2,4);
if(sector_side == "01" || sector_side == "02") phi=1;
if(sector_side == "03" || sector_side == "04") phi=2;
if(sector_side == "05" || sector_side == "06") phi=3;
if(sector_side == "07" || sector_side == "08") phi=4;
if(sector_side == "09" || sector_side == "10") phi=5;
if(sector_side == "11" || sector_side == "12") phi=6;
if(sector_side == "13" || sector_side == "14") phi=7;
if(sector_side == "15" || sector_side == "16") phi=8;
std::string chamber_name = "";
if(sector_side == "01" || sector_side == "03" ||sector_side == "05" ||sector_side == "07" || sector_side == "09" || sector_side == "11" || sector_side == "13" || sector_side == "15" ) chamber_name = "CSL";
if(sector_side == "02" || sector_side == "04" || sector_side == "06"|| sector_side == "08" || sector_side == "10"|| sector_side == "12"|| sector_side == "14"|| sector_side == "16") chamber_name = "CSS";
Identifier ChamberId = m_idHelper->cscIdHelper().elementID(chamber_name, eta, phi);
writeCdo->setDeadStation(deadChambers[i], ChamberId);
}
return StatusCode::SUCCESS;
}
*/
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonCondAlg/RpcCondDbAlg.h"
// constructor
RpcCondDbAlg::RpcCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
AthAlgorithm(name, pSvcLocator),
m_condSvc("CondSvc", name),
m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
{
declareProperty("IdHelper" , m_idHelper );
declareProperty("isOnline" , m_isOnline );
declareProperty("isData" , m_isData );
declareProperty("isRun1" , m_isRun1 );
declareProperty("PanelEfficiency" , m_panelEfficiency = 0.50);
}
// Initialize
StatusCode
RpcCondDbAlg::initialize(){
ATH_MSG_DEBUG( "initializing " << name() );
ATH_CHECK(m_condSvc .retrieve());
ATH_CHECK(m_idHelper.retrieve());
ATH_CHECK(m_writeKey.initialize());
ATH_CHECK(m_readKey_folder_da_deadPanels .initialize());
ATH_CHECK(m_readKey_folder_da_offPanels .initialize());
ATH_CHECK(m_readKey_folder_mc_deadElements.initialize());
if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
// execute
StatusCode
RpcCondDbAlg::execute(){
ATH_MSG_DEBUG( "execute " << name() );
if(m_isOnline) {
ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );
return StatusCode::SUCCESS;
}
// launching Write Cond Handle
SG::WriteCondHandle<RpcCondDbData> writeHandle{m_writeKey};
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< " In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
std::unique_ptr<RpcCondDbData> writeCdo{std::make_unique<RpcCondDbData>()};
EventIDRange rangeW;
StatusCode sc = StatusCode::SUCCESS;
// retrieving data
if(m_isData) {
if(loadDataDeadPanels (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
if(loadDataOffPanels (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
if(loadMcElementStatus(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
}
else {
if(loadMcElementStatus(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE;
}
if(sc.isFailure()){
ATH_MSG_WARNING("Could not read data from the DB");
return StatusCode::FAILURE;
}
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record RpcCondDbData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
// loadDataDeadPanels
StatusCode
RpcCondDbAlg::loadDataDeadPanels(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_deadPanels};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
unsigned int chan_index=0;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
unsigned int chanNum = readCdo->chanNum (chan_index);
std::string sector_name = readCdo->chanName(chanNum);
const coral::AttributeList& atr=itr->second;
std::string panel_dead;
std::string panel_reason;
if(atr.size()){
panel_dead = *(static_cast<const std::string*>((atr["RpcDeadROPanelIds" ]).addressOfData()));
panel_reason = *(static_cast<const std::string*>((atr["RpcDeadROPanelReasons"]).addressOfData()));
ATH_MSG_DEBUG("panel_dead " << panel_dead );
ATH_MSG_DEBUG("panel_reason " << panel_reason);
char * ch_tmp;
std::string delimiter = ",";
std::vector<std::string> info_panel;
MuonCalib::MdtStringUtils::tokenize(panel_dead,info_panel,delimiter);
Identifier PanelId;
for(unsigned int i=0; i<info_panel.size();i++){
ch_tmp = const_cast<char*>(info_panel[i].c_str());
PanelId = atoi(ch_tmp);
ATH_MSG_DEBUG("info_panel " << ch_tmp << " " << atoi(ch_tmp));
if(PanelId.get_compact()){
ATH_MSG_DEBUG("DEADPANEL " << m_idHelper->rpcIdHelper().show_to_string(PanelId));
Identifier atlasId = m_idHelper->rpcIdHelper().panelID(PanelId);
std::stringstream ss;
ss << "panel_" << sector_name << "_" << m_idHelper->rpcIdHelper().show_to_string(PanelId);
if(atlasId!=0) writeCdo->setDeadPanel(ss.str(), atlasId);
ATH_MSG_DEBUG("push-back");
}
}
}
chan_index++;
}
return StatusCode::SUCCESS;
}
// loadDataOffPanels
StatusCode
RpcCondDbAlg::loadDataOffPanels(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_offPanels};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
unsigned int chan_index=0;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
unsigned int chanNum = readCdo->chanNum (chan_index);
std::string sector_name = readCdo->chanName(chanNum);
const coral::AttributeList& atr=itr->second;
std::string panel_off;
std::string panel_reason;
if(atr.size()){
panel_off = *(static_cast<const std::string*>((atr["RpcOffROPanelIds" ]).addressOfData()));
panel_reason = *(static_cast<const std::string*>((atr["RpcOffROPanelReasons"]).addressOfData()));
ATH_MSG_DEBUG("panel_off " << panel_off );
ATH_MSG_DEBUG("panel_reason " << panel_reason);
char * ch_tmp;
std::string delimiter = ",";
std::vector<std::string> info_panel;
MuonCalib::MdtStringUtils::tokenize(panel_off,info_panel,delimiter);
Identifier PanelId;
for(unsigned int i=0; i<info_panel.size();i++){
ch_tmp = const_cast<char*>(info_panel[i].c_str());
PanelId = atoi(ch_tmp);
ATH_MSG_DEBUG("info_panel " << ch_tmp << " " << PanelId);
if(PanelId.get_compact()){
ATH_MSG_DEBUG("OFFPANEL " << m_idHelper->rpcIdHelper().show_to_string(PanelId));
Identifier atlasId = m_idHelper->rpcIdHelper().panelID(PanelId);
std::stringstream ss;
ss << "panel_" << sector_name << "_" << m_idHelper->rpcIdHelper().show_to_string(PanelId);
if(atlasId!=0) writeCdo->setOffPanel(ss.str(), atlasId);
ATH_MSG_DEBUG("push-back");
}
}
}
chan_index++;
}
return StatusCode::SUCCESS;
}
// loadMcElementStatus
StatusCode
RpcCondDbAlg::loadMcElementStatus(EventIDRange & rangeW, std::unique_ptr<RpcCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_deadElements};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
unsigned int chan_index=0;
unsigned int iFracDeadStrip=0;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
const coral::AttributeList& atr = itr->second;
CondAttrListCollection::ChanNum channum = itr->first;
Identifier chamberId;
chamberId = channum;
std::string eff_panel, striplist, eff;
eff_panel = *(static_cast<const std::string*>((atr["PanelRes" ]).addressOfData()));
striplist = *(static_cast<const std::string*>((atr["StripStatus"]).addressOfData()));
ATH_MSG_DEBUG("-----------------------------entry #" << chan_index);
ATH_MSG_DEBUG("channel ID = Panel ID " << channum << " as identif. = " << m_idHelper->rpcIdHelper().show_to_string(chamberId));
ATH_MSG_DEBUG("eff_panel load is " << eff_panel);
ATH_MSG_DEBUG("striplist load is " << striplist << " " << striplist.size());
// Efficiencies and Cluster Sizes
std::string delimiter = " ";
std::vector<std::string> info_panel;
std::vector<float> info_panel_test;
MuonCalib::MdtStringUtils::tokenize(eff_panel,info_panel,delimiter);
char * SDBversion = const_cast<char*>(info_panel[0].c_str());
int DBversion = atoi( SDBversion ) ;
char * SNStrip = const_cast<char*>(info_panel[2].c_str());
int npanelstrip = atoi( SNStrip ) ;
char * SProjectedTracks = const_cast<char*>(info_panel[1].c_str());
double ProjectedTracks = atof(SProjectedTracks);
writeCdo->setProjectedTrack(chamberId, ProjectedTracks);
char * SEfficiency = const_cast<char*>(info_panel[3].c_str());
double Efficiency = atof(SEfficiency);
writeCdo->setEfficiency(chamberId, Efficiency);
if(Efficiency <= m_panelEfficiency )
writeCdo->setLowEffPanel(chamberId);
char * SGapEfficiency = const_cast<char*>(info_panel[5].c_str());
double GapEfficiency = atof(SGapEfficiency);
writeCdo->setGapEfficiency(chamberId, GapEfficiency);
char * SMeanClusterSize = const_cast<char*>(info_panel[17].c_str());
double MeanClusterSize = atof(SMeanClusterSize);
writeCdo->setMeanClusterSize(chamberId, MeanClusterSize);
if( DBversion>2 ){
char * SFracClusterSize1_a = const_cast<char*>(info_panel[19].c_str());
char * SFracClusterSize1_b = const_cast<char*>(info_panel[20].c_str());
double FracClusterSize1 = atof(SFracClusterSize1_a)+atof(SFracClusterSize1_b)*10000;
writeCdo->setFracClusterSize1(chamberId, FracClusterSize1);
char * SFracClusterSize2_a = const_cast<char*>(info_panel[21].c_str());
char * SFracClusterSize2_b = const_cast<char*>(info_panel[22].c_str());
double FracClusterSize2 = atof(SFracClusterSize2_a)+atof(SFracClusterSize2_b)*10000;
writeCdo->setFracClusterSize2(chamberId, FracClusterSize2);
char * SFracClusterSize3_a = const_cast<char*>(info_panel[23].c_str());
char * SFracClusterSize3_b = const_cast<char*>(info_panel[24].c_str());
double FracClusterSize3 = atof(SFracClusterSize3_a)+atof(SFracClusterSize3_b)*10000;
writeCdo->setFracClusterSize3(chamberId, FracClusterSize3);
}
else {
if(info_panel.size()>20){
char * SFracClusterSize1 = const_cast<char*>(info_panel[19].c_str());
double FracClusterSize1 = atof(SFracClusterSize1);
writeCdo->setFracClusterSize1(chamberId, FracClusterSize1);
char * SFracClusterSize2 = const_cast<char*>(info_panel[20].c_str());
double FracClusterSize2 = atof(SFracClusterSize2);
writeCdo->setFracClusterSize2(chamberId, FracClusterSize2);
}
else {
writeCdo->setFracClusterSize1(chamberId, 0.6);
writeCdo->setFracClusterSize2(chamberId, 0.2);
ATH_MSG_DEBUG("Panel with incomplete info in the DB, size = " << info_panel.size() << " instead of required >20");
ATH_MSG_DEBUG("PanelId = " << channum << " = " << m_idHelper->rpcIdHelper().show_to_string(chamberId));
ATH_MSG_DEBUG("Cluster Size 1 and 2 fractions are set to 0.6 and 0.2 for this chamber.");
}
}
// strip status
// n chars = #strips (status between 0--9)
int countdeadstrip = 0;
int countdeadstripinfidarea = 0;
int countpanelstrip = 0;
// update for the timing and error on timing
// new info strip |status time error_on_time|
std::string delimiter_strip = "|";
std::vector<std::string> info_strip;
std::string strip_status_list = "";
std::vector<float> info_strip_test;
MuonCalib::MdtStringUtils::tokenize(striplist,info_strip,delimiter_strip);
char * ch_strip2;
if (info_strip.size()>1){
for(unsigned int i=0; i<info_strip.size(); ++i){
ch_strip2 = const_cast<char*>(info_strip[i].c_str());
std::string delimiter_strip2 = " ";
std::vector<std::string> info_strip2;
std::vector<float> info_strip_test2;
MuonCalib::MdtStringUtils::tokenize(ch_strip2,info_strip2,delimiter_strip2);
char * STime = const_cast<char*>(info_strip2[1].c_str());
double Time = atof(STime);
char * SSigmaTime = const_cast<char*>(info_strip2[2].c_str());
double SigmaTime = atof(SSigmaTime);
char* strip_status = const_cast<char*>(info_strip2[0].c_str());
strip_status_list = strip_status_list + strip_status ;
std::vector<double> Time_vect;
Time_vect.push_back(Time);
Time_vect.push_back(SigmaTime);
Identifier strip_id ;
CondAttrListCollection::ChanNum stripnum;
stripnum = channum + i*4;
strip_id = channum + i*4;
ATH_MSG_DEBUG("strip "<<strip_id<<" has time " << Time << " and " << SigmaTime);
writeCdo->setStripTime(strip_id, Time_vect);
ATH_MSG_VERBOSE("strip #"<<i+1<< " strip_id " << stripnum
<<" expanded "<<m_idHelper->rpcIdHelper().show_to_string(strip_id));
++countpanelstrip;
if(strip_status[0]=='0'){
writeCdo->setDeadStrip(strip_id);
++countdeadstrip;
if (i>1 && i<info_strip.size()-2){
// strip in the fiducial area for the efficiency measurement
++countdeadstripinfidarea;
}
}
}
}
else {
ATH_MSG_DEBUG("no timing info");
for(unsigned int i=0; i<striplist.size();i++){
std::string part_strip = striplist.substr(i,1);
strip_status_list = strip_status_list + part_strip ;
char * ch_panel = const_cast<char*>(part_strip.c_str());
Identifier strip_id ;
CondAttrListCollection::ChanNum stripnum;
stripnum = channum + i*4;
strip_id = channum + i*4;
ATH_MSG_VERBOSE("strip #"<<i+1<<" info_strip " << part_strip
<< " strip_id " << stripnum <<" expanded "
<<m_idHelper->rpcIdHelper().show_to_string(strip_id)<< " panel = " << ch_panel);
++countpanelstrip;
if(part_strip=="0"){
++countdeadstrip;
writeCdo->setDeadStrip(strip_id);
if (i>1 && i<striplist.size()-2){
// strip in the fiducial area for the efficiency measurement
++countdeadstripinfidarea;
}
}
}
}
if(countpanelstrip != npanelstrip)
ATH_MSG_WARNING("WARNING (no side effects for this, just a reminder for a proper fix of the DB content) no matching strip number!!! " << countpanelstrip << " != " <<npanelstrip << " Identifier: " << channum);
float FracDeadStripMap = 0 ;
if(countpanelstrip-4>0) FracDeadStripMap = float(countdeadstripinfidarea)/float(countpanelstrip-4);
// store in the suitabel maps
writeCdo->setDeadStripList(chamberId, strip_status_list);
writeCdo->setFracDeadStrip(chamberId, FracDeadStripMap );
++iFracDeadStrip;
std::stringstream ss;
ss << "Size of RPC_PanelFracDeadStripMap " << iFracDeadStrip << "; in panel ";
ss << channum << " FracDeadStri(in fid.area) " << FracDeadStripMap << " (incl. borders) ";
if(countpanelstrip==0) ss << "DIVISION BY ZERO IMPOSSIBLE";
else ss << float(countdeadstrip)/float(countpanelstrip);
ss << " nDeadStrips,InFidArea/nStrips " << countdeadstrip << ",";
ss << countdeadstripinfidarea << "/" << countpanelstrip;
ATH_MSG_DEBUG(ss.str());
ATH_MSG_DEBUG("Efficiency is " << Efficiency << " and fraction is " << FracDeadStripMap << " and thus " << Efficiency-(0.99-FracDeadStripMap));
if(Efficiency-(0.99-FracDeadStripMap)>0.) {
if(Efficiency<0.995 || FracDeadStripMap>0.01){
if(Efficiency>0.005 || FracDeadStripMap<0.99){
std::stringstream msg;
msg << "WARNING: Inconsistent panel eff.="<<Efficiency
<<" and 0.99-dead_frac="<<0.99-FracDeadStripMap
<<" nDeadStrips,InFidArea/nStrips "<<countdeadstrip<<","
<<countdeadstripinfidarea<<"/"<<countpanelstrip
<<" for panelId="<<m_idHelper->rpcIdHelper().show_to_string(chamberId);
if (Efficiency-(0.99-FracDeadStripMap)>0.2)
msg << " difference >0.2";
else if (Efficiency-(0.99-FracDeadStripMap)>0.1)
msg << " difference >0.1";
else if (Efficiency-(0.99-FracDeadStripMap)>0.05)
msg << " difference >0.05";
else if (Efficiency-(0.99-FracDeadStripMap)>0.025)
msg << " difference >0.025";
else if (Efficiency-(0.99-FracDeadStripMap)>0.01)
msg << " difference >0.01";
else
msg << " difference >0 but <=0.01";
ATH_MSG_DEBUG(msg.str());
}
}
}
}
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonCondAlg/TgcCondDbAlg.h"
/*
ATTENTION: This is the migrated thread-safe version of the original TGCCondSummarySvc;
at the time of writing (Summer 2019) it is not clear whether or not it will be actually
used; so this algorithm is merely a template!
*/
// constructor
TgcCondDbAlg::TgcCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
AthAlgorithm(name, pSvcLocator),
m_condSvc("CondSvc", name),
m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
{
declareProperty("IdHelper", m_idHelper);
declareProperty("isOnline", m_isOnline);
declareProperty("isData" , m_isData );
declareProperty("isRun1" , m_isRun1 );
}
// Initialize
StatusCode
TgcCondDbAlg::initialize(){
ATH_MSG_DEBUG( "initializing " << name() );
ATH_CHECK(m_condSvc .retrieve());
ATH_CHECK(m_idHelper.retrieve());
ATH_CHECK(m_writeKey.initialize());
ATH_CHECK(m_readKey_folder_detectorStatus.initialize());
if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
// execute
StatusCode
TgcCondDbAlg::execute(){
ATH_MSG_DEBUG( "execute " << name() );
if(m_isOnline) {
ATH_MSG_DEBUG( "IsOnline is set to True; nothing to do!" );
return StatusCode::SUCCESS;
}
// launching Write Cond Handle
SG::WriteCondHandle<TgcCondDbData> writeHandle{m_writeKey};
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< " In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
std::unique_ptr<TgcCondDbData> writeCdo{std::make_unique<TgcCondDbData>()};
EventIDRange rangeW;
StatusCode sc = StatusCode::SUCCESS;
// retrieving data
//if(loadDetectorStatus(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; // keep for future development
if(sc.isFailure()){
ATH_MSG_WARNING("Could not read data from the DB");
return StatusCode::FAILURE;
}
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record TgcCondDbData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
// loadDetectorStatus
StatusCode
TgcCondDbAlg::loadDetectorStatus(EventIDRange & rangeW, std::unique_ptr<TgcCondDbData>& writeCdo){
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_detectorStatus};
const CondAttrListCollection* readCdo{*readHandle};
if(readCdo==0){
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
if ( !readHandle.range(rangeW) ) {
ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_DEBUG("Range of input is " << rangeW);
CondAttrListCollection::const_iterator itr;
for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
const coral::AttributeList& atr=itr->second;
int detector_status;
detector_status=*(static_cast<const int*>((atr["detector_status"]).addressOfData()));
ATH_MSG_DEBUG("TGC detector status is " << detector_status);
if (detector_status!=0){
int channum=itr->first;
Identifier chamberId = m_idHelper->tgcIdHelper().elementID(Identifier(channum));
writeCdo->setDeadStation(chamberId);
}
}
return StatusCode::SUCCESS;
}
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