diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt index b37251a746e694b74bf4dae131f808eb4afea4d8..a4381ddf208e00c0b856138ad2ee549c507b3a11 100644 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/CMakeLists.txt @@ -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 ) diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx index 3fc28c7f0c36480511dbbc268a795f48dc0e5344..1225e737e3f50057822e24e8406b1cef458b8cdb 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.cxx @@ -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) ; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h index 927e24e5ef069d12939d8e8edb7e7137a92c3aa0..e902c7b956db0de7858619086aea0a8c04283cb2 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataTool.h @@ -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; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdf50ea29740957ed5792410bc501077b5fb19be --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################################################ +# 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 ) + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..396a48b3690b15ef8a4a458c9ce7a3279ce7bf75 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h @@ -0,0 +1,78 @@ +/* + 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 diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..d19cb65db988fbea743232b39c77a03077bbd574 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCondDbAlg.h @@ -0,0 +1,87 @@ +/* + 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 diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..f551f033ee4ae4c3e67581d2d3fdf4afa8ae29e6 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/RpcCondDbAlg.h @@ -0,0 +1,73 @@ +/* + 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 diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..f1cced28b856c2b9953c22ed67cd02e024bbbf6e --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcCondDbAlg.h @@ -0,0 +1,65 @@ +/* + 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 diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile new file mode 100644 index 0000000000000000000000000000000000000000..67072a6e5997564e64e1b3f883a9e464ec1df57e --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/Doxyfile @@ -0,0 +1,215 @@ +# 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 + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h new file mode 100644 index 0000000000000000000000000000000000000000..4eb28db8464a806aaf6d2d5ac857f445ab2f42ba --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/doc/packagedoc.h @@ -0,0 +1,17 @@ +/* + 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 + +*/ diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..1c83b529ba6d10f039eded698e202bd15a8aa2a8 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py @@ -0,0 +1,19 @@ +# 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") + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..199e22751a76b0e7d886742db488f64fa2584cd7 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py @@ -0,0 +1,11 @@ +# 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") + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..e733e14f00f708a89797ac2d0cd07cbb1c925b8c --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MdtCondDbAlgConfig.py @@ -0,0 +1,11 @@ +# 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") + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py new file mode 100644 index 0000000000000000000000000000000000000000..7cc2d3120c0664b3600793bcad34cb2dc1d329e2 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py @@ -0,0 +1,88 @@ +# 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? + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..8b375dadd2377d899ebf12ceccc0a886ed59b2ba --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/RpcCondDbAlgConfig.py @@ -0,0 +1,11 @@ +# 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") + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..5363624d6ef11abe9bcf7efdd44dbff70b5ca171 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/TgcCondDbAlgConfig.py @@ -0,0 +1,11 @@ +# 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") + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f04a4a69bb1f3ca46daa21c37c2f0445a9b87eaf --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx @@ -0,0 +1,474 @@ +/* + 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; +} +*/ + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c9460ae86cec133fef0dcbc645c3539dade6ce2d --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx @@ -0,0 +1,778 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondAlg/MdtCondDbAlg.h" + +// constructor +MdtCondDbAlg::MdtCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : + AthAlgorithm(name, pSvcLocator), + m_condSvc("CondSvc", name), + m_condMapTool("MDT_MapConversion"), + m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + { + + declareProperty("MDT_MapConversion", m_condMapTool); + declareProperty("IdHelper" , m_idHelper ); + + declareProperty("isOnline" , m_isOnline ); + declareProperty("isData" , m_isData ); + declareProperty("isRun1" , m_isRun1 ); + declareProperty("useRun1SetPoints" , m_checkOnSetPoint = false); +} + + +// Initialize +StatusCode +MdtCondDbAlg::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_pshv.initialize()); + ATH_CHECK(m_readKey_folder_da_psv0.initialize()); + ATH_CHECK(m_readKey_folder_da_psv1.initialize()); + ATH_CHECK(m_readKey_folder_da_pslv.initialize()); + ATH_CHECK(m_readKey_folder_da_hv .initialize()); + ATH_CHECK(m_readKey_folder_da_lv .initialize()); + ATH_CHECK(m_readKey_folder_da_droppedChambers.initialize()); + ATH_CHECK(m_readKey_folder_mc_droppedChambers.initialize()); + ATH_CHECK(m_readKey_folder_mc_deadElements .initialize()); + ATH_CHECK(m_readKey_folder_mc_deadTubes .initialize()); + ATH_CHECK(m_readKey_folder_mc_noisyChannels .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 +MdtCondDbAlg::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<MdtCondDbData> 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<MdtCondDbData> writeCdo{std::make_unique<MdtCondDbData>()}; + EventIDRange rangeW; + + StatusCode sc = StatusCode::SUCCESS; + + // retrieving data + if(m_isData && m_isRun1) { + if(loadDataPsHv (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + if(loadDataPsLv (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + if(loadDataDroppedChambers(rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + } + else if(m_isData && !m_isRun1) { + if(loadDataHv (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + if(loadDataLv (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + } + else { + if(loadMcDroppedChambers (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + if(loadMcNoisyChannels (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; + //if(loadMcDeadElements (rangeW, writeCdo).isFailure()) sc = StatusCode::FAILURE; // keep for future development + //if(loadMcDeadTubes (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 MdtCondDbData " << 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; +} + + +// loadDataPsHv +StatusCode +MdtCondDbAlg::loadDataPsHv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){ + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pshv}; + 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<Identifier> cachedDeadMultiLayersId_standby; + 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 hv_payload = readCdo->chanName(chanNum ); + std::string hv_name; + itr = readCdo->chanAttrListPair(chanNum); + const coral::AttributeList& atr = itr->second; + + if(atr.size()==1) { + hv_name = *(static_cast<const std::string*>((atr["fsm_currentState"]).addressOfData())); + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter); + + std::string thename; + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2); + + if(tokens[0]!="ON" && tokens[0]!="STANDBY" && tokens[0]!="UNKNOWN"){ + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + thename = chamber_name+"_multilayer"+tokens2[3]; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + cachedDeadMultiLayersId_standby.push_back(MultiLayerId); + } + if(tokens[0]=="STANDBY"){ + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + thename = chamber_name+"_multilayer"+tokens2[3]; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + cachedDeadMultiLayersId_standby.push_back(MultiLayerId); + } + } + chan_index++; + } + + + // moving on to SetPoints + if(!m_checkOnSetPoint) return StatusCode::SUCCESS; + + std::map<Identifier, float> chamberML_V1; + std::map<Identifier, float> chamberML_V0; + std::map<Identifier, std::string> mlname; + + // V0 handle + SG::ReadCondHandle<CondAttrListCollection> readHandle_v0{m_readKey_folder_da_psv0}; + const CondAttrListCollection* readCdo_v0{*readHandle_v0}; + if(readCdo_v0==0){ + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + + if ( !readHandle_v0.range(rangeW) ) { + ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle_v0.key()); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle_v0.fullKey() << " readCdo->size()= " << readCdo_v0->size()); + ATH_MSG_DEBUG("Range of input is " << rangeW); + + // V1 + SG::ReadCondHandle<CondAttrListCollection> readHandle_v1{m_readKey_folder_da_psv1}; + const CondAttrListCollection* readCdo_v1{*readHandle_v1}; + if(readCdo_v1==0){ + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + + if ( !readHandle_v1.range(rangeW) ) { + ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle_v1.key()); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle_v1.fullKey() << " readCdo->size()= " << readCdo_v1->size()); + ATH_MSG_DEBUG("Range of input is " << rangeW); + + // V0 iteration + CondAttrListCollection::const_iterator itr_v0; + unsigned int chan_index_v0=0; + for(itr_v0 = readCdo_v0->begin(); itr_v0 != readCdo_v0->end(); ++itr_v0) { + + unsigned int chanNum = readCdo_v0->chanNum (chan_index_v0); + std::string setPointsV0_payload = readCdo_v0->chanName(chanNum); + + float setPointsV0_name; + + itr_v0 = readCdo_v0->chanAttrListPair(chanNum); + const coral::AttributeList& atr_v0 = itr_v0->second; + + if(atr_v0.size()==1){ + setPointsV0_name = *(static_cast<const float*>((atr_v0["readBackSettings_v0"]).addressOfData())); + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(setPointsV0_payload, tokens2, delimiter2); + + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + std::string thename = chamber_name+"_"+tokens2[3]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + chamberML_V0[MultiLayerId] = setPointsV0_name; + mlname[MultiLayerId] = thename; + + } + chan_index_v0++; + } + + // V1 iteration + CondAttrListCollection::const_iterator itr_v1; + unsigned int chan_index_v1=0; + for(itr_v1 = readCdo_v1->begin(); itr_v1 != readCdo_v1->end(); ++itr_v1) { + + unsigned int chanNum = readCdo_v1->chanNum(chan_index_v1); + std::string setPointsV1_payload = readCdo_v1->chanName(chanNum); + float setPointsV1_name; + itr_v1 = readCdo_v1-> chanAttrListPair(chanNum); + const coral::AttributeList& atr_v1 = itr_v1->second; + + if(atr_v1.size()==1){ + setPointsV1_name = *(static_cast<const float*>((atr_v1["readBackSettings_v1"]).addressOfData())); + + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(setPointsV1_payload, tokens2, delimiter2); + + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + std::string thename = chamber_name+"_"+tokens2[3]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + chamberML_V1[MultiLayerId] = setPointsV1_name; + mlname[MultiLayerId] = thename; + + } + chan_index_v1++; + } + + // check for chamber standby the correct value of Setpoint V0 vs SetpointV1 + // for chamber StandBy --> V0==V1 to be on + for (unsigned int vect=0; vect<cachedDeadMultiLayersId_standby.size(); vect++){ + Identifier MultilayerId_ch = cachedDeadMultiLayersId_standby[vect]; + + if (chamberML_V1.find(MultilayerId_ch)->second == chamberML_V0.find(MultilayerId_ch)->second){ + ATH_MSG_DEBUG( "Chamber has correct Voltage V1 = "<< chamberML_V1.find(MultilayerId_ch)->second<<" V0= " << chamberML_V0.find(MultilayerId_ch)->second ); + } + else{ + ATH_MSG_DEBUG( "Chamber has wrong correct Voltage V1 = "<< chamberML_V1.find(MultilayerId_ch)->second<<" V0= " << chamberML_V0.find(MultilayerId_ch)->second); + ATH_MSG_DEBUG( "Has to be masked!!!"); + writeCdo->setDeadMultilayer(mlname[MultilayerId_ch], MultilayerId_ch); + } + } + + return StatusCode::SUCCESS; +} + + + +// loadDataPsLv +StatusCode +MdtCondDbAlg::loadDataPsLv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){ + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pslv}; + 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 hv_name; + std::string hv_payload = readCdo->chanName(chanNum); + + itr = readCdo-> chanAttrListPair(chanNum); + const coral::AttributeList& atr=itr->second; + + if(atr.size()){ + hv_name = *(static_cast<const std::string*>((atr["fsmCurrentState"]).addressOfData())); + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter); + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(hv_payload,tokens2,delimiter2); + + if(tokens[0]!="ON"){ + std::string chamber_name= tokens2[2]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadStation(chamber_name, ChamberId); + } + } + chan_index++; + } + + return StatusCode::SUCCESS; +} + + + +// loadDataHv +StatusCode +MdtCondDbAlg::loadDataHv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& 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; + unsigned int chan_index=0; + for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) { + + unsigned int chanNum = readCdo->chanNum(chan_index); + std::string hv_name_ml1, hv_name_ml2; + std::string hv_payload = readCdo->chanName(chanNum); + float hv_v0_ml1, hv_v0_ml2, hv_v1_ml1, hv_v1_ml2; + itr = readCdo->chanAttrListPair(chanNum); + const coral::AttributeList& atr = itr->second; + + if(atr.size()) { + hv_name_ml1 = *(static_cast<const std::string*>((atr["fsmCurrentState_ML1"]).addressOfData())); + hv_name_ml2 = *(static_cast<const std::string*>((atr["fsmCurrentState_ML2"]).addressOfData())); + hv_v0_ml1 = *(static_cast<const float*>((atr["v0set_ML1"]).addressOfData())); + hv_v1_ml1 = *(static_cast<const float*>((atr["v1set_ML1"]).addressOfData())); + hv_v0_ml2 = *(static_cast<const float*>((atr["v0set_ML2"]).addressOfData())); + hv_v1_ml2 = *(static_cast<const float*>((atr["v1set_ML2"]).addressOfData())); + + std::string thename; + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2); + + if(hv_name_ml1 !="ON" && hv_name_ml1 !="STANDBY" && hv_name_ml1 !="UNKNOWN"){ + int multilayer = 1; + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer, 1, 1); + thename = chamber_name+"_multilayer1"; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + + if(hv_name_ml1=="STANDBY" && hv_v0_ml1 != hv_v1_ml1){ + int multilayer = 1; + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1); + thename = chamber_name+"_multilayer1"; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + + if(hv_name_ml2 !="ON" && hv_name_ml2 !="STANDBY" && hv_name_ml2 !="UNKNOWN"){ + int multilayer = 2; + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1); + thename = chamber_name+"_multilayer2"; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + + if(hv_name_ml2=="STANDBY" && hv_v0_ml2 != hv_v1_ml2){ + int multilayer = 2; + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId, multilayer, 1, 1); + thename = chamber_name+"_multilayer2"; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + + if(hv_name_ml2 !="ON" && hv_name_ml2 !="STANDBY" && hv_name_ml2 !="UNKNOWN" && hv_name_ml1 !="ON" && hv_name_ml1 !="STANDBY" && hv_name_ml1 !="UNKNOWN" ){ + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadStation(chamber_name, ChamberId); + } + if(hv_name_ml2=="STANDBY" && hv_v0_ml2 != hv_v1_ml2 && hv_name_ml1=="STANDBY" && hv_v0_ml1 != hv_v1_ml1){ + std::string chamber_name = tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadStation(chamber_name, ChamberId); + } + } + chan_index++; + } + return StatusCode::SUCCESS; +} + + +// loadDataLv +StatusCode +MdtCondDbAlg::loadDataLv(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){ + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_lv}; + 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 hv_name; + std::string hv_payload = readCdo->chanName(chanNum); + + itr = readCdo->chanAttrListPair(chanNum); + const coral::AttributeList& atr = itr->second; + + if(atr.size()){ + hv_name = *(static_cast<const std::string*>((atr["fsmCurrentState_LV"]).addressOfData())); + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter); + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(hv_payload,tokens2,delimiter2); + + if(tokens[0]!="ON"){ + std::string chamber_name= tokens2[0]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadStation(chamber_name, ChamberId); + } + } + chan_index++; + } + + return StatusCode::SUCCESS; + +} + + + +//loadDataDroppedChambers +StatusCode +MdtCondDbAlg::loadDataDroppedChambers(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo){ + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_droppedChambers}; + 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 chamber_dropped; + chamber_dropped = *(static_cast<const std::string*>((atr["Chambers_disabled"]).addressOfData())); + + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(chamber_dropped,tokens,delimiter); + for (unsigned int i=0; i<tokens.size(); i++) { + if(tokens[i]!="0"){ + std::string chamber_name = tokens[i]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadStation(chamber_name, ChamberId); + } + } + } + return StatusCode::SUCCESS; +} + + + +// loadMcDroppedChambers +StatusCode +MdtCondDbAlg::loadMcDroppedChambers(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) { + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_droppedChambers}; + 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 chamber_name; + chamber_name = *(static_cast<const std::string*>((atr["Chambers_disabled"]).addressOfData())); + + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + writeCdo->setDeadChamber(ChamberId); + } + + return StatusCode::SUCCESS; +} + + + +// loadMcDeadElements +StatusCode +MdtCondDbAlg::loadMcDeadElements(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& 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; + for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) { + + const coral::AttributeList& atr = itr->second; + std::string chamber_name, list_mlayer, list_layer, list_tube; + + chamber_name = *(static_cast<const std::string*>((atr["Chambers_Name" ]).addressOfData())); + list_mlayer = *(static_cast<const std::string*>((atr["Dead_multilayer"]).addressOfData())); + list_layer = *(static_cast<const std::string*>((atr["Dead_layer" ]).addressOfData())); + list_tube = *(static_cast<const std::string*>((atr["Dead_tube" ]).addressOfData())); + + std::string thename; + std::string delimiter = " "; + std::vector<std::string> tokens; + std::vector<std::string> tokens_mlayer; + std::vector<std::string> tokens_layer; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + MuonCalib::MdtStringUtils::tokenize(list_tube , tokens , delimiter); + MuonCalib::MdtStringUtils::tokenize(list_mlayer, tokens_mlayer, delimiter); + MuonCalib::MdtStringUtils::tokenize(list_layer , tokens_layer , delimiter); + + for(unsigned int i=0; i<tokens.size(); i++){ + if(tokens[i]!="0"){ + int ml = atoi(const_cast<char*>((tokens[i].substr(0,1)).c_str())); + int layer = atoi(const_cast<char*>((tokens[i].substr(1,2)).c_str())); + int tube = atoi(const_cast<char*>((tokens[i].substr(2 )).c_str())); + Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, tube); + thename = chamber_name+"_"+tokens[i]; + writeCdo->setDeadTube (thename, ChannelId); + writeCdo->setDeadChamber(ChamberId); + } + } + + for(unsigned int i=0; i<tokens_mlayer.size(); i++){ + if(tokens_mlayer[i]!="0"){ + int ml = atoi(const_cast<char*>((tokens_mlayer[i].substr(0)).c_str())); + Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId,ml,1,1); + thename = chamber_name+"_"+tokens[i]; + writeCdo->setDeadMultilayer(thename, ChannelId); + writeCdo->setDeadChamber (ChamberId); + } + } + + for(unsigned int i=0; i<tokens_layer.size(); i++) { + if(tokens_layer[i]!="0"){ + int ml = atoi(const_cast<char*>((tokens_layer[i].substr(0,1)).c_str())); + int layer = atoi(const_cast<char*>((tokens_layer[i].substr(1 )).c_str())); + Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, 1); + thename = chamber_name+"_"+tokens[i]; + writeCdo->setDeadLayer (thename, ChannelId); + writeCdo->setDeadChamber(ChamberId); + } + } + } + + return StatusCode::SUCCESS; +} + + + +//loadMcDeadTubes +StatusCode +MdtCondDbAlg::loadMcDeadTubes(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) { + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_deadTubes}; + 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 chamber_name; + std::string dead_tube; + std::string tube_list; + dead_tube = *(static_cast<const std::string*>((atr["DeadTube_List"]).addressOfData())); + chamber_name = *(static_cast<const std::string*>((atr["Chamber_Name" ]).addressOfData())); + + std::string thename; + std::vector<std::string> tokens; + std::string delimiter = " "; + MuonCalib::MdtStringUtils::tokenize(dead_tube, tokens, delimiter); + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + + for (unsigned int i=0; i<tokens.size(); i++) { + int ml = atoi(const_cast<char*>((tokens[i].substr(0,1)).c_str())); + int layer = atoi(const_cast<char*>((tokens[i].substr(1,2)).c_str())); + int tube = atoi(const_cast<char*>((tokens[i].substr(2 )).c_str())); + thename = chamber_name+"_"+tokens[i]; + tube_list = tokens[i]+"."; + Identifier ChannelId = m_idHelper->mdtIdHelper().channelID(ChamberId, ml, layer, tube); + writeCdo->setDeadTube(thename, ChannelId); + } + writeCdo->setDeadChamber(ChamberId); + } + + return StatusCode::SUCCESS; +} + + + +// loadMcNoisyChannels +StatusCode +MdtCondDbAlg::loadMcNoisyChannels(EventIDRange & rangeW, std::unique_ptr<MdtCondDbData>& writeCdo) { + + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_mc_noisyChannels}; + 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 hv_payload = readCdo->chanName(chanNum ); + std::string hv_name; + itr = readCdo->chanAttrListPair(chanNum); + const coral::AttributeList& atr = itr->second; + + if(atr.size()==1) { + hv_name = *(static_cast<const std::string*>((atr["fsm_currentState"]).addressOfData())); + std::string delimiter = " "; + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(hv_name, tokens, delimiter); + + std::string thename; + std::string delimiter2 = "_"; + std::vector<std::string> tokens2; + MuonCalib::MdtStringUtils::tokenize(hv_payload, tokens2, delimiter2); + + if(tokens[0]!="ON" && tokens[0]!="STANDBY" && tokens[0]!="UNKNOWN"){ + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + thename = chamber_name+"_multilayer"+tokens2[3]; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + if(tokens[0]=="STANDBY"){ + int multilayer = atoi(const_cast<char*>(tokens2[3].c_str())); + std::string chamber_name = tokens2[2]; + Identifier ChamberId = m_condMapTool->ConvertToOffline(chamber_name); + Identifier MultiLayerId = m_idHelper->mdtIdHelper().channelID(ChamberId,multilayer,1,1); + thename = chamber_name+"_multilayer"+tokens2[3]; + writeCdo->setDeadMultilayer(thename, MultiLayerId); + writeCdo->setDeadChamber (ChamberId); + } + } + chan_index++; + } + return StatusCode::SUCCESS; +} + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fbda27b15f9418a3519d409bcf505656b97e7fdb --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx @@ -0,0 +1,478 @@ +/* + 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; +} + + + + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..085a03f26d871cff696fba5da75db8aa91618d8c --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcCondDbAlg.cxx @@ -0,0 +1,128 @@ +/* + 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; +} + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4ec9222009156e1b4c60fc10ad3f2b7955948636 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx @@ -0,0 +1,10 @@ +#include "MuonCondAlg/CscCondDbAlg.h" +#include "MuonCondAlg/MdtCondDbAlg.h" +#include "MuonCondAlg/RpcCondDbAlg.h" +#include "MuonCondAlg/TgcCondDbAlg.h" + + +DECLARE_COMPONENT( CscCondDbAlg ) +DECLARE_COMPONENT( MdtCondDbAlg ) +DECLARE_COMPONENT( RpcCondDbAlg ) +DECLARE_COMPONENT( TgcCondDbAlg ) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt index 04135df6716661b4b3b71bf73b353b34ef3c1be4..4b65031f274f6a9a41712151c49adb2ad2daa9c0 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/CMakeLists.txt @@ -7,15 +7,23 @@ atlas_subdir( MuonCondData ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps Control/AthenaKernel Control/AthContainers Control/StoreGate Database/AthenaPOOL/AthenaPoolUtilities - DetectorDescription/Identifier ) + DetectorDescription/Identifier + GaudiKernel + PRIVATE + Event/EventInfo + MuonSpectrometer/MuonIdHelpers ) + # Component(s) in the package: atlas_add_library( MuonCondData src/*.cxx PUBLIC_HEADERS MuonCondData - LINK_LIBRARIES AthContainers AthenaPoolUtilities Identifier StoreGateLib SGtests ) + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES AthenaBaseComps AthenaKernel AthContainers AthenaPoolUtilities Identifier GaudiKernel StoreGateLib SGtests MuonIdHelpersLib + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo ) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h new file mode 100644 index 0000000000000000000000000000000000000000..9346002d93d03b598dd009a5b0af1f3c4b81d5d8 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h @@ -0,0 +1,82 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONCONDDATA_CSCCONDDBDATA_H +#define MUONCONDDATA_CSCCONDDBDATA_H + +//STL includes +#include <string> +#include <vector> + +//Athena includes +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "AthenaKernel/CondCont.h" +#include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" +#include "AthenaKernel/BaseInfo.h" + + +//forward declarations +class Identifier; +class IdentifierHash; + + + +class CscCondDbData { + + friend class CscCondDbAlg; + +public: + + CscCondDbData(); + virtual ~CscCondDbData() = default; + + void setChannelStatus(IdentifierHash, int); + void setDeadChannelHash(IdentifierHash); + + void setDeadLayer (std::string, Identifier); + void setDeadStation (std::string, Identifier); + + const std::vector<std::string>& getDeadLayers () const; + const std::vector<std::string>& getDeadStations () const; + + const std::vector<Identifier>& getDeadLayersId () const; + const std::vector<Identifier>& getDeadStationsId () const; + + const std::vector<unsigned int>& getDeadChannelsHash() const; + + const int& getChannelStatus(IdentifierHash) const; + + bool isGood (const Identifier & ) const; + bool isGoodLayer (const Identifier & ) const; + bool isGoodStation (const Identifier & ) const; + + bool isGoodChannelHash(const IdentifierHash &) const; + + + +private: + + std::vector<std::string> m_cachedDeadLayers; + std::vector<std::string> m_cachedDeadStations; + + std::vector<Identifier> m_cachedDeadLayersId; + std::vector<Identifier> m_cachedDeadStationsId; + + std::vector<unsigned int> m_cachedDeadChannelsHash; + std::map<unsigned int, int> m_cachedChannelsStatus; + + std::vector<std::string> m_emptyNames; + std::vector<Identifier> m_emptyIds; + std::vector<unsigned int> m_emptyHashs; + + int m_nillint = 0; + +}; + +CLASS_DEF( CscCondDbData, 10742890, 1) +#include "AthenaKernel/CondCont.h" +CLASS_DEF( CondCont<CscCondDbData>, 43297256, 0) + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h new file mode 100644 index 0000000000000000000000000000000000000000..a3689ba8c6a351887d21abd94ae6eb378bdf6d27 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/MdtCondDbData.h @@ -0,0 +1,116 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONCONDDATA_MDTCONDDBDATA_H +#define MUONCONDDATA_MDTCONDDBDATA_H + +//STL includes +#include <string> +#include <vector> + +//Athena includes +#include "MuonIdHelpers/MdtIdHelper.h" +#include "Identifier/Identifier.h" +#include "AthenaKernel/CondCont.h" +#include "AthenaKernel/BaseInfo.h" + + +//forward declarations +class Identifier; +class MdtIdHelper; + + +class MdtCondDbData { + + friend class MdtCondDbAlg; + +public: + + MdtCondDbData(); + virtual ~MdtCondDbData() = default; + + void setDeadTube (std::string, Identifier); + void setDeadLayer (std::string, Identifier); + void setDeadMultilayer(std::string, Identifier); + void setDeadStation (std::string, Identifier); + void setDeadChamber (Identifier); + + void setNoisyTube (Identifier); + void setNoisyLayer (Identifier); + void setNoisyMultilayer(Identifier); + void setNoisyStation (Identifier); + void setNoisyChamber (Identifier); + + const std::vector<std::string>& getDeadTubes () const; + const std::vector<std::string>& getDeadLayers () const; + const std::vector<std::string>& getDeadMultilayers() const; + const std::vector<std::string>& getDeadStations () const; + const std::vector<std::string>& getDeadChambers () const; + + const std::vector<Identifier>& getDeadTubesId () const; + const std::vector<Identifier>& getDeadLayersId () const; + const std::vector<Identifier>& getDeadMultilayersId() const; + const std::vector<Identifier>& getDeadStationsId () const; + const std::vector<Identifier>& getDeadChambersId () const; + + const std::vector<std::string>& getNoisyTubes () const; + const std::vector<std::string>& getNoisyLayers () const; + const std::vector<std::string>& getNoisyMultilayers() const; + const std::vector<std::string>& getNoisyStations () const; + const std::vector<std::string>& getNoisyChambers () const; + + const std::vector<Identifier>& getNoisyTubesId () const; + const std::vector<Identifier>& getNoisyLayersId () const; + const std::vector<Identifier>& getNoisyMultilayersId() const; + const std::vector<Identifier>& getNoisyStationsId () const; + const std::vector<Identifier>& getNoisyChambersId () const; + + bool isGood (const Identifier & Id) const; + bool isGoodChannel (const Identifier & Id) const; + bool isGoodTube (const Identifier & Id) const; + bool isGoodLayer (const Identifier & Id) const; + bool isGoodMultilayer(const Identifier & Id) const; + bool isGoodStation (const Identifier & Id) const; + bool isGoodChamber (const Identifier & Id) const; + + + +private: + + std::vector<std::string> m_cachedDeadTubes; + std::vector<std::string> m_cachedDeadLayers; + std::vector<std::string> m_cachedDeadMultilayers; + std::vector<std::string> m_cachedDeadStations; + std::vector<std::string> m_cachedDeadChambers; + + std::vector<Identifier> m_cachedDeadTubesId; + std::vector<Identifier> m_cachedDeadLayersId; + std::vector<Identifier> m_cachedDeadMultilayersId; + std::vector<Identifier> m_cachedDeadStationsId; + std::vector<Identifier> m_cachedDeadChambersId; + + std::vector<std::string> m_cachedNoisyTubes; + std::vector<std::string> m_cachedNoisyLayers; + std::vector<std::string> m_cachedNoisyMultilayers; + std::vector<std::string> m_cachedNoisyStations; + std::vector<std::string> m_cachedNoisyChambers; + + std::vector<Identifier> m_cachedNoisyTubesId; + std::vector<Identifier> m_cachedNoisyLayersId; + std::vector<Identifier> m_cachedNoisyMultilayersId; + std::vector<Identifier> m_cachedNoisyStationsId; + std::vector<Identifier> m_cachedNoisyChambersId; + + std::vector<std::string> m_emptyNames; + std::vector<Identifier> m_emptyIds; + + const MdtIdHelper * m_idHelper; + +}; + +CLASS_DEF( MdtCondDbData, 58088442, 1) +#include "AthenaKernel/CondCont.h" +CLASS_DEF( CondCont<MdtCondDbData>, 62077248, 0) + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h new file mode 100644 index 0000000000000000000000000000000000000000..8bb33673eae669e772181b24a9ce83536067dd0a --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/RpcCondDbData.h @@ -0,0 +1,126 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONCONDDATA_RPCCONDDBDATA_H +#define MUONCONDDATA_RPCCONDDBDATA_H + +//STL includes +#include <string> +#include <vector> + +//Athena includes +#include "Identifier/Identifier.h" +#include "AthenaKernel/CondCont.h" +#include "AthenaKernel/BaseInfo.h" + + +//forward declarations +class Identifier; + + +class RpcCondDbData { + + friend class RpcCondDbAlg; + +public: + + RpcCondDbData(); + virtual ~RpcCondDbData() = default; + + void setDeadPanel (std::string, Identifier ); + void setDeadStrip (Identifier ); + void setDeadStripInt (Identifier, int ); + void setDeadStripList (Identifier, std::string ); + void setEfficiency (Identifier, double ); + void setFracClusterSize1(Identifier, double ); + void setFracClusterSize2(Identifier, double ); + void setFracClusterSize3(Identifier, double ); + void setFracDeadStrip (Identifier, double ); + void setGapEfficiency (Identifier, double ); + void setLowEffPanel (Identifier ); + void setMeanClusterSize (Identifier, double ); + void setOffPanel (std::string, Identifier ); + void setProjectedTrack (Identifier, int ); + void setStripTime (Identifier, std::vector<double>); + + const std::vector<std::string>& getDeadPanels() const; + const std::vector<std::string>& getOffPanels () const; + + const std::vector<Identifier>& getDeadPanelsId() const; + const std::vector<Identifier>& getDeadStrips () const; + const std::vector<Identifier>& getLowEffPanels() const; + const std::vector<Identifier>& getOffPanelsId () const; + + const std::string& getDeadStripList (const Identifier& ); + const int& getDeadStripInt (const Identifier& ); + const double& getEfficiency (const Identifier& ); + const double& getFracClusterSize1(const Identifier& ); + const double& getFracClusterSize2(const Identifier& ); + const double& getFracClusterSize3(const Identifier& ); + const double& getFracDeadStrip (const Identifier& ); + const double& getGapEfficiency (const Identifier& ); + const double& getMeanClusterSize (const Identifier& ); + const int& getProjectedTrack (const Identifier& ); + const std::vector<double>& getStripTime (const Identifier& ); + + + bool isEffPanel (const Identifier & Id) const; + bool isGood (const Identifier & Id) const; + bool isGoodPanel (const Identifier & Id) const; + bool isGoodStrip (const Identifier & Id) const; + bool isOffPanel (const Identifier & Id) const; + + + +private: + + std::vector<std::string> m_cachedDeadPanels; + std::vector<std::string> m_cachedOffPanels; + + std::vector<Identifier> m_cachedDeadPanelsId; + std::vector<Identifier> m_cachedDeadStrips; + std::vector<Identifier> m_cachedLowEffPanels; + std::vector<Identifier> m_cachedOffPanelsId; + + std::map<Identifier, std::string > m_cachedDeadStripList; + std::map<Identifier, int > m_cachedDeadStripListInt; + std::map<Identifier, double > m_cachedEfficiency; + std::map<Identifier, double > m_cachedFracClusterSize1; + std::map<Identifier, double > m_cachedFracClusterSize2; + std::map<Identifier, double > m_cachedFracClusterSize3; + std::map<Identifier, double > m_cachedFracDeadStrip; + std::map<Identifier, double > m_cachedGapEfficiency; + std::map<Identifier, double > m_cachedMeanClusterSize; + std::map<Identifier, int > m_cachedProjectedTracks; + std::map<Identifier, std::vector<double> > m_cachedStripTime; + + std::vector<std::string> m_emptyNames; + std::vector<Identifier> m_emptyIds; + std::vector<double> m_emptyDoubles; + double m_nill = -1; + int m_nillint = -1; + std::string m_nillstr = ""; + +public: + + virtual const std::map<Identifier, double>& getEfficiencyMap () const { return m_cachedEfficiency ;} + virtual const std::map<Identifier, double>& getEfficiencyGapMap () const { return m_cachedGapEfficiency ;} + virtual const std::map<Identifier, double>& getMeanClusterSizeMap () const { return m_cachedMeanClusterSize ;} + virtual const std::map<Identifier, double>& getFracClusterSize1Map() const { return m_cachedFracClusterSize1;} + virtual const std::map<Identifier, double>& getFracClusterSize2Map() const { return m_cachedFracClusterSize2;} + virtual const std::map<Identifier, double>& getFracClusterSize3Map() const { return m_cachedFracClusterSize3;} + virtual const std::map<Identifier, std::string>& getDeadStripMap () const { return m_cachedDeadStripList ;} + virtual const std::map<Identifier, double>& getFracDeadStripMap () const { return m_cachedFracDeadStrip ;} + virtual const std::map<Identifier, int>& getProjectedTracksMap () const { return m_cachedProjectedTracks ;} + virtual const std::map<Identifier, int>& getDeadStripIntMap () const { return m_cachedDeadStripListInt;} + virtual const std::map<Identifier,std::vector<double> >& getStripTimeMap () const { return m_cachedStripTime ;} + + +}; + +CLASS_DEF( RpcCondDbData, 25128902, 1) +#include "AthenaKernel/CondCont.h" +CLASS_DEF( CondCont<RpcCondDbData>, 178635428, 0) + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h new file mode 100644 index 0000000000000000000000000000000000000000..8660cc8d8066c527a7b363d7d3723d6aa6ec20f8 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcCondDbData.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONCONDDATA_TGCCONDDBDATA_H +#define MUONCONDDATA_TGCCONDDBDATA_H + +//STL includes +#include <string> +#include <vector> + +//Athena includes +#include "Identifier/Identifier.h" +#include "AthenaKernel/CondCont.h" +#include "AthenaKernel/BaseInfo.h" + + +//forward declarations +class Identifier; + + +class TgcCondDbData { + + friend class TgcCondDbAlg; + +public: + + TgcCondDbData(); + virtual ~TgcCondDbData() = default; + + void setDeadStation(Identifier); + + const std::vector<Identifier>& getDeadStationsId() const; + + bool isGood (const Identifier & Id) const; + bool isGoodStation (const Identifier & Id) const; + + + +private: + + std::vector<Identifier> m_cachedDeadStationsId; + + std::vector<std::string> m_emptyNames; + std::vector<Identifier> m_emptyIds; + + static bool Compare(const Identifier &a, const Identifier &b) {return (a>b);} + +}; + +CLASS_DEF( TgcCondDbData, 130737053, 1) +#include "AthenaKernel/CondCont.h" +CLASS_DEF( CondCont<TgcCondDbData>, 178252645, 0) + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..eeb6538f73d1b6ae401f54fd8a6724319e3203e5 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx @@ -0,0 +1,139 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondData/CscCondDbData.h" + +// constructor +CscCondDbData::CscCondDbData() { +} + + +// --- writing identifiers ------- + +// setChannelStatus +void +CscCondDbData::setChannelStatus(IdentifierHash hash, int status){ + m_cachedChannelsStatus[(unsigned int) hash] = status; + if((status & 0x1) || ((status >> 1) & 0x1)) setDeadChannelHash(hash); +} + +// setDeadChannelHash +void +CscCondDbData::setDeadChannelHash(IdentifierHash hash){ + if(std::find(m_cachedDeadChannelsHash.begin(), m_cachedDeadChannelsHash.end(), (unsigned int) hash) != m_cachedDeadChannelsHash.end()) return; + m_cachedDeadChannelsHash.push_back((unsigned int) hash); +} + +// setDeadLayer +void +CscCondDbData::setDeadLayer(std::string name, Identifier Id){ + if(std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end()) return; + m_cachedDeadLayers .push_back(name); + m_cachedDeadLayersId.push_back(Id ); +} + +// setDeadStation +void +CscCondDbData::setDeadStation(std::string name, Identifier Id){ + if(std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end()) return; + m_cachedDeadStations .push_back(name); + m_cachedDeadStationsId.push_back(Id ); +} + + + + + +// --- reading identifiers ------- + +// getDeadLayers +const +std::vector<std::string>& CscCondDbData::getDeadLayers() const{ + if(m_cachedDeadLayers.size()!=0) return m_cachedDeadLayers; + return m_emptyNames; +} + +// getDeadStations +const +std::vector<std::string>& CscCondDbData::getDeadStations() const{ + if(m_cachedDeadStations.size()!=0) return m_cachedDeadStations; + return m_emptyNames; +} + + + +// getDeadLayersId +const +std::vector<Identifier>& CscCondDbData::getDeadLayersId() const{ + if(m_cachedDeadLayersId.size()!=0) return m_cachedDeadLayersId; + return m_emptyIds; +} + +// getDeadStationsId +const +std::vector<Identifier>& CscCondDbData::getDeadStationsId() const{ + if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId; + return m_emptyIds; +} + + + +// getDeadChannelsHashs +const +std::vector<unsigned int>& CscCondDbData::getDeadChannelsHash() const{ + if(m_cachedDeadChannelsHash.size()!=0) return m_cachedDeadChannelsHash; + return m_emptyHashs; +} + + + +// --- stored info for all ------- + +// getChannelStatus +const +int& CscCondDbData::getChannelStatus(IdentifierHash hash) const{ + if(m_cachedChannelsStatus.find((unsigned int) hash)==m_cachedChannelsStatus.end()) return m_nillint; + return m_cachedChannelsStatus.find((unsigned int) hash)->second; +} + + + + +// --- probing identifiers ------- + +// isGood +bool +CscCondDbData::isGood(const Identifier & Id) const{ + // probing id in all lists + if(not isGoodLayer (Id)) return false; + if(not isGoodStation (Id)) return false; + return true; +} + +// isGoodChannelHash +bool +CscCondDbData::isGoodChannelHash(const IdentifierHash & hash) const{ + if(m_cachedDeadChannelsHash.size()==0) return true; + bool found = std::find(m_cachedDeadChannelsHash.begin(), m_cachedDeadChannelsHash.end(), (unsigned int) hash) != m_cachedDeadChannelsHash.end(); + return !found; +} + +// isGoodLayer +bool +CscCondDbData::isGoodLayer(const Identifier & Id) const{ + if(m_cachedDeadLayersId.size()==0) return true; + bool found = std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end(); + return !found; +} + +// isGoodStation +bool +CscCondDbData::isGoodStation(const Identifier & Id) const{ + if(m_cachedDeadStationsId.size()==0) return true; + bool found = std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end(); + return !found; +} + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b661c176a0262509c59d0fc0d66288c924c87118 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/MdtCondDbData.cxx @@ -0,0 +1,313 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondData/MdtCondDbData.h" + +// constructor +MdtCondDbData::MdtCondDbData(){ +} + + +// --- writing identifiers ------- + +// setDeadTube +void +MdtCondDbData::setDeadTube(std::string name, Identifier Id){ + if(std::find(m_cachedDeadTubesId.begin(), m_cachedDeadTubesId.end(), Id)!=m_cachedDeadTubesId.end()) return; + m_cachedDeadTubes .push_back(name); + m_cachedDeadTubesId.push_back(Id ); +} + +// setDeadLayer +void +MdtCondDbData::setDeadLayer(std::string name, Identifier Id){ + if(std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end()) return; + m_cachedDeadLayers .push_back(name); + m_cachedDeadLayersId.push_back(Id ); +} + +// setDeadMultilayer +void +MdtCondDbData::setDeadMultilayer(std::string name, Identifier Id){ + if(std::find(m_cachedDeadMultilayersId.begin(), m_cachedDeadMultilayersId.end(), Id)!=m_cachedDeadMultilayersId.end()) return; + m_cachedDeadMultilayers .push_back(name); + m_cachedDeadMultilayersId.push_back(Id ); +} + +// setDeadStation (= a chamber dead by itself) +void +MdtCondDbData::setDeadStation(std::string name, Identifier Id){ + if(std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end()) return; + m_cachedDeadStations .push_back(name); + m_cachedDeadStationsId.push_back(Id ); +} + +// setDeadChamber (= a chamber with dead channels) +void +MdtCondDbData::setDeadChamber(Identifier Id){ + if(std::find(m_cachedDeadChambersId.begin(), m_cachedDeadChambersId.end(), Id)!=m_cachedDeadChambersId.end()) return; + m_cachedDeadChambersId.push_back(Id ); +} + +// setNoisyTube +void +MdtCondDbData::setNoisyTube(Identifier Id){ + if(std::find(m_cachedNoisyTubesId.begin(), m_cachedNoisyTubesId.end(), Id)!=m_cachedNoisyTubesId.end()) return; + m_cachedNoisyTubesId.push_back(Id ); +} + +// setNoisyLayer +void +MdtCondDbData::setNoisyLayer(Identifier Id){ + if(std::find(m_cachedNoisyLayersId.begin(), m_cachedNoisyLayersId.end(), Id)!=m_cachedNoisyLayersId.end()) return; + m_cachedNoisyLayersId.push_back(Id ); +} + +// setNoisyMultilayer +void +MdtCondDbData::setNoisyMultilayer(Identifier Id){ + if(std::find(m_cachedNoisyMultilayersId.begin(), m_cachedNoisyMultilayersId.end(), Id)!=m_cachedNoisyMultilayersId.end()) return; + m_cachedNoisyMultilayersId.push_back(Id ); +} + +// setNoisyStation +void +MdtCondDbData::setNoisyStation(Identifier Id){ + if(std::find(m_cachedNoisyStationsId.begin(), m_cachedNoisyStationsId.end(), Id)!=m_cachedNoisyStationsId.end()) return; + m_cachedNoisyStationsId.push_back(Id ); +} + +// setNoisyChamber +void +MdtCondDbData::setNoisyChamber(Identifier Id){ + if(std::find(m_cachedNoisyChambersId.begin(), m_cachedNoisyChambersId.end(), Id)!=m_cachedNoisyChambersId.end()) return; + m_cachedNoisyChambersId.push_back(Id ); +} + + + + + +// --- reading identifiers ------- + +// getDeadTubes +const +std::vector<std::string>& MdtCondDbData::getDeadTubes() const{ + if(m_cachedDeadTubes.size()!=0) return m_cachedDeadTubes; + return m_emptyNames; +} + +// getDeadLayers +const +std::vector<std::string>& MdtCondDbData::getDeadLayers() const{ + if(m_cachedDeadLayers.size()!=0) return m_cachedDeadLayers; + return m_emptyNames; +} + +// getDeadMultilayers +const +std::vector<std::string>& MdtCondDbData::getDeadMultilayers() const{ + if(m_cachedDeadMultilayers.size()!=0) return m_cachedDeadMultilayers; + return m_emptyNames; +} + +// getDeadStations +const +std::vector<std::string>& MdtCondDbData::getDeadStations() const{ + if(m_cachedDeadStations.size()!=0) return m_cachedDeadStations; + return m_emptyNames; +} + +// getDeadChambers +const +std::vector<std::string>& MdtCondDbData::getDeadChambers() const{ + if(m_cachedDeadChambers.size()!=0) return m_cachedDeadChambers; + return m_emptyNames; +} + + + +// getDeadTubesId +const +std::vector<Identifier>& MdtCondDbData::getDeadTubesId() const{ + if(m_cachedDeadTubesId.size()!=0) return m_cachedDeadTubesId; + return m_emptyIds; +} + +// getDeadLayersId +const +std::vector<Identifier>& MdtCondDbData::getDeadLayersId() const{ + if(m_cachedDeadLayersId.size()!=0) return m_cachedDeadLayersId; + return m_emptyIds; +} + +// getDeadMultilayersId +const +std::vector<Identifier>& MdtCondDbData::getDeadMultilayersId() const{ + if(m_cachedDeadMultilayersId.size()!=0) return m_cachedDeadMultilayersId; + return m_emptyIds; +} + +// getDeadStationsId +const +std::vector<Identifier>& MdtCondDbData::getDeadStationsId() const{ + if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId; + return m_emptyIds; +} + +// getDeadChambersId +const +std::vector<Identifier>& MdtCondDbData::getDeadChambersId() const{ + if(m_cachedDeadChambersId.size()!=0) return m_cachedDeadChambersId; + return m_emptyIds; +} + + + +// getNoisyTubes +const +std::vector<std::string>& MdtCondDbData::getNoisyTubes() const{ + if(m_cachedNoisyTubes.size()!=0) return m_cachedNoisyTubes; + return m_emptyNames; +} + +// getNoisyLayers +const +std::vector<std::string>& MdtCondDbData::getNoisyLayers() const{ + if(m_cachedNoisyLayers.size()!=0) return m_cachedNoisyLayers; + return m_emptyNames; +} + +// getNoisyMultilayers +const +std::vector<std::string>& MdtCondDbData::getNoisyMultilayers() const{ + if(m_cachedNoisyMultilayers.size()!=0) return m_cachedNoisyMultilayers; + return m_emptyNames; +} + +// getNoisyStations +const +std::vector<std::string>& MdtCondDbData::getNoisyStations() const{ + if(m_cachedNoisyStations.size()!=0) return m_cachedNoisyStations; + return m_emptyNames; +} + +// getNoisyChambers +const +std::vector<std::string>& MdtCondDbData::getNoisyChambers() const{ + if(m_cachedNoisyChambers.size()!=0) return m_cachedNoisyChambers; + return m_emptyNames; +} + + + +// getNoisyTubesId +const +std::vector<Identifier>& MdtCondDbData::getNoisyTubesId() const{ + if(m_cachedNoisyTubesId.size()!=0) return m_cachedNoisyTubesId; + return m_emptyIds; +} + +// getNoisyLayersId +const +std::vector<Identifier>& MdtCondDbData::getNoisyLayersId() const{ + if(m_cachedNoisyLayersId.size()!=0) return m_cachedNoisyLayersId; + return m_emptyIds; +} + +// getNoisyMultilayersId +const +std::vector<Identifier>& MdtCondDbData::getNoisyMultilayersId() const{ + if(m_cachedNoisyMultilayersId.size()!=0) return m_cachedNoisyMultilayersId; + return m_emptyIds; +} + +// getNoisyStationsId +const +std::vector<Identifier>& MdtCondDbData::getNoisyStationsId() const{ + if(m_cachedNoisyStationsId.size()!=0) return m_cachedNoisyStationsId; + return m_emptyIds; +} + +// getNoisyChambersId +const +std::vector<Identifier>& MdtCondDbData::getNoisyChambersId() const{ + if(m_cachedNoisyChambersId.size()!=0) return m_cachedNoisyChambersId; + return m_emptyIds; +} + + + +// --- probing identifiers ------- + +// isGood +bool +MdtCondDbData::isGood(const Identifier & Id) const{ + // probing id in all lists + if(not isGoodTube (Id)) return false; + if(not isGoodLayer (Id)) return false; + if(not isGoodMultilayer(Id)) return false; + if(not isGoodChamber (Id)) return false; + if(not isGoodStation (Id)) return false; + return true; +} + +// isGoodChannel +bool +MdtCondDbData::isGoodChannel(const Identifier & Id) const{ + // probing channel and all associated entities + //Identifier layerId = m_idHelper->layerID (Id); + Identifier multilayerId = m_idHelper->multilayerID(Id); + Identifier chamberId = m_idHelper->elementID (Id); + //Identifier stationId = m_idHelper->stationID (Id); + if(not isGoodTube (Id )) return false; + //if(not isGoodLayer (layerId )) return false; + if(not isGoodMultilayer(multilayerId)) return false; + if(not isGoodChamber (chamberId )) return false; + //if(not isGoodStation (stationId )) return false; + return true; +} + +// isGoodTube +bool +MdtCondDbData::isGoodTube(const Identifier & Id) const{ + if(m_cachedDeadTubesId.size()==0) return true; + bool found = std::find(m_cachedDeadTubesId.begin(), m_cachedDeadTubesId.end(), Id)!=m_cachedDeadTubesId.end(); + return !found; +} + +// isGoodLayer +bool +MdtCondDbData::isGoodLayer(const Identifier & Id) const{ + if(m_cachedDeadLayersId.size()==0) return true; + bool found = std::find(m_cachedDeadLayersId.begin(), m_cachedDeadLayersId.end(), Id)!=m_cachedDeadLayersId.end(); + return !found; +} + +// isGoodMultilayer +bool +MdtCondDbData::isGoodMultilayer(const Identifier & Id) const{ + if(m_cachedDeadMultilayersId.size()==0) return true; + bool found = std::find(m_cachedDeadMultilayersId.begin(), m_cachedDeadMultilayersId.end(), Id)!=m_cachedDeadMultilayersId.end(); + return !found; +} + +// isGoodStation +bool +MdtCondDbData::isGoodStation(const Identifier & Id) const{ + if(m_cachedDeadStationsId.size()==0) return true; + bool found = std::find(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id)!=m_cachedDeadStationsId.end(); + return !found; +} + +// isGoodChamber +bool +MdtCondDbData::isGoodChamber(const Identifier & Id) const{ + if(m_cachedDeadChambersId.size()==0) return true; + bool found = std::find(m_cachedDeadChambersId.begin(), m_cachedDeadChambersId.end(), Id)!=m_cachedDeadChambersId.end(); + return !found; +} + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c56dcd491c06d074f997eaedb4afcae030a9af12 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/RpcCondDbData.cxx @@ -0,0 +1,299 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondData/RpcCondDbData.h" + +// constructor +RpcCondDbData::RpcCondDbData(){ +} + + +// --- writing identifiers ------- + +// setDeadPanel +void +RpcCondDbData::setDeadPanel(std::string name, Identifier Id){ + if(std::find(m_cachedDeadPanelsId.begin(), m_cachedDeadPanelsId.end(), Id)!=m_cachedDeadPanelsId.end()) return; + m_cachedDeadPanels .push_back(name); + m_cachedDeadPanelsId.push_back(Id ); +} + +// setDeadStrip +void +RpcCondDbData::setDeadStrip(Identifier stripId){ + if(std::find(m_cachedDeadStrips.begin(), m_cachedDeadStrips.end(), stripId)!=m_cachedDeadStrips.end()) return; + m_cachedDeadStrips.push_back(stripId); +} + +// setDeadStripInt +void +RpcCondDbData::setDeadStripInt(Identifier chamberId, int striplist){ + if(m_cachedDeadStripListInt.count(chamberId)) return; + m_cachedDeadStripListInt[chamberId] = striplist; +} + +// setDeadStripList +void +RpcCondDbData::setDeadStripList(Identifier chamberId, std::string striplist){ + if(m_cachedDeadStripList.count(chamberId)) return; + m_cachedDeadStripList[chamberId] = striplist; +} + +// setEfficiency +void +RpcCondDbData::setEfficiency(Identifier chamberId, double efficiency){ + if(m_cachedEfficiency.count(chamberId)) return; + m_cachedEfficiency[chamberId] = efficiency; +} + +// setFracClusterSize1 +void +RpcCondDbData::setFracClusterSize1(Identifier chamberId, double fcs){ + if(m_cachedFracClusterSize1.count(chamberId)) return; + m_cachedFracClusterSize1[chamberId] = fcs; +} + +// setFracClusterSize2 +void +RpcCondDbData::setFracClusterSize2(Identifier chamberId, double fcs){ + if(m_cachedFracClusterSize2.count(chamberId)) return; + m_cachedFracClusterSize2[chamberId] = fcs; +} + +// setFracClusterSize3 +void +RpcCondDbData::setFracClusterSize3(Identifier chamberId, double fcs){ + if(m_cachedFracClusterSize3.count(chamberId)) return; + m_cachedFracClusterSize3[chamberId] = fcs; +} + +// setFracDeadStrip +void +RpcCondDbData::setFracDeadStrip(Identifier chamberId, double fds){ + if(m_cachedFracDeadStrip.count(chamberId)) return; + m_cachedFracDeadStrip[chamberId] = fds; +} + +// setGapEfficiency +void +RpcCondDbData::setGapEfficiency(Identifier chamberId, double efficiency){ + if(m_cachedGapEfficiency.count(chamberId)) return; + m_cachedGapEfficiency[chamberId] = efficiency; +} + +// setLowEffPanel +void +RpcCondDbData::setLowEffPanel(Identifier chamberId){ + if(std::find(m_cachedLowEffPanels.begin(), m_cachedLowEffPanels.end(), chamberId)!=m_cachedLowEffPanels.end()) return; + m_cachedLowEffPanels.push_back(chamberId); +} + +// setMeanClusterSize +void +RpcCondDbData::setMeanClusterSize(Identifier chamberId, double mcs){ + if(m_cachedMeanClusterSize.count(chamberId)) return; + m_cachedMeanClusterSize[chamberId] = mcs; +} + +// setOffPanel +void +RpcCondDbData::setOffPanel(std::string name, Identifier Id){ + if(std::find(m_cachedOffPanelsId.begin(), m_cachedOffPanelsId.end(), Id)!=m_cachedOffPanelsId.end()) return; + m_cachedOffPanels .push_back(name); + m_cachedOffPanelsId.push_back(Id ); +} + +// setProjectedTrack +void +RpcCondDbData::setProjectedTrack(Identifier chamberId, int projectedTracks){ + if(m_cachedProjectedTracks.count(chamberId)) return; + m_cachedProjectedTracks[chamberId] = projectedTracks; +} + +// setStripTime +void +RpcCondDbData::setStripTime(Identifier stripId, std::vector<double> time){ + if(m_cachedStripTime.count(stripId)) return; + m_cachedStripTime[stripId] = time; +} + + + + + + +// --- reading identifiers ------- + + +// getDeadPanels +const std::vector<std::string>& +RpcCondDbData::getDeadPanels() const{ + if(m_cachedDeadPanels.size()!=0) return m_cachedDeadPanels; + return m_emptyNames; +} + +// getDeadPanelsId +const std::vector<Identifier>& +RpcCondDbData::getDeadPanelsId() const{ + if(m_cachedDeadPanelsId.size()!=0) return m_cachedDeadPanelsId; + return m_emptyIds; +} + +// getDeadStrips +const std::vector<Identifier>& +RpcCondDbData::getDeadStrips() const{ + if(m_cachedDeadStrips.size()!=0) return m_cachedDeadStrips; + return m_emptyIds; +} + +// getLowEffPanels +const std::vector<Identifier>& +RpcCondDbData::getLowEffPanels() const{ + if(m_cachedLowEffPanels.size()!=0) return m_cachedLowEffPanels; + return m_emptyIds; +} + +// getOffPanels +const std::vector<std::string>& +RpcCondDbData::getOffPanels() const{ + if(m_cachedOffPanels.size()!=0) return m_cachedOffPanels; + return m_emptyNames; +} + +// getOffPanelsId +const std::vector<Identifier>& +RpcCondDbData::getOffPanelsId() const{ + if(m_cachedOffPanelsId.size()!=0) return m_cachedOffPanelsId; + return m_emptyIds; +} + + + + + +// getDeadStripInt +const int& +RpcCondDbData::getDeadStripInt(const Identifier & Id) { + if(m_cachedDeadStripListInt.find(Id)==m_cachedDeadStripListInt.end()) return m_nillint; + return m_cachedDeadStripListInt[Id]; +} + +// getDeadStripList +const std::string& +RpcCondDbData::getDeadStripList(const Identifier & Id) { + if(m_cachedDeadStripList.find(Id)==m_cachedDeadStripList.end()) return m_nillstr; + return m_cachedDeadStripList[Id]; +} + +// getEfficiency +const double& +RpcCondDbData::getEfficiency(const Identifier & Id) { + if(m_cachedEfficiency.find(Id)==m_cachedEfficiency.end()) return m_nill; + return m_cachedEfficiency[Id]; +} + +// getFracClusterSize1 +const double& +RpcCondDbData::getFracClusterSize1(const Identifier & Id) { + if(m_cachedFracClusterSize1.find(Id)==m_cachedFracClusterSize1.end()) return m_nill; + return m_cachedFracClusterSize1[Id]; +} + +// getFracClusterSize2 +const double& +RpcCondDbData::getFracClusterSize2(const Identifier & Id) { + if(m_cachedFracClusterSize2.find(Id)==m_cachedFracClusterSize2.end()) return m_nill; + return m_cachedFracClusterSize2[Id]; +} + +// getFracClusterSize3 +const double& +RpcCondDbData::getFracClusterSize3(const Identifier & Id) { + if(m_cachedFracClusterSize3.find(Id)==m_cachedFracClusterSize3.end()) return m_nill; + return m_cachedFracClusterSize3[Id]; +} + +// getFracDeadStrip +const double& +RpcCondDbData::getFracDeadStrip(const Identifier & Id) { + if(m_cachedFracDeadStrip.find(Id)==m_cachedFracDeadStrip.end()) return m_nill; + return m_cachedFracDeadStrip[Id]; +} + +// getGapEfficiency +const double& +RpcCondDbData::getGapEfficiency(const Identifier & Id) { + if(m_cachedGapEfficiency.find(Id)==m_cachedGapEfficiency.end()) return m_nill; + return m_cachedGapEfficiency[Id]; +} + +// getMeanClusterSize +const double& +RpcCondDbData::getMeanClusterSize(const Identifier & Id) { + if(m_cachedMeanClusterSize.find(Id)==m_cachedMeanClusterSize.end()) return m_nill; + return m_cachedMeanClusterSize[Id]; +} + +// getProjectedTrack +const int& +RpcCondDbData::getProjectedTrack(const Identifier & Id) { + if(m_cachedProjectedTracks.find(Id)==m_cachedProjectedTracks.end()) return m_nillint; + return m_cachedProjectedTracks[Id]; +} + +// getStripTime +const std::vector<double>& +RpcCondDbData::getStripTime(const Identifier & Id) { + if(m_cachedStripTime.find(Id)==m_cachedStripTime.end()) return m_emptyDoubles; + return m_cachedStripTime[Id]; +} + + + + +// --- probing identifiers ------- + +// isGood +bool +RpcCondDbData::isGood(const Identifier & Id) const{ + // probing id in all lists + if(not isGoodPanel(Id)) return false; + if( isOffPanel (Id)) return false; + if(not isGoodStrip(Id)) return false; + return true; +} + +// isGoodPanel +bool +RpcCondDbData::isGoodPanel(const Identifier & Id) const{ + if(m_cachedDeadPanelsId.size()==0) return true; + bool found = std::find(m_cachedDeadPanelsId.begin(), m_cachedDeadPanelsId.end(), Id)!=m_cachedDeadPanelsId.end(); + return !found; +} + +// isGoodStrip +bool +RpcCondDbData::isGoodStrip(const Identifier & Id) const{ + if(m_cachedDeadStrips.size()==0) return true; + bool found = std::find(m_cachedDeadStrips.begin(), m_cachedDeadStrips.end(), Id)!=m_cachedDeadStrips.end(); + return !found; +} + +// isOffPanel +bool +RpcCondDbData::isOffPanel(const Identifier & Id) const{ + if(m_cachedOffPanelsId.size()==0) return true; + bool found = std::find(m_cachedOffPanelsId.begin(), m_cachedOffPanelsId.end(), Id)!=m_cachedOffPanelsId.end(); + return found; +} + +// isEffPanel +bool +RpcCondDbData::isEffPanel(const Identifier & Id) const{ + if(m_cachedLowEffPanels.size()==0) return true; + bool found = std::find(m_cachedLowEffPanels.begin(), m_cachedLowEffPanels.end(), Id)!=m_cachedLowEffPanels.end(); + return !found; +} + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1b68956fc2488f34cd2c1848bd16d19ee47578a4 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcCondDbData.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondData/TgcCondDbData.h" + +// constructor +TgcCondDbData::TgcCondDbData(){ +} + + +// --- writing identifiers ------- + +// setDeadStation +void +TgcCondDbData::setDeadStation(Identifier Id){ + if(std::binary_search(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id, Compare)) return; + m_cachedDeadStationsId.push_back(Id ); +} + + +// --- reading identifiers ------- + +// getDeadStationsId +const +std::vector<Identifier>& TgcCondDbData::getDeadStationsId() const{ + if(m_cachedDeadStationsId.size()!=0) return m_cachedDeadStationsId; + return m_emptyIds; +} + + +// --- probing identifiers ------- + +// isGood +bool +TgcCondDbData::isGood(const Identifier & Id) const{ + // probing id in all lists + if(not isGoodStation (Id)) return false; + return true; +} + +// isGoodStation +bool +TgcCondDbData::isGoodStation(const Identifier & Id) const{ + if(m_cachedDeadStationsId.size()==0) return true; + bool found = std::binary_search(m_cachedDeadStationsId.begin(), m_cachedDeadStationsId.end(), Id, Compare); + return !found; +} + + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h new file mode 100644 index 0000000000000000000000000000000000000000..04d3d3c106679c3b8dea61a8eea854832a87ee89 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/MDTConditionsTestAlgMT.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MDTConditionsTestAlgMT_H +#define MDTConditionsTestAlgMT_H + +//STL +#include <string> +#include <sstream> + +//Gaudi +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/StatusCode.h" + +//Athena +#include "Identifier/Identifier.h" +#include "MuonCondInterface/IMDTConditionsSvc.h" +#include "MuonCondData/MdtCondDbData.h" +#include "MuonCondSvc/MuonHierarchy.h" + + +//Forward declarations +class ISvcLocator; +class StatusCode; +class MdtCondDbData; + + + +///Example class to show calling the SCT_ConditionsSummarySvc +class MDTConditionsTestAlgMT : public AthAlgorithm { + + public: + MDTConditionsTestAlgMT(const std::string &name,ISvcLocator *pSvcLocator) ; + virtual ~MDTConditionsTestAlgMT(); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private: + SG::ReadCondHandleKey<MdtCondDbData> m_readKey{this, "ReadKey", "MdtCondDbData", "Key of MdtCondDbData"}; + +}; //end of class + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py new file mode 100644 index 0000000000000000000000000000000000000000..ac91b5b93a75494c0eb1ecfd0492026b40486678 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/AllCondSummary_topOptionsMT.py @@ -0,0 +1,206 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +run = "mc" ## "mc" or "dataR1" or "dataR2" +what = "mdt" ## "mdt" or "csc" or "rpc" or "tgc" + +from AthenaCommon.GlobalFlags import GlobalFlags, globalflags +if run == "dataR1": + globalflags.DetGeo.set_Value_and_Lock('atlas') + globalflags.DataSource.set_Value_and_Lock('data') + globalflags.DatabaseInstance.set_Value_and_Lock("COMP200") +if run == "dataR2": + globalflags.DetGeo.set_Value_and_Lock('atlas') + globalflags.DataSource.set_Value_and_Lock('data') + globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2") + + + + +#-------------------------------------------------------------- +# Setup Athena +#-------------------------------------------------------------- + +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.AlgSequence import AlgSequence + +import AthenaCommon.AtlasUnixStandardJob + +# use auditors +from AthenaCommon.AppMgr import ServiceMgr,athCondSeq + +from GaudiSvc.GaudiSvcConf import AuditorSvc + +ServiceMgr += AuditorSvc() +theAuditorSvc = ServiceMgr.AuditorSvc +theAuditorSvc.Auditors += [ "ChronoAuditor"] +theAuditorSvc.Auditors += [ "MemStatAuditor" ] +theApp.AuditAlgorithms=True + +from AthenaCommon.DetFlags import DetFlags +DetFlags.detdescr.SCT_setOff() +DetFlags.ID_setOff() +DetFlags.Calo_setOff() +DetFlags.Muon_setOn() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOff() +DetFlags.SCT_setOff() +DetFlags.TRT_setOff() + +import AtlasGeoModel.SetGeometryVersion +import AtlasGeoModel.GeoModelInit + +from AthenaCommon.JobProperties import jobproperties +from AthenaCommon.AlgSequence import AlgSequence + +job = AlgSequence() + + + +##-------------------------------------------------------------- +## Data Base Services +##-------------------------------------------------------------- + +from AthenaCommon.AlgSequence import AthSequencer + +condSequence = AthSequencer("AthCondSeq") + +# Conditions Service for reading conditions data in serial and MT Athena +from IOVSvc.IOVSvcConf import CondSvc +svcMgr += CondSvc() + +# Conditions data access infrastructure for serial and MT Athena +from IOVSvc.IOVSvcConf import CondInputLoader +condSequence += CondInputLoader( "CondInputLoader") + +import StoreGate.StoreGateConf as StoreGateConf +svcMgr += StoreGateConf.StoreGateSvc("ConditionStore") + +from IOVDbSvc.CondDB import conddb + + +## MDT +if what=="mdt": + if run=="mc": + conddb.setGlobalTag("OFLCOND-MC16-SDR-20") + conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH" , className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE" , className='CondAttrListCollection'); + #conddb.addFolder("MDT_OFL", "/MDT/DQMF/DEAD_ELEMENT" , className='CondAttrListCollection'); + #conddb.addFolder("MDT_OFL", "/MDT/TUBE_STATUS/DEAD_TUBE", className='CondAttrListCollection'); + elif run=="dataR1": + conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") + conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSHVMLSTATE" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV0SETPOINTS" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV1SETPOINTS" , forceData=True, className='CondAttrListCollection'); + elif run=="dataR2": + conddb.setGlobalTag("CONDBR2-BLKPA-2018-15") + conddb.addFolder("DCS_OFL", "/MDT/DCS/LV" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/HV" , forceData=True, className='CondAttrListCollection'); + + +## CSC +if what=="csc": + if run=="dataR1": + conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") + conddb.addFolder("CSC_OFL", "/CSC/STAT" , className='CondAttrListCollection'); + #conddb.addFolder("DCS_OFL", "/CSC/DCS/LAYERSTATE", className='CondAttrListCollection'); + + +## RPC +if what=="rpc": + if run=="mc": + conddb.setGlobalTag("OFLCOND-MC16-SDR-20") + conddb.addFolder("DCS_OFL", "/RPC/DCS/DeadRopanels" , className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/RPC/DCS/OffRopanels" , className='CondAttrListCollection'); + if run=="dataR1": + conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") + conddb.addFolder("RPC_OFL", "/RPC/DQMF/ELEMENT_STATUS", className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/RPC/DCS/DeadRopanels" , className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/RPC/DCS/OffRopanels" , className='CondAttrListCollection'); + + +## TGC +if what=="tgc": + if run=="dataR1": + #conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") + #conddb.addFolder("DCS_OFL", "/TGC/1/DetectorStatus" , className='CondAttrListCollection'); + ## this folder is actually scheme ONLINE! DO NOT USE! + pass + + + + + +##-------------------------------------------------------------- +## NEW Data Base Algorithms +##-------------------------------------------------------------- + +from AthenaCommon.CfgGetter import getPublicTool + +from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool +MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool") +ToolSvc += MuonIdHelperTool +#MuonIdHelperTool.OutputLevel = DEBUG + +## MDT +if what=="mdt": + from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg + alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + if run=="dataR1": alg.useRun1SetPoints = False + +## CSC +if what=="csc": + from MuonCondAlg.MuonCondAlgConf import CscCondDbAlg + alg = CscCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + +## RPC +if what=="rpc": + from MuonCondAlg.MuonCondAlgConf import RpcCondDbAlg + alg = RpcCondDbAlg("RpcCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + +## TGC +if what=="tgc": + from MuonCondAlg.MuonCondAlgConf import TgcCondDbAlg + alg = TgcCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + +## append to sequence +if run=="mc": + alg.isData = False +elif run=="dataR1": + alg.isData = True + alg.isRun1 = True +elif run=="dataR2": + alg.isData = True + alg.isRun1 = False +#alg.OutputLevel = DEBUG +condSequence += alg + + + +##-------------------------------------------------------------- +## NEW Test Algorithm +##-------------------------------------------------------------- +if what=="mdt": + from MuonCondTest.MuonCondTestConf import MDTConditionsTestAlgMT + job += MDTConditionsTestAlgMT() + + + +##-------------------------------------------------------------- +## General Stuff +##-------------------------------------------------------------- +import AthenaCommon.AtlasUnixGeneratorJob + +ServiceMgr.EventSelector.RunNumber = 138460 #1204110576 seconds epoch +import time, calendar +#time in seconds , now +ServiceMgr.EventSelector.InitialTimeStamp = calendar.timegm(time.gmtime()) +#ServiceMgr.EventSelector.InitialTimeStamp = 594682#found valid in db browser? +theApp.EvtMax = 2 + +ServiceMgr.MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M" +ServiceMgr.MessageSvc.OutputLevel = VERBOSE + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py new file mode 100644 index 0000000000000000000000000000000000000000..a6c7f2ba772c3d60e0b661345d2418833a0e527e --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/MDTCondSummary_topOptionsMT.py @@ -0,0 +1,157 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +run = "mc" ## "mc" or "dataR1" or "dataR2" + +from AthenaCommon.GlobalFlags import GlobalFlags, globalflags +if run == "dataR1": + globalflags.DetGeo.set_Value_and_Lock('atlas') + globalflags.DataSource.set_Value_and_Lock('data') + globalflags.DatabaseInstance.set_Value_and_Lock("COMP200") +if run == "dataR2": + globalflags.DetGeo.set_Value_and_Lock('atlas') + globalflags.DataSource.set_Value_and_Lock('data') + globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2") + + + + +#-------------------------------------------------------------- +# Setup Athena +#-------------------------------------------------------------- + +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.AlgSequence import AlgSequence + +import AthenaCommon.AtlasUnixStandardJob + +# use auditors +from AthenaCommon.AppMgr import ServiceMgr,athCondSeq + +from GaudiSvc.GaudiSvcConf import AuditorSvc + +ServiceMgr += AuditorSvc() +theAuditorSvc = ServiceMgr.AuditorSvc +theAuditorSvc.Auditors += [ "ChronoAuditor"] +theAuditorSvc.Auditors += [ "MemStatAuditor" ] +theApp.AuditAlgorithms=True + +from AthenaCommon.DetFlags import DetFlags +DetFlags.detdescr.SCT_setOff() +DetFlags.ID_setOff() +DetFlags.Calo_setOff() +DetFlags.Muon_setOn() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOff() +DetFlags.SCT_setOff() +DetFlags.TRT_setOff() + +import AtlasGeoModel.SetGeometryVersion +import AtlasGeoModel.GeoModelInit + +from AthenaCommon.JobProperties import jobproperties +from AthenaCommon.AlgSequence import AlgSequence + +job = AlgSequence() + + + + +##-------------------------------------------------------------- +## Data Base Services +##-------------------------------------------------------------- + +from AthenaCommon.AlgSequence import AthSequencer + +condSequence = AthSequencer("AthCondSeq") + +# Conditions Service for reading conditions data in serial and MT Athena +from IOVSvc.IOVSvcConf import CondSvc +svcMgr += CondSvc() + +# Conditions data access infrastructure for serial and MT Athena +from IOVSvc.IOVSvcConf import CondInputLoader +condSequence += CondInputLoader( "CondInputLoader") + +import StoreGate.StoreGateConf as StoreGateConf +svcMgr += StoreGateConf.StoreGateSvc("ConditionStore") + +from IOVDbSvc.CondDB import conddb + +if run=="mc": + conddb.setGlobalTag("OFLCOND-MC16-SDR-20") + conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH" , className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE" , className='CondAttrListCollection'); + #conddb.addFolder("MDT_OFL", "/MDT/DQMF/DEAD_ELEMENT" , className='CondAttrListCollection'); + #conddb.addFolder("MDT_OFL", "/MDT/TUBE_STATUS/DEAD_TUBE", className='CondAttrListCollection'); +elif run=="dataR1": + conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") + conddb.addFolder("DCS_OFL", "/MDT/DCS/DROPPEDCH" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSLVCHSTATE" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSHVMLSTATE" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV0SETPOINTS" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/PSV1SETPOINTS" , forceData=True, className='CondAttrListCollection'); +elif run=="dataR2": + conddb.setGlobalTag("CONDBR2-BLKPA-2018-15") + conddb.addFolder("DCS_OFL", "/MDT/DCS/LV" , forceData=True, className='CondAttrListCollection'); + conddb.addFolder("DCS_OFL", "/MDT/DCS/HV" , forceData=True, className='CondAttrListCollection'); + + + + + + +##-------------------------------------------------------------- +## NEW Data Base Algorithms +##-------------------------------------------------------------- + +from AthenaCommon.CfgGetter import getPublicTool + +from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperTool +MuonIdHelperTool = Muon__MuonIdHelperTool("Muon::MuonIdHelperTool") +ToolSvc += MuonIdHelperTool +#MuonIdHelperTool.OutputLevel = DEBUG + + +from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg +alg = MdtCondDbAlg("MdtCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + +if "mc" in run: + alg.isData = False +elif run=="dataR1": + alg.isData = True + alg.isRun1 = True + alg.useRun1SetPoints = False +elif run=="dataR2": + alg.isData = True + alg.isRun1 = False + +#alg.OutputLevel = DEBUG +condSequence += alg + + + +##-------------------------------------------------------------- +## NEW Test Algorithm +##-------------------------------------------------------------- +from MuonCondTest.MuonCondTestConf import MDTConditionsTestAlgMT +job += MDTConditionsTestAlgMT() + + + +##-------------------------------------------------------------- +## General Stuff +##-------------------------------------------------------------- +import AthenaCommon.AtlasUnixGeneratorJob + +ServiceMgr.EventSelector.RunNumber = 138460 #1204110576 seconds epoch +import time, calendar +#time in seconds , now +ServiceMgr.EventSelector.InitialTimeStamp = calendar.timegm(time.gmtime()) +#ServiceMgr.EventSelector.InitialTimeStamp = 594682#found valid in db browser? +theApp.EvtMax = 2 + +ServiceMgr.MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M" +ServiceMgr.MessageSvc.OutputLevel = VERBOSE + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c11c1da9c155996457e53e6e88e63c940da9bd24 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MDTConditionsTestAlgMT.cxx @@ -0,0 +1,110 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondTest/MDTConditionsTestAlgMT.h" + +//Constructor +MDTConditionsTestAlgMT::MDTConditionsTestAlgMT( + const std::string& name, + ISvcLocator* pSvcLocator ) : + AthAlgorithm( name, pSvcLocator ){ + +} + +//Destructor +MDTConditionsTestAlgMT::~MDTConditionsTestAlgMT(){ + ATH_MSG_VERBOSE( "Calling destructor" ); +} + +//Initialize +StatusCode +MDTConditionsTestAlgMT::initialize(){ + ATH_MSG_INFO("Calling initialize"); + ATH_CHECK(m_readKey.initialize()); + return StatusCode::SUCCESS; +} + +//Execute +StatusCode +MDTConditionsTestAlgMT::execute(){ + StatusCode sc(StatusCode::SUCCESS); + + ATH_MSG_INFO("Calling execute"); + std::stringstream ss; + ss << "Now setting up read handle: "; + SG::ReadCondHandle<MdtCondDbData> readHandle{m_readKey}; + const MdtCondDbData* readCdo{*readHandle}; + if(readCdo==0){ + ss << "DID NOT WORK!"; + ATH_MSG_INFO(ss.str()); + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + else { + ss << "WORKED!"; + ATH_MSG_INFO(ss.str()); + } + + ss.clear(); + ss << "Reading Dead Tubes: "; + int size = readCdo->getDeadTubesId().size(); + ss << "found "<<size<<" via Id; containing:"; + ATH_MSG_INFO(ss.str()); + for(int k=0;k<size;++k){ + ATH_MSG_INFO("\t"<<k<<": "<<readCdo->getDeadTubes()[k]); + } + + ss.clear(); + ss << "Reading Dead Layers: "; + size = readCdo->getDeadLayersId().size(); + ss << "found "<<size<<" via Id; containing:"; + ATH_MSG_INFO(ss.str()); + for(int k=0;k<size;++k){ + ATH_MSG_INFO("\t"<<k<<": "<<readCdo->getDeadLayers()[k]); + } + + ss.clear(); + ss << "Reading Dead Multilayers: "; + size = readCdo->getDeadMultilayersId().size(); + ss << "found "<<size<<" via Id; containing:"; + ATH_MSG_INFO(ss.str()); + for(int k=0;k<size;++k){ + ATH_MSG_INFO("\t"<<k<<": "<<readCdo->getDeadMultilayers()[k]); + } + + ss.clear(); + ss << "Reading Dead Stations: "; + size = readCdo->getDeadStationsId().size(); + ss << "found "<<size<<" via Id; containing:"; + ATH_MSG_INFO(ss.str()); + for(int k=0;k<size;++k){ + ATH_MSG_INFO("\t"<<k<<": "<<readCdo->getDeadStations()[k]); + } + + ss.clear(); + ss << "Reading Chambers with Dead Channels: "; + size = readCdo->getDeadChambersId().size(); + ss << "found "<<size<<" via Id; containing:"; + ATH_MSG_INFO(ss.str()); + for(int k=0;k<size;++k){ + ATH_MSG_INFO("\t"<<k<<": "<<readCdo->getDeadChambersId()[k]); + } + + + ATH_MSG_INFO("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); + + ATH_MSG_INFO("Now going to probe some Ids"); + ATH_MSG_INFO("ID=1699348480; isGood? "<<readCdo->isGood(Identifier(1699348480))); + + ATH_MSG_INFO("MADE IT TO THE END!!"); + return sc; +} + + +//Finalize +StatusCode +MDTConditionsTestAlgMT::finalize(){ + ATH_MSG_INFO("Calling finalize"); + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..753dd6a4cf6f664c6c4f5e00f1f18b01494c7070 --- /dev/null +++ b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py @@ -0,0 +1,86 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +## Configuration Access to OFFLINE DB (COMP200) + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from MuonCondAlg.MuonCondAlgConf import MdtCondDbAlg,RpcCondDbAlg,CscCondDbAlg ##,TgcCondDbAlg +from IOVDbSvc.IOVDbSvcConfig import addFolders + +def MdtCondDbAlgCfg(flags, **kwargs): + result = ComponentAccumulator() + folders = [] + if flags.Common.isOnline: + return result ## avoid adding algo to the component accumulator + kwargs["isOnline"] = True + else: + kwargs["isOnline"] = False + if flags.Input.isMC: + kwargs['isData'] = False + folders = ["/MDT/DCS/DROPPEDCH", "/MDT/DCS/PSLVCHSTATE"] + else: + kwargs['isData'] = True + kwargs['isRun1'] = False + folders = ["/MDT/DCS/HV", "/MDT/DCS/LV"] + alg = MdtCondDbAlg(**kwargs) + result.merge( addFolders(flags, folders , detDb="DCS_OFL", className='CondAttrListCollection') ) + result.addCondAlgo(alg) + return result + +def RpcCondDbAlgCfg(flags, **kwargs): + result = ComponentAccumulator() + folders = [] + if flags.Common.isOnline: + return result ## avoid adding algo to the component accumulator + kwargs["isOnline"] = True + else: + kwargs["isOnline"] = False + if flags.Input.isMC: + kwargs['isData'] = False + else: + kwargs['isData'] = True + kwargs['isRun1'] = False + folders = ["/RPC/DCS/DeadRopanels", "/RPC/DCS/OffRopanels"] + alg = RpcCondDbAlg(**kwargs) + result.merge( addFolders(flags, folders , detDb="DCS_OFL", className='CondAttrListCollection') ) + result.merge( addFolders(flags, ["/RPC/DQMF/ELEMENT_STATUS"], detDb="RPC_OFL", className='CondAttrListCollection') ) + result.addCondAlgo(alg) + return result + +def CscCondDbAlgCfg(flags, **kwargs): + result = ComponentAccumulator() + folders = ["/CSC/STAT"] + if flags.Common.isOnline: + return result ## avoid adding algo to the component accumulator + kwargs["isOnline"] = True + else: + kwargs["isOnline"] = False + if flags.Input.isMC: + kwargs['isData'] = False + else: + kwargs['isData'] = True + kwargs['isRun1'] = False + alg = CscCondDbAlg(**kwargs) + result.merge( addFolders(flags, folders , detDb="DCS_OFL", className='CondAttrListCollection') ) + result.addCondAlgo(alg) + return result + +###def TgcCondDbAlgCfg(flags, **kwargs): +### result = ComponentAccumulator() +### folders = [] # which folders? +### if flags.Common.isOnline: +### return result ## avoid adding algo to the component accumulator +### kwargs["isOnline"] = True +### else: +### kwargs["isOnline"] = False +### if flags.Input.isMC: +### kwargs['isData'] = False +### else: +### kwargs['isData'] = True +### kwargs['isRun1'] = False +### alg = TgcCondDbAlg(**kwargs) +### result.merge( addFolders(flags, folders , detDb="DCS_OFL", className='CondAttrListCollection') ) +### result.addCondAlgo(alg) +### return result + + + diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py index 3a52ea2e9ff2ef6d9aaa88bc4f5ae52b60fce199..8433f2d2b018f4f763288c309a7b69559ea5a93c 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py @@ -36,7 +36,8 @@ def MuonPrdCacheCfg(): # The forTrigger paramater is used to put the algorithm in RoI mode # The function returns a ComponentAccumulator and the data-converting algorithm, which should be added to the right sequence by the user def RpcRDODecodeCfg(flags, forTrigger=False): - acc = ComponentAccumulator() + from MuonConfig.MuonCondAlgConfig import RpcCondDbAlgCfg # MT-safe conditions access + acc = RpcCondDbAlgCfg(flags) # We need the RPC cabling to be setup from MuonConfig.MuonCablingConfig import RPCCablingConfigCfg @@ -49,6 +50,8 @@ def RpcRDODecodeCfg(flags, forTrigger=False): # Get the RDO -> PRD tool from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name = "RpcRdoToRpcPrepDataTool") + if flags.Common.isOnline: + RpcRdoToRpcPrepDataTool.ReadKey = "" ## cond data not needed online acc.addPublicTool( RpcRdoToRpcPrepDataTool ) # This should be removed, but now defined as PublicTool at MuFastSteering # Get the RDO -> PRD alorithm diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt index 19caffe8179550a43c51504e79fbe404147e69d1..a55101722c0843c9f9cb483e40e729b9808cb902 100755 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonDigitization/MDT_Response @@ -39,7 +40,7 @@ atlas_add_component( MDT_Digitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier xAODEventInfo GaudiKernel GeneratorObjects MdtCalibData MdtCalibSvcLib MuonCondInterface MuonReadoutGeometry MuonDigitContainer MDT_Response MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement PathResolver TrkDetDescrUtils EventPrimitives ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier xAODEventInfo GaudiKernel GeneratorObjects MdtCalibData MdtCalibSvcLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MDT_Response MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement PathResolver TrkDetDescrUtils EventPrimitives ) # Install files from the package: atlas_install_headers( MDT_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/MdtDigitizationTool.h b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/MdtDigitizationTool.h index 74f5cf8322c7cba77c792e217ac1d76d9ac69bc1..a2c7eaaef0009ada814ac1e96bd5840066a3a9a5 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/MdtDigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/MDT_Digitization/MdtDigitizationTool.h @@ -57,7 +57,7 @@ #include "AthenaKernel/IAthRNGSvc.h" #include "CLHEP/Random/RandGaussZiggurat.h" -#include "MuonCondInterface/IMDTConditionsSvc.h" +#include "MuonCondData/MdtCondDbData.h" #include "MDT_Digitization/IMDT_DigitizationTool.h" #include "PileUpTools/PileUpMergeSvc.h" #include "MdtCalibSvc/MdtCalibrationDbTool.h" @@ -74,6 +74,7 @@ namespace MuonGM{ class MdtIdHelper; class MdtHitIdHelper; +class MdtCondDbData; // Digitization class for MDT hits /* @@ -252,7 +253,7 @@ protected: ServiceHandle <IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""}; // Random number service ToolHandle<MdtCalibrationDbTool> m_calibrationDbTool{this, "CalibrationDbTool", "MdtCalibrationDbTool", ""}; - ServiceHandle<IMDTConditionsSvc> m_pSummarySvc{this, "MDTCondSummarySvc", "MDTCondSummarySvc", ""}; + SG::ReadCondHandleKey<MdtCondDbData> m_readKey{this, "ReadKey", "MdtCondDbData", "Key of MdtCondDbData"}; }; #endif diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MDT_DigitizationConfigNew.py b/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MDT_DigitizationConfigNew.py index 902cf66a24bfb6020930c838156dda2066bb9a77..f678c097c7590e4db9137cb9f0dea74e13f7fbdc 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MDT_DigitizationConfigNew.py +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MDT_DigitizationConfigNew.py @@ -43,7 +43,8 @@ def MDT_Response_DigiToolCfg(flags, name="MDT_Response_DigiTool",**kwargs): def MDT_DigitizationToolCfg(flags, name="MDT_DigitizationTool", **kwargs): """Return a ComponentAccumulator with configured MdtDigitizationTool""" - acc = ComponentAccumulator() + from MuonConfig.MuonCondAlgConfig import MdtCondDbAlgCfg # MT-safe conditions access + acc = MdtCondDbAlgCfg(flags) kwargs.setdefault("MaskedStations", []) kwargs.setdefault("UseDeadChamberSvc", True) kwargs.setdefault("DiscardEarlyHits", True) diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MdtDigitizationConfig.py b/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MdtDigitizationConfig.py index 50a21b17aa0684ea55eda231997c0af450323bc4..6698a9b51121f30894bb9fb3f01af0633afa8dc0 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MdtDigitizationConfig.py +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/python/MdtDigitizationConfig.py @@ -20,6 +20,7 @@ def MDT_LastXing(): return 150 def MdtDigitizationTool(name="MdtDigitizationTool",**kwargs): + import MuonCondAlg.MdtCondDbAlgConfig # MT-safe conditions access kwargs.setdefault("MaskedStations", []) kwargs.setdefault("UseDeadChamberSvc", True) kwargs.setdefault("DiscardEarlyHits", True) diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx index 77443e2d27d3ac4f5a70036755db1b98af835a15..57d74ce9b2823c467cb2b5ade16bfd4fb7750ac3 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx @@ -73,7 +73,6 @@ StatusCode MdtDigitizationTool::initialize() { ATH_MSG_INFO ( "RndmSvc " << m_rndmSvc ); ATH_MSG_INFO ( "DigitizationTool " << m_digiTool ); ATH_MSG_INFO ( "MdtCalibrationDbTool " << m_calibrationDbTool ); - ATH_MSG_INFO ( "MDTCondSummarySvc " << m_pSummarySvc ); ATH_MSG_INFO ( "UseDeadChamberSvc " << m_UseDeadChamberSvc ); if (!m_UseDeadChamberSvc) ATH_MSG_INFO ( "MaskedStations " << m_maskedStations ); ATH_MSG_INFO ( "GetT0FromDB " << m_t0_from_DB ); @@ -167,10 +166,7 @@ StatusCode MdtDigitizationTool::initialize() { //Retrieve the Conditions service if (m_UseDeadChamberSvc==true) { - ATH_MSG_DEBUG("Using Database DCS MDT Conditions for masking dead/missing chambers"); - if (StatusCode::SUCCESS != m_pSummarySvc.retrieve()) { - ATH_MSG_ERROR("Could not retrieve the summary service"); - } + ATH_CHECK(m_readKey.initialize()); } else { ATH_MSG_DEBUG("Using JobOptions for masking dead/missing chambers"); @@ -371,15 +367,18 @@ StatusCode MdtDigitizationTool::doDigitization(MdtDigitContainer* digitContainer CLHEP::HepRandomEngine *twinRndmEngine = getRandomEngine("Twin"); CLHEP::HepRandomEngine *toolRndmEngine = getRandomEngine(m_digiTool->name()); + //Get the list of dead/missing chambers and cache it if ( m_UseDeadChamberSvc ) { + SG::ReadCondHandle<MdtCondDbData> readHandle{m_readKey}; + const MdtCondDbData* readCdo{*readHandle}; m_IdentifiersToMask.clear(); - int size_id = m_pSummarySvc->deadStationsId().size(); + int size_id = readCdo->getDeadStationsId().size(); ATH_MSG_DEBUG ( "Number of dead/missing stations retrieved from CondService= "<< size_id ); for(int k=0;k<size_id;k++) { - Identifier Id = m_pSummarySvc->deadStationsId()[k]; - m_IdentifiersToMask.push_back( m_pSummarySvc->deadStationsId()[k] ); + Identifier Id = readCdo->getDeadStationsId()[k]; + m_IdentifiersToMask.push_back( readCdo->getDeadStationsId()[k] ); ATH_MSG_VERBOSE ( "Dead/missing chambers id from CondDB: " << m_idHelper->show_to_string(Id) ); } } diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt index d9262d24237bd809d9bb7d124b17eb5f21fd52bb..b31fe01e9887a97ff34ef9996df6931dc1c351be 100755 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfoMgt Generators/GeneratorObjects MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonIdHelpers @@ -40,7 +41,7 @@ atlas_add_component( RPC_Digitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps PileUpToolsLib xAODEventInfo GaudiKernel MuonSimData MuonSimEvent HitManagement AthenaKernel EventInfo GeneratorObjects MuonCondInterface MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib PathResolver ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps PileUpToolsLib xAODEventInfo GaudiKernel MuonSimData MuonSimEvent HitManagement AthenaKernel EventInfo GeneratorObjects MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib PathResolver ) # Install files from the package: atlas_install_headers( RPC_Digitization ) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h b/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h index 5e1e01a7026a4b858adc438ecb79a36575edb194..25deb89b0262ef68ddcf44938490a45b6a49d4f3 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/RPC_Digitization/RpcDigitizationTool.h @@ -49,6 +49,7 @@ #include "HitManagement/TimedHitCollection.h" #include "MuonSimData/MuonSimDataCollection.h" #include "MuonCondInterface/IRPCConditionsSvc.h" +#include "MuonCondData/RpcCondDbData.h" #include "xAODEventInfo/EventInfo.h" // NEW EDM #include "xAODEventInfo/EventAuxInfo.h" // NEW EDM @@ -61,6 +62,7 @@ #include <map> class RpcHitIdHelper; +class RpcCondDbData; class RpcIdHelper; class ITagInfoMgr; @@ -166,7 +168,7 @@ private: RpcHitIdHelper* m_muonHelper{}; std::list<RPCSimHitCollection*> m_RPCHitCollList; TimedHitCollection<RPCSimHit>* m_thpcRPC{}; - ServiceHandle<IRPCConditionsSvc> m_rSummarySvc{this, "RPCCondSummarySvc", "RPCCondSummarySvc", ""}; + SG::ReadCondHandleKey<RpcCondDbData> m_readKey{this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"}; std::map<Identifier,std::vector<MuonSimData::Deposit> > m_sdo_tmp_map; Gaudi::Property<int> m_deadTime{this, "DeadTime", 100. , "dead time"}; Gaudi::Property<bool> m_patch_for_rpc_time{this, "PatchForRpcTime", false, ""}; diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfig.py b/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfig.py index 7e2e54264421d50bee3d9cf480077e9a3843e699..92e8c9d92a99a09c0041177e8307771e8d895fa6 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfig.py +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfig.py @@ -23,6 +23,7 @@ def getRpcRange(name="RpcRange", **kwargs): def RpcDigitizationTool(name="RpcDigitizationTool", **kwargs): + import MuonCondAlg.RpcCondDbAlgConfig # MT-safe conditions access if jobproperties.Digitization.doXingByXingPileUp(): # PileUpTool approach # This should match the range for the RPC in Simulation/Digitization/share/MuonDigitization.py kwargs.setdefault("FirstXing", RPC_FirstXing() ) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfigNew.py b/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfigNew.py index 5ebb0cffb1de6d06034f2566da015dc08d03aecd..d2f215d23b3d6ba939e8efd544c131e8bdb01fb8 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfigNew.py +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/python/RPC_DigitizationConfigNew.py @@ -31,7 +31,8 @@ def RPC_RangeToolCfg(flags, name="RPC_Range", **kwargs): def RPC_DigitizationToolCfg(flags, name="RPC_DigitizationTool", **kwargs): """Return a ComponentAccumulator with configured RpcDigitizationTool""" - acc = ComponentAccumulator() + from MuonConfig.MuonCondAlgConfig import RpcCondDbAlgCfg # MT-safe conditions access + acc = RpcCondDbAlgCfg(flags) if flags.Digitization.DoXingByXingPileUp: kwargs.setdefault("FirstXing", RPC_FirstXing()) kwargs.setdefault("LastXing", RPC_LastXing()) @@ -41,7 +42,7 @@ def RPC_DigitizationToolCfg(flags, name="RPC_DigitizationTool", **kwargs): else: kwargs.setdefault("OutputSDOName", "RPC_SDO") # folder for RPCCondSummarySvc - acc.merge(addFolders(flags, "/RPC/DQMF/ELEMENT_STATUS", "RPC_OFL")) + #acc.merge(addFolders(flags, "/RPC/DQMF/ELEMENT_STATUS", "RPC_OFL")) ## already in RpcCondDbAlgCfg # config kwargs.setdefault("DeadTime", 100) kwargs.setdefault("PatchForRpcTime", True) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx index 6d933cbbe51e2fbd0eb8602df53900a40acf3bfb..012efe53b41dfd40aa06e89081a50cea7353eae8 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx @@ -95,7 +95,6 @@ StatusCode RpcDigitizationTool::initialize() { ATH_MSG_DEBUG ( "ClusterSize1_2uncorr " << m_ClusterSize1_2uncorr ); ATH_MSG_DEBUG ( "PrintCalibrationVector " << m_PrintCalibrationVector ); ATH_MSG_DEBUG ( "BOG_BOF_DoubletR2_OFF " << m_BOG_BOF_DoubletR2_OFF ); - ATH_MSG_DEBUG ( "RPCCondSummarySvc " << m_rSummarySvc ); ATH_MSG_DEBUG ( "DumpFromDbFirst " << m_DumpFromDbFirst ); ATH_MSG_DEBUG ( "CutMaxClusterSize " << m_CutMaxClusterSize ); ATH_MSG_DEBUG ( "CutProjectedTracks " << m_CutProjectedTracks ); @@ -239,7 +238,7 @@ StatusCode RpcDigitizationTool::initialize() { ATH_CHECK(fillTagInfo()); if (m_RPCInfoFromDb) { - ATH_CHECK(m_rSummarySvc.retrieve()); + ATH_CHECK(m_readKey.initialize()); } if(m_PrintCalibrationVector) { @@ -686,9 +685,11 @@ StatusCode RpcDigitizationTool::doDigitization(RpcDigitContainer* digitContainer stationPhi,doubletR), doubletZ, doubletPhi,gasGap, imeasphi, clus); // here count and maybe kill dead strips if using COOL input for the detector status if (m_Efficiency_fromCOOL) { + SG::ReadCondHandle<RpcCondDbData> readHandle{m_readKey}; + const RpcCondDbData* readCdo{*readHandle}; if ( !(undefPhiStripStat && imeasphi==1) ) { - if(m_rSummarySvc->RPC_DeadStripList().find( newId ) != m_rSummarySvc->RPC_DeadStripList().end()) + if(readCdo->getDeadStripIntMap().find( newId ) != readCdo->getDeadStripIntMap().end()) { ATH_MSG_DEBUG ( "After DetectionEfficiency: strip "<< m_idHelper->show_to_string(newId) <<" in a cluster of size "<< pcs[2]-pcs[1]+1<<" is dead - kill it "); ++nToBeKilledStrips; @@ -1717,7 +1718,6 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt int stripetagood = 0 ; int stripphigood = 0 ; - if(!m_Efficiency_fromCOOL){ unsigned int index = stationName - 2 ; @@ -1748,6 +1748,9 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt } else{ + SG::ReadCondHandle<RpcCondDbData> readHandle{m_readKey}; + const RpcCondDbData* readCdo{*readHandle}; + ATH_MSG_DEBUG("Efficiencies and cluster size + dead strips will be extracted from COOL"); Identifier IdEta = m_idHelper->panelID(*IdEtaRpcStrip); @@ -1765,7 +1768,7 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt bool noEntryInDb=false; - if( m_rSummarySvc->RPC_FracDeadStripMap() .find(IdEta) == m_rSummarySvc->RPC_FracDeadStripMap() .end()){ + if( readCdo->getFracDeadStripMap() .find(IdEta) == readCdo->getFracDeadStripMap() .end()){ ATH_MSG_DEBUG ( "Not In CoolDB the Panel IdEtaRpcStrip : " << IdEta << " i.e. "<<m_idHelper->show_to_string(IdEta)); noEntryInDb=true; } @@ -1773,7 +1776,7 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt { ATH_MSG_DEBUG ( "Found In CoolDB the Panel IdEtaRpcStrip : " << IdEta << " i.e. "<<m_idHelper->show_to_string(IdEta)); } - if( m_rSummarySvc->RPC_FracDeadStripMap() .find(IdPhi) == m_rSummarySvc->RPC_FracDeadStripMap() .end()) { + if( readCdo->getFracDeadStripMap() .find(IdPhi) == readCdo->getFracDeadStripMap() .end()) { ATH_MSG_DEBUG ( "Not In CoolDB the Panel IdPhiRpcStrip : " << IdPhi << " i.e. "<<m_idHelper->show_to_string(IdPhi)); noEntryInDb=true; } @@ -1781,15 +1784,14 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt { ATH_MSG_DEBUG ( "Found In CoolDB the Panel IdPhiRpcStrip : " << IdPhi << " i.e. "<<m_idHelper->show_to_string(IdPhi)); } - - if( m_rSummarySvc->RPC_FracDeadStripMap() .find(IdEta) != m_rSummarySvc->RPC_FracDeadStripMap() .end()) FracDeadStripEta = m_rSummarySvc->RPC_FracDeadStripMap ().find(IdEta)->second ; - if( m_rSummarySvc->RPC_FracDeadStripMap() .find(IdPhi) != m_rSummarySvc->RPC_FracDeadStripMap() .end()) FracDeadStripPhi = m_rSummarySvc->RPC_FracDeadStripMap ().find(IdPhi)->second ; - if( m_rSummarySvc->RPC_ProjectedTracksMap().find(IdEta) != m_rSummarySvc->RPC_ProjectedTracksMap().end()) RPC_ProjectedTracksEta = m_rSummarySvc->RPC_ProjectedTracksMap().find(IdEta)->second ; - + + if( readCdo->getFracDeadStripMap() .find(IdEta) != readCdo->getFracDeadStripMap() .end()) FracDeadStripEta = readCdo->getFracDeadStripMap().find(IdEta)->second ; + if( readCdo->getFracDeadStripMap() .find(IdPhi) != readCdo->getFracDeadStripMap() .end()) FracDeadStripPhi = readCdo->getFracDeadStripMap().find(IdPhi)->second ; + if( readCdo->getProjectedTracksMap().find(IdEta) != readCdo->getProjectedTracksMap().end()) RPC_ProjectedTracksEta = readCdo->getProjectedTracksMap().find(IdEta)->second ; - if( m_rSummarySvc->RPC_EfficiencyMap() .find(IdEta) != m_rSummarySvc->RPC_EfficiencyMap() .end()) EtaPanelEfficiency = m_rSummarySvc->RPC_EfficiencyMap ().find(IdEta)->second ; - if( m_rSummarySvc->RPC_EfficiencyMap() .find(IdPhi) != m_rSummarySvc->RPC_EfficiencyMap() .end()) PhiPanelEfficiency = m_rSummarySvc->RPC_EfficiencyMap ().find(IdPhi)->second ; - if( m_rSummarySvc->RPC_EfficiencyGapMap() .find(IdEta) != m_rSummarySvc->RPC_EfficiencyGapMap() .end()) GapEfficiency = m_rSummarySvc->RPC_EfficiencyGapMap ().find(IdEta)->second ; + if( readCdo->getEfficiencyMap() .find(IdEta) != readCdo->getEfficiencyMap() .end()) EtaPanelEfficiency = readCdo->getEfficiencyMap().find(IdEta)->second ; + if( readCdo->getEfficiencyMap() .find(IdPhi) != readCdo->getEfficiencyMap() .end()) PhiPanelEfficiency = readCdo->getEfficiencyMap().find(IdPhi)->second ; + if( readCdo->getEfficiencyGapMap() .find(IdEta) != readCdo->getEfficiencyGapMap() .end()) GapEfficiency = readCdo->getEfficiencyGapMap().find(IdEta)->second ; if (fabs(FracDeadStripEta-1.)<0.001) { @@ -1851,8 +1853,8 @@ StatusCode RpcDigitizationTool::DetectionEfficiency(const Identifier* IdEtaRpcSt int stripphigood = 0 ; */ - // if(m_rSummarySvc->RPC_DeadStripList().find( *IdEtaRpcStrip) != m_rSummarySvc->RPC_DeadStripList().end()) stripetadead = m_rSummarySvc->RPC_DeadStripList().find( *IdEtaRpcStrip)->second; // not used - // if(m_rSummarySvc->RPC_DeadStripList().find( *IdPhiRpcStrip) != m_rSummarySvc->RPC_DeadStripList().end()) stripphidead = m_rSummarySvc->RPC_DeadStripList().find( *IdPhiRpcStrip)->second; // not used + // if(readCdo->getDeadStripIntMap().find( *IdEtaRpcStrip) != readCdo->getDeadStripIntMap().end()) stripetadead = readCdo->getDeadStripIntMap().find( *IdEtaRpcStrip)->second; // not used + // if(readCdo->getDeadStripIntMap().find( *IdPhiRpcStrip) != readCdo->getDeadStripIntMap().end()) stripphidead = readCdo->getDeadStripIntMap().find( *IdPhiRpcStrip)->second; // not used // if( m_PanelId_OFF_fromlist && ( m_DeadPanel_fromlist.find(IdEta) != m_DeadPanel_fromlist.end()) ) stripetadead = m_DeadPanel_fromlist.find(IdEta)->second; // not used // if( m_PanelId_OFF_fromlist && ( m_DeadPanel_fromlist.find(IdPhi) != m_DeadPanel_fromlist.end()) ) stripphidead = m_DeadPanel_fromlist.find(IdPhi)->second; // not used @@ -2082,7 +2084,8 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const Identifier* IdRpcStrip, flo // float FracClusterSize1norm = 1 ; // not used float FracClusterSize2norm = 0 ; - + SG::ReadCondHandle<RpcCondDbData> readHandle{m_readKey}; + const RpcCondDbData* readCdo{*readHandle}; //2=BML,3=BMS,4=BOL,5=BOS,8=BMF,9=BOF,10=BOG int stationName = m_idHelper->stationName(*IdRpcStrip); @@ -2127,18 +2130,18 @@ int RpcDigitizationTool::ClusterSizeEvaluation(const Identifier* IdRpcStrip, flo int RPC_ProjectedTracks = 0; - if( m_rSummarySvc->RPC_ProjectedTracksMap().find(Id) != m_rSummarySvc->RPC_ProjectedTracksMap().end()) RPC_ProjectedTracks = m_rSummarySvc->RPC_ProjectedTracksMap().find(Id)->second ; + if( readCdo->getProjectedTracksMap().find(Id) != readCdo->getProjectedTracksMap().end()) RPC_ProjectedTracks = readCdo->getProjectedTracksMap().find(Id)->second ; - if(m_rSummarySvc->RPC_FracClusterSize1Map().find(Id) != m_rSummarySvc->RPC_FracClusterSize1Map().end()) FracClusterSize1 = float(m_rSummarySvc->RPC_FracClusterSize1Map().find(Id)->second) ; + if(readCdo->getFracClusterSize1Map().find(Id) != readCdo->getFracClusterSize1Map().end()) FracClusterSize1 = float(readCdo->getFracClusterSize1Map().find(Id)->second) ; else ATH_MSG_INFO ( "FracClusterSize1 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" default will be used") ; - if(m_rSummarySvc->RPC_FracClusterSize2Map().find(Id) != m_rSummarySvc->RPC_FracClusterSize2Map().end()) FracClusterSize2 = float(m_rSummarySvc->RPC_FracClusterSize2Map().find(Id)->second) ; + if(readCdo->getFracClusterSize2Map().find(Id) != readCdo->getFracClusterSize2Map().end()) FracClusterSize2 = float(readCdo->getFracClusterSize2Map().find(Id)->second) ; else ATH_MSG_INFO ( "FracClusterSize2 entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" default will be used") ; ATH_MSG_DEBUG ( "FracClusterSize1 and 2 "<< FracClusterSize1 << " " << FracClusterSize2 ); FracClusterSizeTail = 1. - FracClusterSize1 - FracClusterSize2 ; - if(m_rSummarySvc->RPC_MeanClusterSizeMap().find(Id) != m_rSummarySvc->RPC_MeanClusterSizeMap().end()) MeanClusterSize = float(m_rSummarySvc->RPC_MeanClusterSizeMap().find(Id)->second) ; + if(readCdo->getMeanClusterSizeMap().find(Id) != readCdo->getMeanClusterSizeMap().end()) MeanClusterSize = float(readCdo->getMeanClusterSizeMap().find(Id)->second) ; else ATH_MSG_INFO ( "MeanClusterSize entry not found for id = " <<m_idHelper->show_to_string(*IdRpcStrip)<<" default will be used") ; MeanClusterSizeTail = MeanClusterSize - FracClusterSize1 - 2*FracClusterSize2 ; @@ -2309,6 +2312,9 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { ATH_MSG_DEBUG ( "RpcDigitizationTool::in DumpRPCCalibFromCoolDB" ); + SG::ReadCondHandle<RpcCondDbData> readHandle{m_readKey}; + const RpcCondDbData* readCdo{*readHandle}; + StatusCode sc = StatusCode::SUCCESS; int NpanelEff0 = 0 ; @@ -2349,8 +2355,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { std::map <Identifier, float>::const_iterator itrf; std::map <Identifier, int>::const_iterator itri; - ATH_MSG_DEBUG ( "Size Summary RPC_EfficiencyMap: " << m_rSummarySvc->RPC_EfficiencyMap().size() ); - for (itr=m_rSummarySvc->RPC_EfficiencyMap().begin(); itr!=m_rSummarySvc->RPC_EfficiencyMap().end(); ++itr) { + ATH_MSG_DEBUG ( "Size Summary RPC_EfficiencyMap: " << readCdo->getEfficiencyMap().size() ); + for (itr=readCdo->getEfficiencyMap().begin(); itr!=readCdo->getEfficiencyMap().end(); ++itr) { if( itr->second == 0. )NpanelEff0++ ; if( itr->second < 0.5 )NpanelEffLess05++ ; if( itr->second < 1. )NpanelEffLess1++ ; @@ -2362,8 +2368,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_EfficiencyGapMap: " << m_rSummarySvc->RPC_EfficiencyGapMap().size() ); - for (itr=m_rSummarySvc->RPC_EfficiencyGapMap().begin(); itr!=m_rSummarySvc->RPC_EfficiencyGapMap().end(); ++itr) { + ATH_MSG_DEBUG ( "Size Summary RPC_EfficiencyGapMap: " << readCdo->getEfficiencyGapMap().size() ); + for (itr=readCdo->getEfficiencyGapMap().begin(); itr!=readCdo->getEfficiencyGapMap().end(); ++itr) { ATH_MSG_DEBUG ( "Summary Id/RPC_EfficiencyGapMap: " << itr->first <<" i.e. " <<(itr->first).get_identifier32().get_compact()<<" " @@ -2371,8 +2377,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_MeanClusterSizeMap: " << m_rSummarySvc->RPC_MeanClusterSizeMap().size() ); - for (itr=m_rSummarySvc->RPC_MeanClusterSizeMap().begin(); itr!=m_rSummarySvc->RPC_MeanClusterSizeMap().end(); ++itr) { + ATH_MSG_DEBUG ( "Size Summary RPC_MeanClusterSizeMap: " << readCdo->getMeanClusterSizeMap().size() ); + for (itr=readCdo->getMeanClusterSizeMap().begin(); itr!=readCdo->getMeanClusterSizeMap().end(); ++itr) { if( itr->second == 1.0 )NpanelCSEq1++ ; if( itr->second < 1.5 )NpanelCSLess15++ ; if( itr->second < 2.0 )NpanelCSLess20++ ; @@ -2385,8 +2391,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_FracClusterSize1Map: " << m_rSummarySvc->RPC_FracClusterSize1Map().size() ); - for (itr=m_rSummarySvc->RPC_FracClusterSize1Map().begin(); itr!=m_rSummarySvc->RPC_FracClusterSize1Map().end(); ++itr) { + ATH_MSG_DEBUG ( "Size Summary RPC_FracClusterSize1Map: " << readCdo->getFracClusterSize1Map().size() ); + for (itr=readCdo->getFracClusterSize1Map().begin(); itr!=readCdo->getFracClusterSize1Map().end(); ++itr) { ATH_MSG_DEBUG ( "Summary Id/RPC_FracClusterSize1Map: " << itr->first <<" i.e. " <<(itr->first).get_identifier32().get_compact()<<" " @@ -2394,8 +2400,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_FracClusterSize2Map: " << m_rSummarySvc->RPC_FracClusterSize2Map().size() ); - for (itr=m_rSummarySvc->RPC_FracClusterSize2Map().begin(); itr!=m_rSummarySvc->RPC_FracClusterSize2Map().end(); ++itr) { + ATH_MSG_DEBUG ( "Size Summary RPC_FracClusterSize2Map: " << readCdo->getFracClusterSize2Map().size() ); + for (itr=readCdo->getFracClusterSize2Map().begin(); itr!=readCdo->getFracClusterSize2Map().end(); ++itr) { ATH_MSG_DEBUG ( "Summary Id/RPC_FracClusterSize2Map: " << itr->first <<" i.e. " <<(itr->first).get_identifier32().get_compact()<<" " @@ -2403,8 +2409,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_DeadStripListMap: " << m_rSummarySvc->RPC_DeadStripListMap().size() ); - for (itrs=m_rSummarySvc->RPC_DeadStripListMap().begin(); itrs!=m_rSummarySvc->RPC_DeadStripListMap().end(); ++itrs) { + ATH_MSG_DEBUG ( "Size Summary RPC_DeadStripListMap: " << readCdo->getDeadStripMap().size() ); + for (itrs=readCdo->getDeadStripMap().begin(); itrs!=readCdo->getDeadStripMap().end(); ++itrs) { if(itrs->second.size()== 8){ NpanelWith8Strip++; } else if(itrs->second.size()==16){ NpanelWith16Strip++; } else if(itrs->second.size()==24){ NpanelWith24Strip++; } @@ -2422,40 +2428,40 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { } - ATH_MSG_DEBUG ( "Size Summary RPC_FracDeadStripMap: " << m_rSummarySvc->RPC_FracDeadStripMap().size() ); - for (itrf=m_rSummarySvc->RPC_FracDeadStripMap().begin(); itrf!=m_rSummarySvc->RPC_FracDeadStripMap().end(); ++itrf) { - if( itrf->second == 0. )NpanelFracDead0++ ; - if( itrf->second < 0.5 )NpanelFracDeadLess05++ ; - if( itrf->second < 1. )NpanelFracDeadLess1++ ; - if( itrf->second == 1. )NpanelFracDead1++ ; - - ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: " << itrf->first << " i.e. " - <<(itrf->first).get_identifier32().get_compact()<<" " - <<m_idHelper->show_to_string(itrf->first)<< " " - << itrf->second ); - if (itrf->second > 0.50) { - if (itrf->second <= 0.75) - ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >50% and <=75% " << itrf->first << " i.e. " - <<(itrf->first).get_identifier32().get_compact()<<" " - <<m_idHelper->show_to_string(itrf->first)<< " " - << itrf->second ); - else if (itrf->second > 0.75) { - if (itrf->second <= 0.90) - ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >75% and <=90% " << itrf->first << " i.e. " - <<(itrf->first).get_identifier32().get_compact()<<" " - <<m_idHelper->show_to_string(itrf->first)<< " " - << itrf->second ); - else if (itrf->second > 0.90) ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >90% " << itrf->first << " i.e. " - <<(itrf->first).get_identifier32().get_compact()<<" " - <<m_idHelper->show_to_string(itrf->first)<< " " - << itrf->second ); + ATH_MSG_DEBUG ( "Size Summary RPC_FracDeadStripMap: " << readCdo->getFracDeadStripMap().size() ); + for (itr=readCdo->getFracDeadStripMap().begin(); itr!=readCdo->getFracDeadStripMap().end(); ++itr) { + if( itr->second == 0. )NpanelFracDead0++ ; + if( itr->second < 0.5 )NpanelFracDeadLess05++ ; + if( itr->second < 1. )NpanelFracDeadLess1++ ; + if( itr->second == 1. )NpanelFracDead1++ ; + + ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: " << itr->first << " i.e. " + <<(itr->first).get_identifier32().get_compact()<<" " + <<m_idHelper->show_to_string(itr->first)<< " " + << itr->second ); + if (itr->second > 0.50) { + if (itr->second <= 0.75) + ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >50% and <=75% " << itr->first << " i.e. " + <<(itr->first).get_identifier32().get_compact()<<" " + <<m_idHelper->show_to_string(itr->first)<< " " + << itr->second ); + else if (itr->second > 0.75) { + if (itr->second <= 0.90) + ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >75% and <=90% " << itr->first << " i.e. " + <<(itr->first).get_identifier32().get_compact()<<" " + <<m_idHelper->show_to_string(itr->first)<< " " + << itr->second ); + else if (itr->second > 0.90) ATH_MSG_DEBUG ( "Summary Id/RPC_FracDeadStripMap: panel with fraction of dead strips >90% " << itr->first << " i.e. " + <<(itr->first).get_identifier32().get_compact()<<" " + <<m_idHelper->show_to_string(itr->first)<< " " + << itr->second ); } } } - ATH_MSG_DEBUG ( "Size Summary RPC_ProjectedTracksMap: " << m_rSummarySvc->RPC_ProjectedTracksMap().size() ); - for (itri=m_rSummarySvc->RPC_ProjectedTracksMap().begin(); itri!=m_rSummarySvc->RPC_ProjectedTracksMap().end(); ++itri) { + ATH_MSG_DEBUG ( "Size Summary RPC_ProjectedTracksMap: " << readCdo->getProjectedTracksMap().size() ); + for (itri=readCdo->getProjectedTracksMap().begin(); itri!=readCdo->getProjectedTracksMap().end(); ++itri) { if(itri->second< 500) NpanelTrackLess500++; if(itri->second< 100) NpanelTrackLess100++; if(itri->second< 50) NpanelTrackLess50++; @@ -2467,8 +2473,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { <<m_idHelper->show_to_string(itri->first)<< " " << itri->second ); } - ATH_MSG_DEBUG ( "Size Summary RPC_DeadStripList: " << m_rSummarySvc->RPC_DeadStripList().size() ); - for (itri=m_rSummarySvc->RPC_DeadStripList().begin(); itri!=m_rSummarySvc->RPC_DeadStripList().end(); ++itri) { + ATH_MSG_DEBUG ( "Size Summary RPC_DeadStripList: " << readCdo->getDeadStripIntMap().size() ); + for (itri=readCdo->getDeadStripIntMap().begin(); itri!=readCdo->getDeadStripIntMap().end(); ++itri) { ATH_MSG_DEBUG ( "Summary Id/RPC_DeadStripList: " << itri->first << " i.e. " <<(itri->first).get_identifier32().get_compact()<<" " <<m_idHelper->show_to_string(itri->first)<< " " @@ -2562,18 +2568,18 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { - if( m_rSummarySvc->RPC_EfficiencyMap ().find(atlasIdEta)!= m_rSummarySvc->RPC_EfficiencyMap().end() ) efficiencyEta = m_rSummarySvc->RPC_EfficiencyMap ().find(atlasIdEta)->second ; - if( m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasIdEta)!= m_rSummarySvc->RPC_MeanClusterSizeMap().end() ) averageCSEta = m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasIdEta)->second ; - if( m_rSummarySvc->RPC_FracClusterSize1Map ().find(atlasIdEta)!= m_rSummarySvc->RPC_FracClusterSize1Map().end() ) FracCS1Eta = m_rSummarySvc->RPC_FracClusterSize1Map().find(atlasIdEta)->second ; - if( m_rSummarySvc->RPC_FracClusterSize2Map ().find(atlasIdEta)!= m_rSummarySvc->RPC_FracClusterSize2Map().end() ) FracCS2Eta = m_rSummarySvc->RPC_FracClusterSize2Map().find(atlasIdEta)->second ; + if( readCdo->getEfficiencyMap ().find(atlasIdEta)!= readCdo->getEfficiencyMap().end() ) efficiencyEta = readCdo->getEfficiencyMap ().find(atlasIdEta)->second ; + if( readCdo->getMeanClusterSizeMap ().find(atlasIdEta)!= readCdo->getMeanClusterSizeMap().end() ) averageCSEta = readCdo->getMeanClusterSizeMap ().find(atlasIdEta)->second ; + if( readCdo->getFracClusterSize1Map ().find(atlasIdEta)!= readCdo->getFracClusterSize1Map().end() ) FracCS1Eta = readCdo->getFracClusterSize1Map().find(atlasIdEta)->second ; + if( readCdo->getFracClusterSize2Map ().find(atlasIdEta)!= readCdo->getFracClusterSize2Map().end() ) FracCS2Eta = readCdo->getFracClusterSize2Map().find(atlasIdEta)->second ; FracCStailEta = 1.-FracCS1Eta-FracCS2Eta ; - if( m_rSummarySvc->RPC_ProjectedTracksMap ().find(atlasIdEta)!= m_rSummarySvc->RPC_ProjectedTracksMap().end() ) ProjectedTracksEta= m_rSummarySvc->RPC_ProjectedTracksMap ().find(atlasIdEta)->second ; - if( m_rSummarySvc->RPC_EfficiencyGapMap ().find(atlasIdEta)!= m_rSummarySvc->RPC_EfficiencyGapMap().end() ) efficiencygapEta = m_rSummarySvc->RPC_EfficiencyGapMap ().find(atlasIdEta)->second ; + if( readCdo->getProjectedTracksMap ().find(atlasIdEta)!= readCdo->getProjectedTracksMap().end() ) ProjectedTracksEta= readCdo->getProjectedTracksMap ().find(atlasIdEta)->second ; + if( readCdo->getEfficiencyGapMap ().find(atlasIdEta)!= readCdo->getEfficiencyGapMap().end() ) efficiencygapEta = readCdo->getEfficiencyGapMap ().find(atlasIdEta)->second ; - if( m_rSummarySvc->RPC_EfficiencyMap ().find(atlasIdPhi)!= m_rSummarySvc->RPC_EfficiencyMap().end() ) efficiencyPhi = m_rSummarySvc->RPC_EfficiencyMap ().find(atlasIdPhi)->second ; - if( m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasIdPhi)!= m_rSummarySvc->RPC_MeanClusterSizeMap().end() ) averageCSPhi = m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasIdPhi)->second ; - if( m_rSummarySvc->RPC_FracClusterSize1Map ().find(atlasIdPhi)!= m_rSummarySvc->RPC_FracClusterSize1Map().end() ) FracCS1Phi = m_rSummarySvc->RPC_FracClusterSize1Map().find(atlasIdPhi)->second ; - if( m_rSummarySvc->RPC_FracClusterSize2Map ().find(atlasIdPhi)!= m_rSummarySvc->RPC_FracClusterSize2Map().end() ) FracCS2Phi = m_rSummarySvc->RPC_FracClusterSize2Map().find(atlasIdPhi)->second ; + if( readCdo->getEfficiencyMap ().find(atlasIdPhi)!= readCdo->getEfficiencyMap().end() ) efficiencyPhi = readCdo->getEfficiencyMap ().find(atlasIdPhi)->second ; + if( readCdo->getMeanClusterSizeMap ().find(atlasIdPhi)!= readCdo->getMeanClusterSizeMap().end() ) averageCSPhi = readCdo->getMeanClusterSizeMap ().find(atlasIdPhi)->second ; + if( readCdo->getFracClusterSize1Map ().find(atlasIdPhi)!= readCdo->getFracClusterSize1Map().end() ) FracCS1Phi = readCdo->getFracClusterSize1Map().find(atlasIdPhi)->second ; + if( readCdo->getFracClusterSize2Map ().find(atlasIdPhi)!= readCdo->getFracClusterSize2Map().end() ) FracCS2Phi = readCdo->getFracClusterSize2Map().find(atlasIdPhi)->second ; FracCStailPhi = 1.-FracCS1Phi-FracCS2Phi ; if((ProjectedTracksEta>=m_CutProjectedTracks)&&(ProjectedTracksEta<10000000)&&(ProjectedTracksEta>=m_CutProjectedTracks)&&(efficiencyEta>0)&&(efficiencyEta<=1)&&(efficiencygapEta>0)&&(efficiencygapEta<=1)&&(efficiencyPhi>0)&&(efficiencyPhi<=1)){ @@ -2737,20 +2743,20 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { Identifier atlasId = m_idHelper->channelID(idr, doubletZ,doubletPhi , gasGap, measphi, 1) ; if(atlasId == 0 )continue; - if(m_rSummarySvc->RPC_EfficiencyMap().find(atlasId)->second == 1){ - ATH_MSG_VERBOSE ( "Effi RPC panel = 1: " <<m_rSummarySvc->RPC_DeadStripListMap().find(atlasId)->second<<" "<<m_rSummarySvc->RPC_ProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); + if(readCdo->getEfficiencyMap().find(atlasId)->second == 1){ + ATH_MSG_VERBOSE ( "Effi RPC panel = 1: " <<readCdo->getDeadStripMap().find(atlasId)->second<<" "<<readCdo->getProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); } - if(m_rSummarySvc->RPC_EfficiencyMap().find(atlasId)->second == 0){ - ATH_MSG_VERBOSE ( "Effi RPC panel = 0: " <<m_rSummarySvc->RPC_DeadStripListMap().find(atlasId)->second<<" "<<m_rSummarySvc->RPC_ProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); + if(readCdo->getEfficiencyMap().find(atlasId)->second == 0){ + ATH_MSG_VERBOSE ( "Effi RPC panel = 0: " <<readCdo->getDeadStripMap().find(atlasId)->second<<" "<<readCdo->getProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); } - if(m_rSummarySvc->RPC_EfficiencyGapMap().find(atlasId)->second == 0){ - ATH_MSG_VERBOSE ( "EffiGap RPC panel = 0: " <<m_rSummarySvc->RPC_DeadStripListMap().find(atlasId)->second<<" "<<m_rSummarySvc->RPC_ProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); + if(readCdo->getEfficiencyGapMap().find(atlasId)->second == 0){ + ATH_MSG_VERBOSE ( "EffiGap RPC panel = 0: " <<readCdo->getDeadStripMap().find(atlasId)->second<<" "<<readCdo->getProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); } - if(m_rSummarySvc->RPC_MeanClusterSizeMap().find(atlasId)->second > 3 ){ - ATH_MSG_VERBOSE ( "MeanClusterSize RPC panel > 3: " <<m_rSummarySvc->RPC_MeanClusterSizeMap().find(atlasId)->second<<" "<<m_rSummarySvc->RPC_ProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); + if(readCdo->getMeanClusterSizeMap().find(atlasId)->second > 3 ){ + ATH_MSG_VERBOSE ( "MeanClusterSize RPC panel > 3: " <<readCdo->getMeanClusterSizeMap().find(atlasId)->second<<" "<<readCdo->getProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); } - if(m_rSummarySvc->RPC_FracDeadStripMap().find(atlasId)->second == 1){ - ATH_MSG_VERBOSE ( "Dead RPC panel: " <<m_rSummarySvc->RPC_DeadStripListMap().find(atlasId)->second<<" "<<m_rSummarySvc->RPC_ProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); + if(readCdo->getFracDeadStripMap().find(atlasId)->second == 1){ + ATH_MSG_VERBOSE ( "Dead RPC panel: " <<readCdo->getDeadStripMap().find(atlasId)->second<<" "<<readCdo->getProjectedTracksMap().find(atlasId)->second<<" sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi); } if(m_DeadPanel_fromlist.find(atlasId)->second == 1){ @@ -2789,15 +2795,15 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { int ProjectedTracks = 0. ; float FracDeadStrip = 0. ; - if( m_rSummarySvc->RPC_EfficiencyMap ().find(atlasId)!= m_rSummarySvc->RPC_EfficiencyMap().end() ) efficiency = m_rSummarySvc->RPC_EfficiencyMap ().find(atlasId)->second ; - if( m_rSummarySvc->RPC_EfficiencyGapMap ().find(atlasId)!= m_rSummarySvc->RPC_EfficiencyGapMap().end() ) efficiencygap = m_rSummarySvc->RPC_EfficiencyGapMap ().find(atlasId)->second ; - if( m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasId)!= m_rSummarySvc->RPC_MeanClusterSizeMap().end() ) averageCS = m_rSummarySvc->RPC_MeanClusterSizeMap ().find(atlasId)->second ; - if( m_rSummarySvc->RPC_FracClusterSize1Map ().find(atlasId)!= m_rSummarySvc->RPC_FracClusterSize1Map().end() ) FracCS1 = m_rSummarySvc->RPC_FracClusterSize1Map().find(atlasId)->second ; - if( m_rSummarySvc->RPC_FracClusterSize2Map ().find(atlasId)!= m_rSummarySvc->RPC_FracClusterSize2Map().end() ) FracCS2 = m_rSummarySvc->RPC_FracClusterSize2Map().find(atlasId)->second ; + if( readCdo->getEfficiencyMap ().find(atlasId)!= readCdo->getEfficiencyMap().end() ) efficiency = readCdo->getEfficiencyMap ().find(atlasId)->second ; + if( readCdo->getEfficiencyGapMap ().find(atlasId)!= readCdo->getEfficiencyGapMap().end() ) efficiencygap = readCdo->getEfficiencyGapMap ().find(atlasId)->second ; + if( readCdo->getMeanClusterSizeMap ().find(atlasId)!= readCdo->getMeanClusterSizeMap().end() ) averageCS = readCdo->getMeanClusterSizeMap ().find(atlasId)->second ; + if( readCdo->getFracClusterSize1Map ().find(atlasId)!= readCdo->getFracClusterSize1Map().end() ) FracCS1 = readCdo->getFracClusterSize1Map().find(atlasId)->second ; + if( readCdo->getFracClusterSize2Map ().find(atlasId)!= readCdo->getFracClusterSize2Map().end() ) FracCS2 = readCdo->getFracClusterSize2Map().find(atlasId)->second ; FracCStail = 1.0-FracCS1-FracCS2 ; averageCStail = averageCS - FracCS1 - 2*FracCS2 ; - if( m_rSummarySvc->RPC_ProjectedTracksMap ().find(atlasId)!= m_rSummarySvc->RPC_ProjectedTracksMap().end() ) ProjectedTracks= m_rSummarySvc->RPC_ProjectedTracksMap ().find(atlasId)->second ; - if( m_rSummarySvc->RPC_FracDeadStripMap ().find(atlasId)!= m_rSummarySvc->RPC_FracDeadStripMap ().end() ) FracDeadStrip = m_rSummarySvc->RPC_FracDeadStripMap ().find(atlasId)->second ; + if( readCdo->getProjectedTracksMap ().find(atlasId)!= readCdo->getProjectedTracksMap().end() ) ProjectedTracks= readCdo->getProjectedTracksMap ().find(atlasId)->second ; + if( readCdo->getFracDeadStripMap ().find(atlasId)!= readCdo->getFracDeadStripMap ().end() ) FracDeadStrip = readCdo->getFracDeadStripMap ().find(atlasId)->second ; if(ProjectedTracks<m_CutProjectedTracks || ProjectedTracks>10000000 || efficiency<=0 || efficiency>1 || efficiencygap<=0 || efficiencygap>1 ){ if( stationEta >= 0){ @@ -2846,7 +2852,7 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { }}}}}}}} - ATH_MSG_VERBOSE( "Number of dead strip " << m_rSummarySvc->RPC_DeadStripList ().size() ); + ATH_MSG_VERBOSE( "Number of dead strip " << readCdo->getDeadStripMap().size() ); for( int stationName = 2 ; stationName !=11; stationName++){ for( int stationEta = -7 ; stationEta != 8; stationEta++ ){ for( int stationPhi = 1 ; stationPhi != 9; stationPhi++ ){ @@ -2863,8 +2869,8 @@ StatusCode RpcDigitizationTool::DumpRPCCalibFromCoolDB() { if(idr == 0 )continue; Identifier atlasId = m_idHelper->channelID(idr, doubletZ,doubletPhi , gasGap, measphi, strip) ; if(atlasId == 0 )continue; - //if( m_rSummarySvc->RPC_DeadStripList().find(atlasId).empty() )continue; - int stripstatus = m_rSummarySvc->RPC_DeadStripList ().find(atlasId)->second ; + //if( readCdo->getDeadStripIntMap().find(atlasId).empty() )continue; + int stripstatus = readCdo->getDeadStripIntMap ().find(atlasId)->second ; if( stripstatus != 1 )continue; ATH_MSG_VERBOSE( "Identifier " << atlasId << " sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi<<" strip "<<strip << " stripstatus "<<stripstatus ); //std::cout<<"Identifier " << atlasId << " sName "<<stationName<<" sEta " <<stationEta<<" sPhi "<<stationPhi<<" dR "<<doubletR<<" dZ "<<doubletZ<<" dPhi "<<doubletPhi<<" Gap "<<gasGap<<" view "<<measphi<<" strip "<<strip << " stripstatus "<<stripstatus << std::endl; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py index 4949f80c539b5824f921fc4559af429ffbd05594..f767d07f9594c232ac556180c46d6a6a440d8d61 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonPrdProviderToolsConfig.py @@ -3,6 +3,7 @@ from AthenaCommon.Include import include from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags source = globalflags.DataSource() @@ -32,6 +33,8 @@ def RpcPrepDataProviderTool(name="RpcPrepDataProviderTool",**kwargs): raise ValueError( "RpcPrepDataProviderTool: unsupported dataSource %s" % source ) from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool + if athenaCommonFlags.isOnline: + kwargs["ReadKey"] = "" return Muon__RpcRdoToPrepDataTool(name,**kwargs) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py index cb8e09747829002593f7d0e6559bd63182055e00..12d12baf888767209beb69a49741b38855f14b0b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py @@ -8,6 +8,9 @@ from AthenaCommon.CfgGetter import addTool, addToolClone, addService, addAlgorit from AthenaCommon.Constants import * # FATAL,ERROR etc. +## MT-safe conditions access +import MuonCondAlg.AllCondDbAlgConfig + addNamesToSkipIfNotAvailable( "MuonIsolationTool" ) addTypesOnlyToSkip( "ICaloNoiseTool" ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py index 29aad7a08cfe94c13f423ff096a7a489f9e11d39..899f990cf9e9885a47b2a0ec1263480c7bc21f30 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py @@ -25,6 +25,9 @@ from RecExConfig.RecAlgsFlags import recAlgs from MuonRecExample.MuonAlignFlags import muonAlignFlags from AthenaCommon.AppMgr import ToolSvc +## MT-safe conditions access +import MuonCondAlg.AllCondDbAlgConfig + muonRecFlags.setDefaults() topSequence = AlgSequence() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index a0fbd12ffdbeef51661756288e3402548e682a00..32f51f3db20e11124fa06643809d1f69fc4e4c4f 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -4,6 +4,7 @@ from AthenaCommon.Logging import logging from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags log = logging.getLogger('MuonSetup') ### Output data name ### @@ -154,6 +155,8 @@ def makeMuonPrepDataAlgs(forFullScan=False): from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name = "RpcRdoToPrepDataTool") + if athenaCommonFlags.isOnline: + RpcRdoToRpcPrepDataTool.ReadKey = "" ToolSvc += RpcRdoToRpcPrepDataTool @@ -310,6 +313,8 @@ def muFastRecoSequence( RoIs ): OutputCollection = MuonRpcRawDataProviderTool.RdoLocation, TriggerOutputCollection = "RPC_Measurements_L2SA", InputCollection = "RPC_triggerHits_L2SA") + if athenaCommonFlags.isOnline: + RpcRdoToRpcPrepDataTool.ReadKey = "" ToolSvc += RpcRdoToRpcPrepDataTool from TrigL2MuonSA.TrigL2MuonSAConf import TrigL2MuonSA__RpcDataPreparator