diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/CMakeLists.txt b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/CMakeLists.txt index 3ba3f4e4cd8cb665e4d711b344fb7bc6a3c113d3..a16d54d91a571bc4937b9a5b81c58131cb42ce05 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools MuonSpectrometer/MuonCnv/MuonCSC_CnvTools MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonRDO ) @@ -29,7 +30,7 @@ atlas_add_component( CscCalibAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests GaudiKernel CscCalibData MuonCondInterface MuonReadoutGeometry MuonIdHelpersLib MuonRDO ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthContainers StoreGateLib SGtests GaudiKernel CscCalibData MuonCondInterface MuonCondData MuonReadoutGeometry MuonIdHelpersLib MuonRDO ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx index fe90cab6e700d3e74a7469bbfe896f332939407a..f303cd0027c6060378bb9c84229e7b62184ad9a9 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -40,7 +40,6 @@ namespace MuonCalib { CscCalcPed::CscCalcPed(const string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), m_chronoSvc(0), - m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder"), m_maxStripHash(0), m_numBits(12), @@ -115,11 +114,7 @@ namespace MuonCalib { ATH_CHECK(m_idHelperSvc.retrieve()); - if(m_cscCoolStrSvc.retrieve().isFailure()) - { - mLog << MSG::FATAL << "Unable to retrieve CscCoolStrSvc" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_readKey.initialize()); StatusCode sc = service("ChronoStatSvc",m_chronoSvc); if(sc.isFailure()) @@ -800,6 +795,9 @@ namespace MuonCalib { if(m_debug) mLog << MSG::DEBUG << "Begining loop over all " << m_peds->size() << " channels data was collected for." << endmsg; + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + //form is:hashID chamber LayerOrientationStrip parametervalue parametervalue CscCalibResultCollection::iterator pedItr = m_peds->begin(); CscCalibResultCollection::iterator pedEnd = m_peds->end(); @@ -818,7 +816,7 @@ namespace MuonCalib { string onlineHexId; //Online ids are same as "string ids" used internally in COOL db. - m_cscCoolStrSvc->indexToStringId(hashId, "CHANNEL", onlineHexId); + readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", onlineHexId); if(m_debug) mLog << MSG::DEBUG << "we're on hash " << hashId << " with pedestal " << ped << "and noise " << noise << endmsg;//<< " and threshold " << thold << endmsg; @@ -891,6 +889,9 @@ namespace MuonCalib { //Outputs a single parameter in version 03-00 void CscCalcPed::outputParameter3(const CscCalibResultCollection & results, ofstream & out){ + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + out << "\n"; out << "<NEW_PAR> " << results.parName() << "\n"; std::string idString; @@ -902,7 +903,7 @@ namespace MuonCalib { double value = (*resItr)->value(); std::string idString; - m_cscCoolStrSvc->indexToStringId(hashId, "CHANNEL", idString); + readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", idString); out << idString << " " << value << "\n"; } diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h index d03127a57c10eee4e2328a0f48bac6916c64f5a1..d3c10369f4f7df1c8757eefdc8f8f645b7c5eb49 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CSCCALCPED_H @@ -24,12 +24,13 @@ an RDO #include "TH1.h" #include "TH2.h" #include "TH2F.h" -#include "MuonCondInterface/CscICoolStrSvc.h" +#include "MuonCondData/CscCondDbData.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" class cscIdHelper; class TFile; class IdentifierHash; +class CscCondDbData; //class ICscCalibTool; namespace Muon { @@ -105,9 +106,9 @@ namespace MuonCalib{ // ICscCalibTool * m_cscCalibTool; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; IChronoStatSvc* m_chronoSvc; - ServiceHandle<CscICoolStrSvc> m_cscCoolStrSvc; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool; - + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; + /**Parameters input through joboptions*/ std::string m_outputFileName; diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx index d30994e0425a310319cf4c04560b19baae1894b0..18d5ca12a1928c58798fe5b2d58d082d8c6b637b 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/MsgStream.h" @@ -48,7 +48,6 @@ namespace MuonCalib { AthAlgorithm(name,pSvcLocator), m_storeGate(NULL), m_cscCalibTool(NULL), - m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc",name), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder"), m_chronoSvc(NULL), m_outputFileName("output.cal"), @@ -340,11 +339,7 @@ cerr << "done init services" << endl; } else { - if(m_cscCoolStrSvc.retrieve().isFailure()) - { - mLog << MSG::FATAL << "Unable to retrieve CscCoolStrSvc" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_readKey.initialize()); } /*for(unsigned int stripItr = 0 ; stripItr < m_maxStripHash+1; stripItr++) @@ -460,8 +455,11 @@ cerr << "done init services" << endl; { mLog << MSG::FATAL << "Could not find event" << endmsg; return StatusCode::FAILURE; - } + } + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + // mLog << MSG::INFO <<"Got raw data " << endmsg; //Loop over RODs (data from 2 chambers), each of which is in //a single CscRawaData collection @@ -582,8 +580,7 @@ cerr << "done init services" << endl; } else{ - if(StatusCode::SUCCESS != m_cscCoolStrSvc->getParameter(ped,"ped",stripHash)) - { + if(!readCdo->readChannelPed(stripHash, ped).isSuccess()){ ped = 2054; mLog << (m_ignoreDatabaseError ? MSG::WARNING : MSG::ERROR) << "Failed at getting pedestal from COOL for hash " << stripHash << endmsg; @@ -593,8 +590,7 @@ cerr << "done init services" << endl; } else mLog << MSG::VERBOSE << "Got pedestal of " << ped << endmsg; - if(StatusCode::SUCCESS != m_cscCoolStrSvc->getParameter( - noise, "noise", stripHash)) + if(!readCdo->readChannelNoise(stripHash, noise).isSuccess()) { noise = .001; mLog << (m_ignoreDatabaseError ? MSG::WARNING : MSG::ERROR) << "Failed at getting noise from COOL for hash " << stripHash << endmsg; @@ -1129,6 +1125,9 @@ cerr << "done init services" << endl; mLog << MSG::INFO << "Printing out parameter " << results.parName() << endmsg; + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + out << "\n"; out << "<NEW_PAR> " << results.parName() << "\n"; std::string idString; @@ -1140,7 +1139,7 @@ cerr << "done init services" << endl; double value = (*resItr)->value(); std::string idString; - m_cscCoolStrSvc->indexToStringId(hashId, "CHANNEL", idString); + readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", idString); out << idString << " " << value << "\n"; } diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h index 13dbe18dcb33aa4195e8d6f4fdf663fd5ee75603..7a51e21c4f6ed929bb7ad07995551cc60bb9ba1f 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcSlope.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CSCCALCSLOPE_H @@ -20,6 +20,7 @@ so that he can determine the validity of the constants #include "AthContainers/DataVector.h" #include "CscCalibData/CscCalibResultCollection.h" #include "MuonCSC_CnvTools/ICSC_RDO_Decoder.h" +#include "MuonCondData/CscCondDbData.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" //temporary for tests @@ -38,6 +39,7 @@ class ICscCalibTool; class cscIdHelper; class CscCalibResultCollection; class TGraphErrors; +class CscCondDbData; namespace MuonCalib{ /** @@ -85,10 +87,10 @@ namespace MuonCalib{ StoreGateSvc * m_storeGate; //ITHistSvc * m_thistSvc; ICscCalibTool * m_cscCalibTool; - ServiceHandle<CscICoolStrSvc> m_cscCoolStrSvc; ToolHandle<Muon::ICSC_RDO_Decoder> m_cscRdoDecoderTool; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; IChronoStatSvc* m_chronoSvc; + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; /**Parameters input through joboptions*/ std::string m_outputFileName; diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.cxx index 848dbd1042c396ca78482550ce76cd374a501d94..c8567e0cea0b59e4e306be8aa64528a4015accdf 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.cxx @@ -1,23 +1,19 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/** Author: Ketevi A. Assamagan */ - #include "CscCalibTool.h" #include "StoreGate/DataHandle.h" #include <sstream> #include <cmath> -using namespace MuonCalib; using std::ostringstream; using std::setw; CscCalibTool::CscCalibTool ( const std::string& t, const std::string& n, const IInterface* p ) - : base_class(t,n,p), - m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc", n) + : base_class(t,n,p) { declareProperty( "Slope", m_slope = 0.19 ); declareProperty( "Noise", m_noise = 3.5 ); @@ -100,11 +96,8 @@ StatusCode CscCalibTool::initialize() { if (m_onlineHLT) { ATH_MSG_DEBUG( "T0BaseFolder and T0PhaseFolder are not loaded!!! HLT COOLDB does not have it!!"); } - - if ( m_cscCoolStrSvc.retrieve().isFailure() ) { - ATH_MSG_FATAL ( "Unable to retrieve pointer to the CSC COLL Conditions Service" ); - return StatusCode::FAILURE; - } + + ATH_CHECK(m_readKey.initialize()); m_messageCnt_t0base=0; m_messageCnt_t0phase=0; @@ -121,10 +114,12 @@ float CscCalibTool::getPSlope(uint32_t stripHashId) const { float slope = m_slope; if ( m_readFromDatabase && m_slopeFromDatabase ) { - if ( !m_cscCoolStrSvc->getSlope(slope,stripHashId) ) { - ATH_MSG_WARNING ( " failed to access CSC conditions database - slope - " - << "strip hash id = " << stripHashId ); - } + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelPSlope(stripHashId, slope).isSuccess()){ + ATH_MSG_WARNING ( " failed to access CSC conditions database - slope - " + << "strip hash id = " << stripHashId ); + } } ATH_MSG_DEBUG ( "The slope is " << slope << " for strip hash = " << stripHashId ); @@ -174,7 +169,9 @@ double CscCalibTool::stripNoise ( uint32_t stripHashId, const bool convert ) con float noise = m_noise; /// ADC counts if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getNoise(noise,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelNoise(stripHashId, noise).isSuccess()){ ATH_MSG_DEBUG ( " failed to access CSC conditions database - noise - " << "strip hash id = " << stripHashId ); noise = m_noise; @@ -199,7 +196,9 @@ double CscCalibTool::stripRMS ( uint32_t stripHashId, const bool convert ) const float rms = m_noise; /// ADC counts initialized with m_noise... if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getRMS(rms,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelRMS(stripHashId, rms).isSuccess()){ ATH_MSG_DEBUG ( " failed to access CSC conditions database - rms - " << "strip hash id = " << stripHashId ); rms = m_noise; @@ -225,7 +224,9 @@ double CscCalibTool::stripF001 ( uint32_t stripHashId, const bool convert ) cons float f001 = m_noise+m_pedestal; /// ADC counts initialized with m_noise... if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getF001(f001,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelF001(stripHashId, f001).isSuccess()){ ATH_MSG_DEBUG ( " failed to access CSC conditions database - f001 - " << "strip hash id = " << stripHashId ); f001 = 3.251*m_noise+m_pedestal; @@ -249,7 +250,9 @@ double CscCalibTool::stripPedestal ( uint32_t stripHashId, const bool convert ) float pedestal = m_pedestal; if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getPedestal(pedestal,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){ ATH_MSG_DEBUG ( " failed to access CSC conditions database - pedestal - " << "strip hash id = " << stripHashId ); pedestal = m_pedestal; @@ -280,25 +283,17 @@ bool CscCalibTool::isGood ( uint32_t stripHashId ) const int CscCalibTool::stripStatusBit ( uint32_t stripHashId ) const { - - uint32_t status = 0x0; + + int status = 0; if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getStatus(status,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelStatus(stripHashId, status).isSuccess()) ATH_MSG_WARNING ( " failed to access CSC conditions database - status - " << "strip hash id = " << stripHashId ); - - uint8_t status2 = 0x0; - if ( (m_cscCoolStrSvc->getStatus(status2,stripHashId)).isFailure() ) { - ATH_MSG_WARNING ( " failed to access CSC conditions database old way - status - " - << "strip hash id = " << stripHashId ); - }else{ - ATH_MSG_INFO ( " Accessed CSC conditions database old way - status - " - << "strip hash id = " << stripHashId ); - } - } else { - ATH_MSG_VERBOSE ( "The status word is " << std::hex << status - << " for strip hash = " << std::dec << stripHashId ); - } + else + ATH_MSG_INFO ( " Accessed CSC conditions database old way - status - " + << "strip hash id = " << stripHashId ); } return status; } @@ -311,7 +306,9 @@ bool CscCalibTool::stripT0phase ( uint32_t stripHashId ) const { if (! m_onlineHLT ) { if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getT0Phase(t0phase,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelT0Phase(stripHashId, t0phase).isSuccess()){ if (m_messageCnt_t0phase < 3) { ATH_MSG_WARNING ( " failed to access CSC conditions database - t0phase - " << "strip hash id = " << stripHashId ); @@ -332,7 +329,9 @@ double CscCalibTool::stripT0base ( uint32_t stripHashId ) const { float t0base = 0.0; if (! m_onlineHLT ) { if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getT0Base(t0base,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelT0Base(stripHashId, t0base).isSuccess()){ if (m_messageCnt_t0base < 3) { ATH_MSG_WARNING ( " failed to access CSC conditions database - t0base - " @@ -532,7 +531,9 @@ double CscCalibTool::adcCountToFemtoCoulomb(uint32_t stripHashId, const float ad float slope = getPSlope(stripHashId); if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getPedestal(pedestal,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){ ATH_MSG_DEBUG ( " failed to access CSC conditions database - pedestal - " << "strip hash id = " << stripHashId ); pedestal = m_pedestal; @@ -556,7 +557,9 @@ double CscCalibTool::adcCountToNumberOfElectrons(uint32_t stripHashId, const flo float pedestal = m_pedestal; float slope = getPSlope(stripHashId); if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getPedestal(pedestal,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){ ATH_MSG_DEBUG ( "failed to access CSC Conditions database - pedestal - " << "strip hash id = " << stripHashId ); pedestal = m_pedestal; @@ -579,7 +582,9 @@ bool CscCalibTool::adcToCharge(const std::vector<uint16_t>& samples, uint32_t st float pedestal = m_pedestal; float slope = getPSlope(stripHashId); if ( m_readFromDatabase ) { - if ( !m_cscCoolStrSvc->getPedestal(pedestal,stripHashId) ) { + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){ ATH_MSG_DEBUG ( "failed to access CSC Conditions database - pedestal - " << "strip hash id = " << stripHashId ); pedestal = m_pedestal; diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.h index 73ce3f8df2e5892952d5ce751466bb1a96b75263..72a772e86074cfde0d5072d4af91aa13f2660f04 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools/src/CscCalibTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CSCCALIBTOOLBASE_H @@ -19,8 +19,7 @@ *******************************************************************************/ #include "AthenaBaseComps/AthAlgTool.h" -#include "MuonCondData/CscCondDataContainer.h" -#include "MuonCondInterface/CscICoolStrSvc.h" +#include "MuonCondData/CscCondDbData.h" #include "CscCalibTools/ICscCalibTool.h" #include "CxxUtils/checker_macros.h" @@ -33,6 +32,8 @@ #include <mutex> #include <vector> +class CscCondDbData; + class CscCalibTool : public extends<AthAlgTool, ICscCalibTool> { public: @@ -144,7 +145,7 @@ private: protected: - ServiceHandle<MuonCalib::CscICoolStrSvc> m_cscCoolStrSvc; + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; bool m_readFromDatabase; bool m_slopeFromDatabase; diff --git a/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py b/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py index f623a6b4734bcaa86fea06acec3dd7b3345b2eea..f7bf9c6ac9a014bce12f86389c7948a174d1bdfb 100644 --- a/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py +++ b/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #-------------------------------------------------------------- # JobOption fragments for Condition Database access @@ -107,8 +107,7 @@ def setupCscCondDB(): def CscCalibTool(name,**kwargs): - # setup condDB folders - setupCscCondDB() + import MuonCondAlg.CscCondDbAlgConfig # MT-safe conditions access # make tool return CfgMgr.CscCalibTool( Slope=0.19, diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h index 5a9eb62b039bdeb501fe77a51eac17c74c6e6df7..20a0cd2483587811e41feca174be0476297645ed 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/CscCondDbAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDALG_CSCCONDDBALG_H @@ -13,31 +13,17 @@ //Gaudi includes #include "GaudiKernel/ICondSvc.h" -#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" //Athena includes #include "AthenaBaseComps/AthReentrantAlgorithm.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 "MuonIdHelpers/IMuonIdHelperSvc.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 AthReentrantAlgorithm{ public: @@ -45,16 +31,40 @@ public: CscCondDbAlg( const std::string & name, ISvcLocator* svc); virtual ~CscCondDbAlg() = default; virtual StatusCode initialize() override; - virtual StatusCode execute (const EventContext&) const override; + virtual StatusCode execute (const EventContext &) const override; private: - StatusCode loadDataHv (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode loadDataStat (EventIDRange &, CscCondDbData*, const EventContext&) const; - StatusCode cacheVersion1(std::string , CscCondDbData*) const; - StatusCode cacheVersion2(std::string , CscCondDbData*) const; - StatusCode onlineToOfflineIds(const unsigned int &, Identifier &, Identifier &) const; + StatusCode loadDataHv (EventIDRange &, CscCondDbData*, const EventContext&) const; + + StatusCode loadData (EventIDRange &, CscCondDbData*, SG::ReadCondHandle<CondAttrListCollection>, const std::string, bool = false) const; + + StatusCode loadDataF001 (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataNoise (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataPed (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataPSlope (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataRMS (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataStatus (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataT0Base (EventIDRange &, CscCondDbData*, const EventContext&) const; + StatusCode loadDataT0Phase(EventIDRange &, CscCondDbData*, const EventContext&) const; + + StatusCode cacheVersion1 (std::string , CscCondDbData*, const std::string) const; + StatusCode cacheVersion2 (std::string , CscCondDbData*, const std::string) const; + StatusCode cacheVersion2ASM(std::string , CscCondDbData*, const std::string) const; + StatusCode getAsmScope(int, int&, int&, int&, int&, int&) const; + + StatusCode recordParameter(unsigned int , std::string, CscCondDbData*, const std::string) const; + StatusCode recordParameter(IdentifierHash, std::string, CscCondDbData*, const std::string) const; + + StatusCode recordParameterF001 (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterNoise (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterPed (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterPSlope (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterRMS (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterStatus (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterT0Base (IdentifierHash, std::string, CscCondDbData*) const; + StatusCode recordParameterT0Phase(IdentifierHash, std::string, CscCondDbData*) const; bool m_isOnline{false}; bool m_isData{false}; @@ -64,13 +74,33 @@ private: bool m_onlineOfflinePhiFlip{false}; ServiceHandle<ICondSvc> m_condSvc; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; 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"}; + 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_f001 {this, "ReadKey_FT", "/CSC/FTHOLD" , "Key of input CSC condition data F001" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_noise {this, "ReadKey_NO", "/CSC/NOISE" , "Key of input CSC condition data NOISE" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_ped {this, "ReadKey_PD", "/CSC/PED" , "Key of input CSC condition data PEDESTALS"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_pslope {this, "ReadKey_PS", "/CSC/PSLOPE" , "Key of input CSC condition data PSLOPE" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_rms {this, "ReadKey_RM", "/CSC/RMS" , "Key of input CSC condition data RMS" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_status {this, "ReadKey_ST", "/CSC/STAT" , "Key of input CSC condition data STATUS" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_t0base {this, "ReadKey_TB", "/CSC/T0BASE" , "Key of input CSC condition data T0BASE" }; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_folder_da_t0phase{this, "ReadKey_TP", "/CSC/T0PHASE" , "Key of input CSC condition data T0PHASE" }; + + + // getParameter + template <typename T> + StatusCode getParameter(IdentifierHash chanHash, std::string data, T& token) const { + + // next element is the status bit + std::istringstream iss(data); + iss >> token; + + ATH_MSG_DEBUG("Recorded token " << token << " for channelHash " << chanHash); + return StatusCode::SUCCESS; + } }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py index 1c83b529ba6d10f039eded698e202bd15a8aa2a8..ea07135dacbfae393486c48b42aba834962b5632 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/AllCondDbAlgConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.AlgSequence import AthSequencer from MuonCondAlg.MuonTopCondAlgConfigRUN2 import MdtCondDbAlg,RpcCondDbAlg,CscCondDbAlg,TgcCondDbAlg @@ -10,9 +10,8 @@ if not athenaCommonFlags.isOnline: condSequence += MdtCondDbAlg("MdtCondDbAlg") if not hasattr(condSequence,"RpcCondDbAlg"): condSequence += RpcCondDbAlg("RpcCondDbAlg") -## to be added later: -# if not hasattr(condSequence,"CscCondDbAlg"): -# condSequence += CscCondDbAlg("CscCondDbAlg") +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 index 199e22751a76b0e7d886742db488f64fa2584cd7..5f614f4735080d3e1723839404f6ffb98c8d0f36 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/CscCondDbAlgConfig.py @@ -1,11 +1,10 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 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") +condSequence = AthSequencer("AthCondSeq") +if not hasattr(condSequence,"CscCondDbAlg"): + condSequence += CscCondDbAlg("CscCondDbAlg") diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py index f72a869d7b0c09c7bc176dfaa6451488d32e683e..9de613a942a8af83fd0f45de01d980de1dfe30fc 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/python/MuonTopCondAlgConfigRUN2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## Configuration Access to OFFLINE DB (COMP200) @@ -12,7 +12,6 @@ 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) @@ -72,7 +71,14 @@ class RpcCondDbAlg(CfgMgr.RpcCondDbAlg): class CscCondDbAlg(CfgMgr.CscCondDbAlg): def __init__(self,name="CscCondDbAlg",**kwargs): if athenaCommonFlags.isOnline: - kwargs['isOnline'] = True # COOL folders not available online + kwargs['isOnline' ] = True # COOL folders not available online + kwargs['isData' ] = True + kwargs['ReadKey_FT'] = '/CSC/FTHOLD' # 'ConditionsStore+' prefix not necessarily needed in ReadKey + kwargs['ReadKey_NO'] = '/CSC/NOISE' + kwargs['ReadKey_PD'] = '/CSC/PED' + kwargs['ReadKey_PS'] = '/CSC/PSLOPE' + kwargs['ReadKey_RM'] = '/CSC/RMS' + kwargs['ReadKey_ST'] = '/CSC/STAT' else: kwargs['isOnline'] = False # COOL folders not available online if globalflags.DataSource != 'data': @@ -81,8 +87,22 @@ class CscCondDbAlg(CfgMgr.CscCondDbAlg): kwargs['isData'] = True kwargs['isRun1'] = conddb.dbname == 'COMP200' super(CscCondDbAlg,self).__init__(name,**kwargs) - if athenaCommonFlags.isOnline: return - addFolder(self, "CSC_OFL", "/CSC/STAT") + if athenaCommonFlags.isOnline: + addFolder(self, "CSC_ONL", "/CSC/ONL/FTHOLD" ) + addFolder(self, "CSC_ONL", "/CSC/ONL/NOISE" ) + addFolder(self, "CSC_ONL", "/CSC/ONL/PED" ) + addFolder(self, "CSC_ONL", "/CSC/ONL/PSLOPE" ) + addFolder(self, "CSC_ONL", "/CSC/ONL/RMS" ) + addFolder(self, "CSC_ONL", "/CSC/ONL/STAT" ) + else: + addFolder(self, "CSC_OFL", "/CSC/FTHOLD" ) + addFolder(self, "CSC_OFL", "/CSC/NOISE" ) + addFolder(self, "CSC_OFL", "/CSC/PED" ) + addFolder(self, "CSC_OFL", "/CSC/PSLOPE" ) + addFolder(self, "CSC_OFL", "/CSC/RMS" ) + addFolder(self, "CSC_OFL", "/CSC/STAT" ) + addFolder(self, "CSC_OFL", "/CSC/T0BASE" ) + addFolder(self, "CSC_OFL", "/CSC/T0PHASE") class TgcCondDbAlg(CfgMgr.TgcCondDbAlg): def __init__(self,name="TgcCondDbAlg",**kwargs): diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx index 0da0db04313ee668a77a740505de90c260008194..d46095a914a02b1e7e60824feb8b0673c5bed3f6 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/CscCondDbAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCondAlg/CscCondDbAlg.h" @@ -9,11 +9,8 @@ CscCondDbAlg::CscCondDbAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthReentrantAlgorithm(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 ); @@ -30,10 +27,17 @@ CscCondDbAlg::initialize(){ ATH_MSG_DEBUG( "initializing " << name() ); ATH_CHECK(m_condSvc .retrieve()); - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_writeKey.initialize()); - ATH_CHECK(m_readKey_folder_da_hv .initialize()); - ATH_CHECK(m_readKey_folder_da_stat.initialize()); + ATH_CHECK(m_readKey_folder_da_hv .initialize()); + ATH_CHECK(m_readKey_folder_da_f001 .initialize()); + ATH_CHECK(m_readKey_folder_da_noise .initialize()); + ATH_CHECK(m_readKey_folder_da_ped .initialize()); + ATH_CHECK(m_readKey_folder_da_pslope .initialize()); + ATH_CHECK(m_readKey_folder_da_rms .initialize()); + ATH_CHECK(m_readKey_folder_da_status .initialize()); + ATH_CHECK(m_readKey_folder_da_t0base .initialize()); + ATH_CHECK(m_readKey_folder_da_t0phase.initialize()); if(m_condSvc->regHandle(this, m_writeKey).isFailure()) { ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); @@ -43,17 +47,11 @@ CscCondDbAlg::initialize(){ return StatusCode::SUCCESS; } - // execute StatusCode CscCondDbAlg::execute(const EventContext& ctx) const { 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, ctx}; @@ -65,15 +63,28 @@ CscCondDbAlg::execute(const EventContext& ctx) const { } std::unique_ptr<CscCondDbData> writeCdo{std::make_unique<CscCondDbData>()}; + writeCdo->loadParameters(&m_idHelperSvc->cscIdHelper()); + writeCdo->setParameters(m_onlineOfflinePhiFlip); + //Start with an infinite range and narrow it down as needed EventIDRange rangeW=IOVInfiniteRange::infiniteMixed(); // data only if(m_isData) { //ATH_CHECK(loadDataHv(rangeW, writeCdo.get(), ctx)); // keep for future development } - // data and MC - ATH_CHECK(loadDataStat(rangeW, writeCdo.get(), ctx)); + // both data and MC + ATH_CHECK(loadDataF001 (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataNoise (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataPed (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataPSlope (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataRMS (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataStatus (rangeW, writeCdo.get(), ctx)); + + if(!m_isOnline) { + ATH_CHECK(loadDataT0Base (rangeW, writeCdo.get(), ctx)); + ATH_CHECK(loadDataT0Phase(rangeW, writeCdo.get(), ctx)); + } if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { ATH_MSG_FATAL("Could not record CscCondDbData " << writeHandle.key() @@ -97,14 +108,14 @@ CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const E ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } - + EventIDRange range; if ( !readHandle.range(range) ) { ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key()); return StatusCode::FAILURE; - } + } - // intersect validity range of thsi obj with the validity of already-loaded objs + //intersect validity range of this obj with the validity of already-loaded objs rangeW = EventIDRange::intersect(range, rangeW); ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); @@ -160,8 +171,8 @@ CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const E 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); + Identifier ChamberId = m_idHelperSvc->cscIdHelper().elementID(chamber_name, eta, phi); + Identifier WireLayerId = m_idHelperSvc->cscIdHelper().channelID(ChamberId, 1, wirelayer,1,1); std::string WireLayerstring = chamber_name+"_"+eta_side+"_"+sector_side+"_"+layer; writeCdo->setDeadLayer(WireLayerstring, WireLayerId); @@ -177,13 +188,69 @@ CscCondDbAlg::loadDataHv(EventIDRange & rangeW, CscCondDbData* writeCdo, const E } +// loadDataF001 +StatusCode +CscCondDbAlg::loadDataF001(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_f001, ctx}; + return loadData(rangeW, writeCdo, readHandle, "f001"); +} + +// loadDataNoise +StatusCode +CscCondDbAlg::loadDataNoise(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_noise, ctx}; + return loadData(rangeW, writeCdo, readHandle, "noise"); +} + +// loadDataPed +StatusCode +CscCondDbAlg::loadDataPed(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_ped, ctx}; + return loadData(rangeW, writeCdo, readHandle, "ped"); +} -// loadDataStat +// loadDataPSlope StatusCode -CscCondDbAlg::loadDataStat(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { - - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_stat, ctx}; +CscCondDbAlg::loadDataPSlope(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_pslope, ctx}; + return loadData(rangeW, writeCdo, readHandle, "pslope"); +} + +// loadDataRMS +StatusCode +CscCondDbAlg::loadDataRMS(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_rms, ctx}; + return loadData(rangeW, writeCdo, readHandle, "rms"); +} + +// loadDataStatus +StatusCode +CscCondDbAlg::loadDataStatus(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_status, ctx}; + return loadData(rangeW, writeCdo, readHandle, "status"); +} + +// loadDataT0Base +StatusCode +CscCondDbAlg::loadDataT0Base(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0base, ctx}; + return loadData(rangeW, writeCdo, readHandle, "t0base"); +} + +// loadDataT0Phase +StatusCode +CscCondDbAlg::loadDataT0Phase(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_t0phase, ctx}; + return loadData(rangeW, writeCdo, readHandle, "t0phase", true); +} + + +// loadData +StatusCode +CscCondDbAlg::loadData(EventIDRange & rangeW, CscCondDbData* writeCdo, SG::ReadCondHandle<CondAttrListCollection> readHandle, const std::string parName, bool parAsm) const { + const CondAttrListCollection* readCdo{*readHandle}; + if(readCdo==0){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; @@ -220,13 +287,19 @@ CscCondDbAlg::loadDataStat(EventIDRange & rangeW, CscCondDbData* writeCdo, const ss >> version; if(version == "1" || atoi(version.c_str()) == 1){ - if(!cacheVersion1(data, writeCdo).isSuccess()) { + if(!cacheVersion1(data, writeCdo, parName).isSuccess()) { ATH_MSG_ERROR("Failed caching from COOL string version 1"); return StatusCode::FAILURE; } } + else if(version == "02-00" && parAsm) { + if(!cacheVersion2ASM(data, writeCdo, parName).isSuccess()) { + ATH_MSG_ERROR("Failed caching from COOL string version 02-00 in ASM format"); + return StatusCode::FAILURE; + } + } else if(version == "02-00") { - if(!cacheVersion2(data, writeCdo).isSuccess()) { + if(!cacheVersion2(data, writeCdo, parName).isSuccess()) { ATH_MSG_ERROR("Failed caching from COOL string version 02-00"); return StatusCode::FAILURE; } @@ -236,13 +309,19 @@ CscCondDbAlg::loadDataStat(EventIDRange & rangeW, CscCondDbData* writeCdo, const // 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()) { + if(!cacheVersion1(data, writeCdo, parName).isSuccess()) { ATH_MSG_ERROR("Failed caching from COOL string version 1"); return StatusCode::FAILURE; } } + else if(m_defaultDatabaseReadVersion == "02-00" && parAsm) { + if(!cacheVersion2ASM(data, writeCdo, parName).isSuccess()) { + ATH_MSG_ERROR("Failed caching from COOL string version 02-00 in ASM format"); + return StatusCode::FAILURE; + } + } else if(m_defaultDatabaseReadVersion == "02-00"){ - if(!cacheVersion2(data, writeCdo).isSuccess()) { + if(!cacheVersion2(data, writeCdo, parName).isSuccess()) { ATH_MSG_ERROR("Failed caching from COOL string version 02-00"); return StatusCode::FAILURE; } @@ -256,69 +335,70 @@ CscCondDbAlg::loadDataStat(EventIDRange & rangeW, CscCondDbData* writeCdo, const // cacheVersion1 StatusCode -CscCondDbAlg::cacheVersion1(std::string data, CscCondDbData* writeCdo) const { - - // ATTENTION: careful, this is untested yet! +CscCondDbAlg::cacheVersion1(std::string data, CscCondDbData* writeCdo, const std::string parName) const { + std::istringstream ss(data); std::string valueStr; - std::istringstream ss(data); + ss >> valueStr; // first element is the '1' for the string version + unsigned int chanAddress = 0; - bool started = false; + bool hasAddress = 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); + ATH_MSG_DEBUG("current element " << valueStr); - int index = atoi(valueStr.c_str()); + // need the next string as token + if(!hasAddress){ + chanAddress = atoi(valueStr.c_str()); + hasAddress = true; + continue; + } // 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 + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); + m_idHelperSvc->cscIdHelper().get_id((IdentifierHash) chanAddress, chanId, &channelContext); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta (chanId); // +1 Wheel A -1 Wheel C + int measuresPhi = m_idHelperSvc->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); + int stationName = m_idHelperSvc->cscIdHelper().stationName (chanId); // CSL or CSS + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi (chanId); // PhiSector from 1-8 + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(chanId); // Either 1 or 2 (but always 2) + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer (chanId); // layer in chamber 1-4 + int strip = 49 - m_idHelperSvc->cscIdHelper().strip (chanId); - Identifier newId = m_idHelper->cscIdHelper().channelID(stationName,stationEta,stationPhi,chamberLayer, wireLayer,measuresPhi,strip); + Identifier newId = m_idHelperSvc->cscIdHelper().channelID(stationName,stationEta,stationPhi,chamberLayer, wireLayer,measuresPhi,strip); IdentifierHash hash ; - m_idHelper->cscIdHelper().get_channel_hash(newId, hash); + m_idHelperSvc->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) << + ATH_MSG_VERBOSE("Swapped phi strip "<< m_idHelperSvc->cscIdHelper().show_to_string(chanId) << + " (" << chanAddress << ") to " << m_idHelperSvc->cscIdHelper().show_to_string(newId) << " (" << hash << ")"); - index = hash; + chanAddress = hash; } else { - ATH_MSG_VERBOSE("Not swapping " << m_idHelper->cscIdHelper().show_to_string(chanId)); + ATH_MSG_VERBOSE("Not swapping " << m_idHelperSvc->cscIdHelper().show_to_string(chanId)); } } - writeCdo->setDeadChannelHash((IdentifierHash) index); + // record parameter + if(recordParameter(chanAddress, valueStr, writeCdo, parName).isFailure()) + return StatusCode::FAILURE; + // reset the address + chanAddress = 0; + hasAddress = false; } + return StatusCode::SUCCESS; } - // cacheVersion2 StatusCode -CscCondDbAlg::cacheVersion2(std::string data, CscCondDbData* writeCdo) const { +CscCondDbAlg::cacheVersion2(std::string data, CscCondDbData* writeCdo, const std::string parName) const { std::istringstream ss(data); std::string valueStr; @@ -345,80 +425,321 @@ CscCondDbAlg::cacheVersion2(std::string data, CscCondDbData* writeCdo) const { 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; + // record parameter + if(recordParameter(chanAddress, valueStr, writeCdo, parName).isFailure()) + return StatusCode::FAILURE; + // reset the address + chanAddress = 0; } - return StatusCode::SUCCESS; } +// cacheVersion2ASM +StatusCode +CscCondDbAlg::cacheVersion2ASM(std::string data, CscCondDbData* writeCdo, const std::string parName) const { + + std::istringstream ss(data); + std::string valueStr; + std::string chanAddress; + bool setAddress = false; + + 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(!setAddress){ + iss >> chanAddress; + setAddress = true; + continue; + } + + // chanAddress is the ASM tag, need to do something with it + // format: ASM[#:1-5]_[StationEtaString:AorC][stationPhi:1-8]_[stationName:50-51] + // xxx 3 x 5 6 x x9 + int asmNum = atoi(chanAddress.substr(3,1).c_str()); + + int stationEta = 0; + if (chanAddress[5] == 'A') stationEta = 1; + else if(chanAddress[5] == 'C') stationEta = -1; + else{ + ATH_MSG_FATAL("Bad ASMID String in CSC COOL database \"" << chanAddress << "\" (wheel " << chanAddress[5] << " doesn't exist!"); + return StatusCode::FAILURE; + } + + int stationPhi = atoi(chanAddress.substr(6,1).c_str()); + int stationName = atoi(chanAddress.substr(8,2).c_str()); + + if(stationPhi < 1 || stationPhi > 8 || stationName < 50 || stationName > 51){ + ATH_MSG_FATAL("Bad ASMID String in CSC COOL database: \"" << chanAddress << "\""); + ATH_MSG_FATAL("Read station phi: " << stationPhi << ", stationName " << stationName); + return StatusCode::FAILURE; + } + + int chamberLayer = 2; // chamberLayer1 was never built. + + int measuresPhi = 0; + int layerSince = 0; + int layerUntil = 0; + int stripSince = 0; + int stripUntil = 0; + if(!getAsmScope(asmNum, measuresPhi, layerSince, layerUntil, stripSince, stripUntil).isSuccess()){ + ATH_MSG_FATAL("Failure of getAsmScope in cacheVersion2."); + return StatusCode::FAILURE; + } + + // Now for given asmID, loop over strip and layer + unsigned int index = 0; + Identifier chanId; + IdentifierHash hashIdentifier; + for(int iStrip = stripSince; iStrip < stripUntil; iStrip++){ + for(int iLayer = layerSince; iLayer < layerUntil; iLayer++){ + chanId = m_idHelperSvc->cscIdHelper().channelID(stationName, stationEta, stationPhi, + chamberLayer, iLayer, measuresPhi, iStrip); + m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hashIdentifier); + index = (int) hashIdentifier; + + ATH_MSG_VERBOSE("[cache version 2 (ASM)] Recording " + << valueStr << " at index " << index + << "\nstationName " << stationName + <<"\nstationEta " << stationEta + << "\nstationPhi " << stationPhi + << "\nchamberLayer " << chamberLayer + << "\niLayer " << iLayer + << "\nmeasuresPhi " << measuresPhi + << "\niStrip " << iStrip); + + // record parameter + if(recordParameter(hashIdentifier, valueStr, writeCdo, parName).isFailure()) + return StatusCode::FAILURE; + } + } + + // reset the address + setAddress = false; + chanAddress = ""; + } + + return StatusCode::SUCCESS; +} + -// onlineToOfflineIds +// getAsmScope 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) +CscCondDbAlg::getAsmScope(int asmNum, int &measuresPhi, int & layerSince, int & layerUntil, int & stripSince , int & stripUntil) const { + // copy-paste from CscCoolStrSvc + + if(asmNum == 1 ){ + stripSince = 1; //inclusive + stripUntil = 97; //exclusive + layerSince = 1; //inclusive + layerUntil = 3; //exclusive + measuresPhi = 0; + } + else if(asmNum == 2){ + stripSince = 1; //inclusive + stripUntil = 97; //exclusive + layerSince = 3; //inclusive + layerUntil = 5; //exclusive + measuresPhi = 0; + } + else if(asmNum == 3){ + stripSince = 97; + stripUntil = 193; + layerSince = 1; + layerUntil = 3; + measuresPhi = 0; + } + else if( asmNum == 4){ + stripSince = 97; + stripUntil = 193; + layerSince = 3; + layerUntil = 5; + measuresPhi = 0; + } + else if(asmNum == 5){ + stripSince = 1; + stripUntil = 49; + layerSince = 1; + layerUntil = 5; + measuresPhi = 1; } else { - strip = ((onlineId)&0xff) +1; + ATH_MSG_FATAL("ASM number \"" << asmNum << "\" is invalid. It needs to end in a number from 1-5."); + return StatusCode::FAILURE; } - - elementId = m_idHelper->cscIdHelper().elementID(stationName,eta,phi); - channelId = m_idHelper->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); - return StatusCode::SUCCESS; } +// recordParameter +StatusCode +CscCondDbAlg::recordParameter(unsigned int chanAddress, std::string data, CscCondDbData* writeCdo, const std::string parName) const { + + // retrieve channel hash + Identifier chamberId; + Identifier channelId; + if(!writeCdo->onlineToOfflineIds(&m_idHelperSvc->cscIdHelper(), chanAddress, chamberId, channelId).isSuccess()) + ATH_MSG_ERROR("Cannon get offline Ids from online Id" << std::hex << chanAddress << std::dec); + + IdentifierHash chanHash; + m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, chanHash); + + // record parameter + return recordParameter(chanHash, data, writeCdo, parName); +} + + +// recordParameter +StatusCode +CscCondDbAlg::recordParameter(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo, const std::string parName) const { + + // record parameter + StatusCode sc = StatusCode::FAILURE; + if (parName == "f001" ) sc = recordParameterF001 (chanHash, data, writeCdo); + else if(parName == "noise" ) sc = recordParameterNoise (chanHash, data, writeCdo); + else if(parName == "ped" ) sc = recordParameterPed (chanHash, data, writeCdo); + else if(parName == "pslope" ) sc = recordParameterPSlope (chanHash, data, writeCdo); + else if(parName == "rms" ) sc = recordParameterRMS (chanHash, data, writeCdo); + else if(parName == "status" ) sc = recordParameterStatus (chanHash, data, writeCdo); + else if(parName == "t0base" ) sc = recordParameterT0Base (chanHash, data, writeCdo); + else if(parName == "t0phase") sc = recordParameterT0Phase(chanHash, data, writeCdo); + + if(!sc.isSuccess()) + ATH_MSG_ERROR("Cannot extract parameter " <<parName<< " for channel hash " <<chanHash<< " from data string '" <<data << "'"); + return sc; +} + + +// recordParameterF001 +StatusCode +CscCondDbAlg::recordParameterF001(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelF001(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterNoise +StatusCode +CscCondDbAlg::recordParameterNoise(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelNoise(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterPed +StatusCode +CscCondDbAlg::recordParameterPed(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelPed(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterPSlope +StatusCode +CscCondDbAlg::recordParameterPSlope(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelPSlope(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterRMS +StatusCode +CscCondDbAlg::recordParameterRMS(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelRMS(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterStatus +StatusCode +CscCondDbAlg::recordParameterStatus(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + unsigned int token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelStatus(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterT0Base +StatusCode +CscCondDbAlg::recordParameterT0Base(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + float token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelT0Base(chanHash, token); + return StatusCode::SUCCESS; +} + + +// recordParameterT0Phase +StatusCode +CscCondDbAlg::recordParameterT0Phase(IdentifierHash chanHash, std::string data, CscCondDbData* writeCdo) const { + + bool token; + if(getParameter(chanHash, data, token).isFailure()) return StatusCode::FAILURE; + writeCdo->setChannelT0Phase(chanHash, token); + return StatusCode::SUCCESS; +} + + /* keep for future development: // loadDataDeadChambers StatusCode -CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, std::unique_ptr<CscCondDbData>& writeCdo){ +CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, CscCondDbData* writeCdo, const EventContext& ctx) const { ATH_CHECK(m_readKey_folder_da_chambers.initialize()); - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_chambers}; + SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey_folder_da_chambers, ctx}; const CondAttrListCollection* readCdo{*readHandle}; if(readCdo==0){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } - if ( !readHandle.range(rangeW) ) { + EventIDRange range; + if ( !readHandle.range(range) ) { ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key()); return StatusCode::FAILURE; } + + //intersect validity range of this obj with the validity of already-loaded objs + rangeW = EventIDRange::intersect(range, rangeW); ATH_MSG_DEBUG("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); - ATH_MSG_DEBUG("Range of input is " << rangeW); + ATH_MSG_DEBUG("Range of input is " << range << ", range of output is " << rangeW); std::vector<std::string> goodChambers; std::vector<std::string> deadChambers; @@ -467,7 +788,7 @@ CscCondDbAlg::loadDataDeadChambers(EventIDRange & rangeW, std::unique_ptr<CscCon 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); + Identifier ChamberId = m_idHelperSvc->cscIdHelper().elementID(chamber_name, eta, phi); writeCdo->setDeadStation(deadChambers[i], ChamberId); } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h index 9346002d93d03b598dd009a5b0af1f3c4b81d5d8..1cae10e0df65b3a8bd7ce5d358acb095cffab56b 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/CscCondDbData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDDATA_CSCCONDDBDATA_H @@ -13,14 +13,16 @@ #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "AthenaKernel/CondCont.h" #include "Identifier/Identifier.h" +#include "Identifier/IdContext.h" #include "Identifier/IdentifierHash.h" #include "AthenaKernel/BaseInfo.h" +#include "MuonIdHelpers/CscIdHelper.h" //forward declarations class Identifier; class IdentifierHash; - +class CscIdHelper; class CscCondDbData { @@ -32,9 +34,19 @@ public: CscCondDbData(); virtual ~CscCondDbData() = default; - void setChannelStatus(IdentifierHash, int); - void setDeadChannelHash(IdentifierHash); + void loadParameters(const CscIdHelper*); + void setParameters(bool); // keep in plural for future development + void setChannelF001 (IdentifierHash, float); + void setChannelNoise (IdentifierHash, float); + void setChannelPed (IdentifierHash, float); + void setChannelPSlope (IdentifierHash, float); + void setChannelRMS (IdentifierHash, float); + void setChannelStatus (IdentifierHash, int ); + void setChannelT0Base (IdentifierHash, float); + void setChannelT0Phase(IdentifierHash, bool ); + + void setDeadChannelHash(IdentifierHash); void setDeadLayer (std::string, Identifier); void setDeadStation (std::string, Identifier); @@ -45,8 +57,26 @@ public: const std::vector<Identifier>& getDeadStationsId () const; const std::vector<unsigned int>& getDeadChannelsHash() const; + + bool hasChannelT0Phase(IdentifierHash) const; - const int& getChannelStatus(IdentifierHash) const; + const float& getChannelF001 (IdentifierHash) const; + const float& getChannelNoise (IdentifierHash) const; + const float& getChannelPed (IdentifierHash) const; + const float& getChannelPSlope (IdentifierHash) const; + const float& getChannelRMS (IdentifierHash) const; + const int& getChannelStatus (IdentifierHash) const; + const float& getChannelT0Base (IdentifierHash) const; + const bool& getChannelT0Phase(IdentifierHash) const; + + StatusCode readChannelF001 (IdentifierHash, float&) const; + StatusCode readChannelNoise (IdentifierHash, float&) const; + StatusCode readChannelPed (IdentifierHash, float&) const; + StatusCode readChannelPSlope (IdentifierHash, float&) const; + StatusCode readChannelRMS (IdentifierHash, float&) const; + StatusCode readChannelStatus (IdentifierHash, int& ) const; + StatusCode readChannelT0Base (IdentifierHash, float&) const; + StatusCode readChannelT0Phase(IdentifierHash, bool& ) const; bool isGood (const Identifier & ) const; bool isGoodLayer (const Identifier & ) const; @@ -54,10 +84,29 @@ public: bool isGoodChannelHash(const IdentifierHash &) const; - + StatusCode indexToStringId(const CscIdHelper*, const unsigned int &, const std::string &, std::string &) const; + StatusCode layerHashToOnlineId(const unsigned int &, unsigned int &) const; + StatusCode offlineElementToOnlineId(const CscIdHelper*, const Identifier &, unsigned int &) const; + StatusCode offlineToOnlineId(const CscIdHelper*, const Identifier &, unsigned int &) const; + StatusCode onlineToOfflineElementId(const CscIdHelper*, const unsigned int &, Identifier &) const; + StatusCode onlineToOfflineChannelId(const CscIdHelper*, const unsigned int &, Identifier &) const; + StatusCode onlineToOfflineIds(const CscIdHelper*, const unsigned int &, Identifier &, Identifier &) const; private: + IdContext m_channelContext, m_moduleContext; + + unsigned int m_layerHashes[2][2][8][4][2]; + std::vector<unsigned int> m_onlineChannelIdsFromLayerHash; + unsigned int m_chamberCoolChannels[2][2][8]; + std::vector<unsigned int> m_onlineChannelIdsFromChamberCoolChannel; + + const unsigned int m_maxChanHash; + const unsigned int m_maxChamberCoolChannel; + const unsigned int m_maxLayerHash; + + bool m_onlineOfflinePhiFlip{false}; + std::vector<std::string> m_cachedDeadLayers; std::vector<std::string> m_cachedDeadStations; @@ -65,13 +114,40 @@ private: std::vector<Identifier> m_cachedDeadStationsId; std::vector<unsigned int> m_cachedDeadChannelsHash; - std::map<unsigned int, int> m_cachedChannelsStatus; + + std::map<unsigned int, float> m_cachedChannelsF001; + std::map<unsigned int, float> m_cachedChannelsNoise; + std::map<unsigned int, float> m_cachedChannelsPed; + std::map<unsigned int, float> m_cachedChannelsPSlope; + std::map<unsigned int, float> m_cachedChannelsRMS; + std::map<unsigned int, int > m_cachedChannelsStatus; + std::map<unsigned int, float> m_cachedChannelsT0Base; + std::map<unsigned int, bool > m_cachedChannelsT0Phase; std::vector<std::string> m_emptyNames; std::vector<Identifier> m_emptyIds; std::vector<unsigned int> m_emptyHashs; - int m_nillint = 0; + const bool m_nillbool = false; + const float m_nillfloat = -1; + const int m_nillint = -1; + + +public: + + // readChannelParam + template <typename T> StatusCode readChannelParam(IdentifierHash hash, T& val, std::string parName) const{ + + if (parName == "f001" ) { float theVal; return readChannelF001 (hash, theVal); val = theVal; } + else if(parName == "noise" ) { float theVal; return readChannelNoise (hash, theVal); val = theVal; } + else if(parName == "ped" ) { float theVal; return readChannelPed (hash, theVal); val = theVal; } + else if(parName == "pslope" ) { float theVal; return readChannelPSlope (hash, theVal); val = theVal; } + else if(parName == "rms" ) { float theVal; return readChannelRMS (hash, theVal); val = theVal; } + else if(parName == "status" ) { int theVal; return readChannelStatus (hash, theVal); val = theVal; } + else if(parName == "t0base" ) { float theVal; return readChannelT0Base (hash, theVal); val = theVal; } + else if(parName == "t0phase") { bool theVal; return readChannelT0Phase(hash, theVal); val = theVal; } + return StatusCode::FAILURE; + } }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx index eeb6538f73d1b6ae401f54fd8a6724319e3203e5..d81f2a586d9b3b41fe02865fe4f996ea9dd74e9e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/CscCondDbData.cxx @@ -1,16 +1,138 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCondData/CscCondDbData.h" // constructor -CscCondDbData::CscCondDbData() { +CscCondDbData::CscCondDbData() : + m_maxChanHash(61440), + m_maxChamberCoolChannel(32), + m_maxLayerHash(255){ } +// loadParameters +void +CscCondDbData::loadParameters(const CscIdHelper* idHelper){ + + // prepare contexts + m_moduleContext = idHelper->module_context(); + m_channelContext = idHelper->channel_context(); + + //prepare layer hash array + int hash = 0; + + for(int stationName = 0; stationName < 2; stationName++){ + for(int stationEta =0; stationEta <2; stationEta++){ + for(int stationPhi = 0; stationPhi <8; stationPhi++){ + for(int wireLayer = 0; wireLayer <4; wireLayer++){ + for(int measuresPhi = 0; measuresPhi <2; measuresPhi++){ + Identifier id = idHelper->channelID( + stationName+1, + (stationEta? 1:-1), + stationPhi+1, + 2,//only installed chamber layer + wireLayer+1, + measuresPhi, + 1 //channel doesn't matter. We'll just use first + ); + unsigned int onlineId; + if(!offlineToOnlineId(idHelper, id, onlineId).isSuccess()) { + std::cout << "Failed at geting online id!" << std::endl; + } + else { + m_onlineChannelIdsFromLayerHash.push_back(onlineId); + m_layerHashes[stationName][stationEta][stationPhi][wireLayer][measuresPhi] = hash++; + } + } + } + } + } + } + + *(const_cast<unsigned int*>(&m_maxLayerHash)) = hash -1; //-1 because hash overshoots in loop + + + //prepare chamberCoolChannel. This is similar to the hash array in CscIdHelper. + //Putting it here because cool channels are dependent on this hash, and it can't + //ever change, even if idHelper's definition changes + hash = 1; + for(int stationName = 0; stationName < 2; stationName++){ + for(int stationEta =0; stationEta <2; stationEta++){ + for(int stationPhi = 0; stationPhi <8; stationPhi++){ + Identifier id = idHelper->channelID( + stationName+1, + (stationEta? 1:-1), + stationPhi+1, + 2,//only installed chamber layer 2 + 1,//wirelayer doesn't matter, we'll just use first + 0,//measures phi doesn't matter, we'll just use precision + 1 //channel doesn't matter. We'll just use first + ); + unsigned int onlineId; + if(!offlineToOnlineId(idHelper, id, onlineId).isSuccess()) { + std::cout << "Failed at geting online id!" << std::endl; + } + else { + m_onlineChannelIdsFromChamberCoolChannel.push_back(onlineId); + m_chamberCoolChannels[stationName][stationEta][stationPhi] = hash++; + } + } + } + } + *(const_cast<unsigned int*>(&m_maxChamberCoolChannel)) = hash - 1; //-1 because hash overshoots in loop + *(const_cast<unsigned int*>(&m_maxChanHash)) = idHelper->channel_hash_max() - 1; + + + std::cout << "Maximum Chamber COOL Channel is " << m_maxChamberCoolChannel << std::endl; + std::cout << "Maximum Layer hash is " << m_maxLayerHash << std::endl; + std::cout << "Maximum Channel hash is " << m_maxChanHash << std::endl; +} + + +// set Parameters +void +CscCondDbData::setParameters(bool onlineOfflinePhiFlip){ + m_onlineOfflinePhiFlip = onlineOfflinePhiFlip; +} + + + + // --- writing identifiers ------- + +// setChannelF001 +void +CscCondDbData::setChannelF001(IdentifierHash hash, float f001){ + m_cachedChannelsF001[(unsigned int) hash] = f001; +} + +// setChannelNoise +void +CscCondDbData::setChannelNoise(IdentifierHash hash, float noise){ + m_cachedChannelsNoise[(unsigned int) hash] = noise; +} + +// setChannelPed +void +CscCondDbData::setChannelPed(IdentifierHash hash, float ped){ + m_cachedChannelsPed[(unsigned int) hash] = ped; +} + +// setChannelPSlope +void +CscCondDbData::setChannelPSlope(IdentifierHash hash, float pslope){ + m_cachedChannelsPSlope[(unsigned int) hash] = pslope; +} + +// setChannelRMS +void +CscCondDbData::setChannelRMS(IdentifierHash hash, float rms){ + m_cachedChannelsRMS[(unsigned int) hash] = rms; +} + // setChannelStatus void CscCondDbData::setChannelStatus(IdentifierHash hash, int status){ @@ -18,6 +140,22 @@ CscCondDbData::setChannelStatus(IdentifierHash hash, int status){ if((status & 0x1) || ((status >> 1) & 0x1)) setDeadChannelHash(hash); } +// setChannelT0Base +void +CscCondDbData::setChannelT0Base(IdentifierHash hash, float t0base){ + m_cachedChannelsT0Base[(unsigned int) hash] = t0base; +} + +// setChannelT0Phase +void +CscCondDbData::setChannelT0Phase(IdentifierHash hash, bool t0phase){ + m_cachedChannelsT0Phase[(unsigned int) hash] = t0phase; +} + + + +// --- writing dead channels ----- + // setDeadChannelHash void CscCondDbData::setDeadChannelHash(IdentifierHash hash){ @@ -90,6 +228,47 @@ std::vector<unsigned int>& CscCondDbData::getDeadChannelsHash() const{ // --- stored info for all ------- +// hasChannelT0Phase +bool CscCondDbData::hasChannelT0Phase(IdentifierHash hash) const{ + if(m_cachedChannelsT0Phase.find((unsigned int) hash)==m_cachedChannelsT0Phase.end()) return false; + return true; +} + +// getChannelF001 +const +float& CscCondDbData::getChannelF001(IdentifierHash hash) const{ + if(m_cachedChannelsF001.find((unsigned int) hash)==m_cachedChannelsF001.end()) return m_nillfloat; + return m_cachedChannelsF001.find((unsigned int) hash)->second; +} + +// getChannelNoise +const +float& CscCondDbData::getChannelNoise(IdentifierHash hash) const{ + if(m_cachedChannelsNoise.find((unsigned int) hash)==m_cachedChannelsNoise.end()) return m_nillfloat; + return m_cachedChannelsNoise.find((unsigned int) hash)->second; +} + +// getChannelPed +const +float& CscCondDbData::getChannelPed(IdentifierHash hash) const{ + if(m_cachedChannelsPed.find((unsigned int) hash)==m_cachedChannelsPed.end()) return m_nillfloat; + return m_cachedChannelsPed.find((unsigned int) hash)->second; +} + +// getChannelPSlope +const +float& CscCondDbData::getChannelPSlope(IdentifierHash hash) const{ + if(m_cachedChannelsPSlope.find((unsigned int) hash)==m_cachedChannelsPSlope.end()) return m_nillfloat; + return m_cachedChannelsPSlope.find((unsigned int) hash)->second; +} + +// getChannelRMS +const +float& CscCondDbData::getChannelRMS(IdentifierHash hash) const{ + if(m_cachedChannelsRMS.find((unsigned int) hash)==m_cachedChannelsRMS.end()) return m_nillfloat; + return m_cachedChannelsRMS.find((unsigned int) hash)->second; +} + // getChannelStatus const int& CscCondDbData::getChannelStatus(IdentifierHash hash) const{ @@ -97,6 +276,75 @@ int& CscCondDbData::getChannelStatus(IdentifierHash hash) const{ return m_cachedChannelsStatus.find((unsigned int) hash)->second; } +// getChannelT0Base +const +float& CscCondDbData::getChannelT0Base(IdentifierHash hash) const{ + if(m_cachedChannelsT0Base.find((unsigned int) hash)==m_cachedChannelsT0Base.end()) return m_nillfloat; + return m_cachedChannelsT0Base.find((unsigned int) hash)->second; +} + +// getChannelT0Phase +const +bool& CscCondDbData::getChannelT0Phase(IdentifierHash hash) const{ + if(m_cachedChannelsT0Phase.find((unsigned int) hash)==m_cachedChannelsT0Phase.end()) return m_nillbool; + return m_cachedChannelsT0Phase.find((unsigned int) hash)->second; +} + +// readChannelF001 +StatusCode CscCondDbData::readChannelF001(IdentifierHash hash, float& val) const{ + val = getChannelF001(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelNoise +StatusCode CscCondDbData::readChannelNoise(IdentifierHash hash, float& val) const{ + val = getChannelNoise(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelPed +StatusCode CscCondDbData::readChannelPed(IdentifierHash hash, float& val) const{ + val = getChannelPed(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelPSlope +StatusCode CscCondDbData::readChannelPSlope(IdentifierHash hash, float& val) const{ + val = getChannelPSlope(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelRMS +StatusCode CscCondDbData::readChannelRMS(IdentifierHash hash, float& val) const{ + val = getChannelRMS(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelStatus +StatusCode CscCondDbData::readChannelStatus(IdentifierHash hash, int& val) const{ + val = getChannelStatus(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelT0Base +StatusCode CscCondDbData::readChannelT0Base(IdentifierHash hash, float& val) const{ + val = getChannelT0Base(hash); + if(val==-1) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + +// readChannelT0Phase +StatusCode CscCondDbData::readChannelT0Phase(IdentifierHash hash, bool& val) const{ + if(!hasChannelT0Phase(hash)) return StatusCode::FAILURE; + val = getChannelT0Phase(hash); + return StatusCode::SUCCESS; +} @@ -137,3 +385,207 @@ CscCondDbData::isGoodStation(const Identifier & Id) const{ +// ID HELPER FUNCTIONS BELOW ------------------------------ + + +// indexToStringId +StatusCode +CscCondDbData::indexToStringId(const CscIdHelper* idHelper, const unsigned int & index, const std::string & cat, std::string & idString) const { + // copy-paste from CscCoolStrSvc + + //There is no string id for the CSC category. + if(cat == "CSC") { + idString = ""; + return StatusCode::SUCCESS; + } + if(cat == "ENDCAP") { + if(index == 0) + idString = "-1"; + if(index == 1) + idString = "1"; + else { + std::cout << "Requested index " << index << " can't be converted to a string Id for the category " << cat << std::endl; + return StatusCode::RECOVERABLE; + } + } + + //remaining categories need online identifiers + unsigned int onlineId = 0; + std::stringstream ss; + if(cat == "CHAMBER"){ + Identifier chamberId; + idHelper->get_id(IdentifierHash(index), chamberId, &m_moduleContext); + if(!offlineElementToOnlineId(idHelper, chamberId, onlineId).isSuccess()) { + std::cout << "Failed converting chamber identifier to online id during stringId gen." << std::endl; + return StatusCode::RECOVERABLE; + } + } + else if(cat == "LAYER"){ + unsigned int onlineId; + if(!layerHashToOnlineId(index, onlineId)){ + std::cout << "Failed at getting online id from layer hash during stringId gen." << std::endl; + } + } + else if(cat == "CHANNEL"){ + Identifier channelId; + idHelper->get_id(IdentifierHash(index), channelId, &m_channelContext); + if(!offlineToOnlineId(idHelper, channelId, onlineId).isSuccess()) { + std::cout << "Failed converting chamber identifier to online id during stringId gen." << std::endl; + return StatusCode::RECOVERABLE; + } + } + + ss << std::hex << std::setfill('0') << std::setw(5) << onlineId << std::dec; + idString = ss.str(); + return StatusCode::SUCCESS; +} + + +// layerHashToOnlineId +StatusCode +CscCondDbData::layerHashToOnlineId(const unsigned int & layerHash, unsigned int & onlineId) const { + // copy-paste from CscCoolStrSvc + + if(layerHash > m_onlineChannelIdsFromLayerHash.size()) { + std::cout << "Tried to lookup online id from layer hash " << layerHash <<". Max is " << m_onlineChannelIdsFromLayerHash.size() << std::endl; + return StatusCode::SUCCESS; + } + onlineId = m_onlineChannelIdsFromLayerHash[layerHash]; + return StatusCode::SUCCESS; +} + + +// offlineElementToOnlineId +StatusCode +CscCondDbData::offlineElementToOnlineId(const CscIdHelper* idHelper, const Identifier & id, unsigned int &onlineId) const { + // copy-paste from CscCoolStrSvc + + onlineId = 0; + //Phi,wireLayer,and strip all are offset by one between the two schemes. + //Also, station name is 50 or 51 in Identifiers, but only 0 or 1 in + //the online id. + int stationName ((idHelper->stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 + int phi = (idHelper->stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 + int eta = ((idHelper->stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 + int chamLay = 1; // 0000 0000 1000 0000 0000 + int wireLay = 0; // 0000 0000 0110 0000 0000 + int measuresPhi = 0; // 0000 0000 0001 0000 0000 + int strip = 0; // 0000 0000 0000 1111 1111 + + onlineId += (stationName << 16); // 0001 0000 0000 0000 0000 + onlineId += (phi << 13) ; // 0000 1110 0000 0000 0000 + onlineId += (eta <<12); // 0000 0001 0000 0000 0000 + onlineId += (chamLay <<11); // 0000 0000 1000 0000 0000 + onlineId += (wireLay << 9); // 0000 0000 0110 0000 0000 + onlineId += (measuresPhi << 8); // 0000 0000 0001 0000 0000 + onlineId += strip ; // 0000 0000 0000 1111 1111 + return StatusCode::SUCCESS; +} + + +// offlineToOnlineId +StatusCode +CscCondDbData::offlineToOnlineId(const CscIdHelper* idHelper, const Identifier & id, unsigned int &onlineId) const { + // copy-paste from CscCoolStrSvc + + onlineId = 0; + //Phi,wireLayer,and strip all are offset by one between the two schemes. + //Also, station name is 50 or 51 in Identifiers, but only 0 or 1 in + //the online id. + int stationName ((idHelper->stationName(id) -50)&0x1 ); // 0001 0000 0000 0000 0000 + int phi = (idHelper->stationPhi(id) - 1)&0x7 ; // 0000 1110 0000 0000 0000 + int eta = ((idHelper->stationEta(id) == 1) ? 1:0) &0x1; // 0000 0001 0000 0000 0000 + int chamLay = (idHelper->chamberLayer(id)-1) &0x1; // 0000 0000 1000 0000 0000 + int wireLay = (idHelper->wireLayer(id)-1) &0x3; // 0000 0000 0110 0000 0000 + int measuresPhi = (idHelper->measuresPhi(id) &0x1); // 0000 0000 0001 0000 0000 + int strip; // 0000 0000 0000 1111 1111 + + //Online and offline phi ids are flipped on A wheel + if(m_onlineOfflinePhiFlip && measuresPhi && eta == 1){ + strip = (48 - (idHelper->strip(id))) & 0xff; + } + else { + strip = (idHelper->strip(id)-1) & 0xff; + } + + + onlineId += (stationName << 16); // 0001 0000 0000 0000 0000 + onlineId += (phi << 13) ; // 0000 1110 0000 0000 0000 + onlineId += (eta <<12); // 0000 0001 0000 0000 0000 + onlineId += (chamLay <<11); // 0000 0000 1000 0000 0000 + onlineId += (wireLay << 9); // 0000 0000 0110 0000 0000 + onlineId += (measuresPhi << 8); // 0000 0000 0001 0000 0000 + onlineId += strip ; // 0000 0000 0000 1111 1111 + return StatusCode::SUCCESS; +} + + +// onlineToOfflineElementId +StatusCode +CscCondDbData::onlineToOfflineElementId(const CscIdHelper* idHelper, const unsigned int & onlineId, Identifier &elementId) const { + // copy-paste from CscCoolStrSvc + + int stationName = ((onlineId >> 16)&0x1) + 50; + int phi = ((onlineId >> 13)&0x7)+1; + int eta = ((((onlineId >> 12)&0x1) == 1) ? 1:-1); + + elementId = idHelper->elementID(stationName,eta,phi); + return StatusCode::SUCCESS; +} + + +// onlineToOfflineChannelId +StatusCode +CscCondDbData::onlineToOfflineChannelId(const CscIdHelper* idHelper, const unsigned int & onlineId, Identifier &chanId) const { + // copy-paste from CscCoolStrSvc + + 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; + } + + chanId = idHelper->channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); + return StatusCode::SUCCESS; +} + + +// onlineToOfflineIds +StatusCode +CscCondDbData::onlineToOfflineIds(const CscIdHelper* idHelper, const unsigned int & onlineId, Identifier &elementId, Identifier &channelId) const { + // copy-paste from CscCoolStrSvc + + 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 = idHelper->elementID(stationName,eta,phi); + channelId = idHelper->channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip); + + return StatusCode::SUCCESS; +} + + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/CSCConditionsTestAlgMT.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/CSCConditionsTestAlgMT.h new file mode 100644 index 0000000000000000000000000000000000000000..fd8a3c1dd34d1e84aaa4bf7e191cc0c0c1da07b3 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/MuonCondTest/CSCConditionsTestAlgMT.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CSCConditionsTestAlgMT_H +#define CSCConditionsTestAlgMT_H + +//STL +#include <string> +#include <sstream> + +//Gaudi +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/StatusCode.h" + +//Athena +#include "Identifier/IdentifierHash.h" +#include "MuonCondData/CscCondDbData.h" +#include "MuonCondSvc/MuonHierarchy.h" + + +//Forward declarations +class ISvcLocator; +class StatusCode; +class CscCondDbData; + + + +///Example class to show calling the SCT_ConditionsSummarySvc +class CSCConditionsTestAlgMT : public AthAlgorithm { + + public: + CSCConditionsTestAlgMT(const std::string &name,ISvcLocator *pSvcLocator) ; + virtual ~CSCConditionsTestAlgMT(); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private: + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; + +}; //end of class + +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py new file mode 100644 index 0000000000000000000000000000000000000000..f92ef1d0eeac97d36786fe4e438a8214bd30d3f2 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/share/CSCCondSummary_topOptionsMT.py @@ -0,0 +1,154 @@ +# Copyright (C) 2002-2020 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") +elif run=="dataR1": + conddb.setGlobalTag("COMCOND-BLKPA-RUN1-09") +elif run=="dataR2": + conddb.setGlobalTag("CONDBR2-BLKPA-2018-15") + +conddb.addFolder("CSC_OFL", "/CSC/FTHOLD" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/NOISE" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/PED" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/PSLOPE" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/RMS" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/STAT" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/T0BASE" , className='CondAttrListCollection'); +conddb.addFolder("CSC_OFL", "/CSC/T0PHASE", 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 CscCondDbAlg +alg = CscCondDbAlg("CscCondDbAlg", IdHelper=getPublicTool("Muon::MuonIdHelperTool")) + +if "mc" in run: + 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 +##-------------------------------------------------------------- +from MuonCondTest.MuonCondTestConf import CSCConditionsTestAlgMT +job += CSCConditionsTestAlgMT() + + + +##-------------------------------------------------------------- +## 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/CSCConditionsTestAlgMT.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/CSCConditionsTestAlgMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c916e9f64124b5b82470a3c8e68a333a2a6b122d --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/CSCConditionsTestAlgMT.cxx @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondTest/CSCConditionsTestAlgMT.h" + +//Constructor +CSCConditionsTestAlgMT::CSCConditionsTestAlgMT( + const std::string& name, + ISvcLocator* pSvcLocator ) : + AthAlgorithm( name, pSvcLocator ){ + +} + +//Destructor +CSCConditionsTestAlgMT::~CSCConditionsTestAlgMT(){ + ATH_MSG_VERBOSE( "Calling destructor" ); +} + +//Initialize +StatusCode +CSCConditionsTestAlgMT::initialize(){ + ATH_MSG_INFO("Calling initialize"); + ATH_CHECK(m_readKey.initialize()); + return StatusCode::SUCCESS; +} + +//Execute +StatusCode +CSCConditionsTestAlgMT::execute(){ + StatusCode sc(StatusCode::SUCCESS); + + ATH_MSG_INFO("Calling execute"); + std::stringstream ss; + ss << "Now setting up read handle: "; + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* 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(); + + unsigned int hash = 24903; + ATH_MSG_INFO("Focussing on channel with hash " << hash); + ATH_MSG_INFO("Reading F001 =====> "<<readCdo->getChannelF001 (hash)); + ATH_MSG_INFO("Reading Noise ====> "<<readCdo->getChannelNoise (hash)); + ATH_MSG_INFO("Reading Pedestal => "<<readCdo->getChannelPed (hash)); + ATH_MSG_INFO("Reading PSlope ===> "<<readCdo->getChannelPSlope (hash)); + ATH_MSG_INFO("Reading RMS ======> "<<readCdo->getChannelRMS (hash)); + ATH_MSG_INFO("Reading Status ===> "<<readCdo->getChannelStatus (hash)); + ATH_MSG_INFO("Reading T0Base ===> "<<readCdo->getChannelT0Base (hash)); + ATH_MSG_INFO("Reading T0Phase ==> "<<readCdo->getChannelT0Phase(hash)); + ATH_MSG_INFO("Is it Good? ======> "<<readCdo->isGoodChannelHash(hash)); + + ATH_MSG_INFO("MADE IT TO THE END!!"); + return sc; +} + + +//Finalize +StatusCode +CSCConditionsTestAlgMT::finalize(){ + ATH_MSG_INFO("Calling finalize"); + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx index 25eb630a517bd0cdf356e4e7e050d08fa4619dbf..f54988832bc47e1a98ecd6831a515c5e38255e7d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/src/MuonCondTest_entries.cxx @@ -1,21 +1,22 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCondTest/AlignCondAthTest.h" #include "MuonCondTest/MuonDetectorStatusTest.h" -//#include "MuonCondTest/RpcStatusTest.h" #include "MuonCondTest/MuonConditionsTestAlg.h" #include "MuonCondTest/MDT_DCSStatusTest.h" #include "MuonCondTest/MDTConditionsTestAlg.h" +#include "MuonCondTest/MDTConditionsTestAlgMT.h" +#include "MuonCondTest/CSCConditionsTestAlgMT.h" #include "MuonCondTest/RPCStatusTestAlg.h" #include "MuonCondTest/MuonConditionsHistoSummary.h" DECLARE_COMPONENT( AlignCondAthTest ) DECLARE_COMPONENT( MuonDetectorStatusTest ) -//DECLARE_COMPONENT( RpcStatusTest ) DECLARE_COMPONENT( MuonConditionsTestAlg ) DECLARE_COMPONENT( MDT_DCSStatusTest ) DECLARE_COMPONENT( MDTConditionsTestAlg ) +DECLARE_COMPONENT( MDTConditionsTestAlgMT ) +DECLARE_COMPONENT( CSCConditionsTestAlgMT ) DECLARE_COMPONENT( RPCStatusTestAlg ) DECLARE_COMPONENT( MuonConditionsHistoSummary ) - diff --git a/MuonSpectrometer/MuonConfig/python/CSC_DigitizationConfig.py b/MuonSpectrometer/MuonConfig/python/CSC_DigitizationConfig.py index b77270404c08adf6e060f163a9e07babd2641cab..800e8751c3f03dbb9b319646f5263e9aabde9830 100644 --- a/MuonSpectrometer/MuonConfig/python/CSC_DigitizationConfig.py +++ b/MuonSpectrometer/MuonConfig/python/CSC_DigitizationConfig.py @@ -1,12 +1,12 @@ """Define methods to construct configured CSC Digitization tools and algorithms -Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg -from MuonConfig.MuonCalibConfig import CscCoolStrSvcCfg +from MuonConfig.MuonCondAlgConfig import CscCondDbAlgCfg CscDigitizationTool, CscDigitBuilder=CompFactory.getComps("CscDigitizationTool","CscDigitBuilder",) PileUpXingFolder=CompFactory.PileUpXingFolder from MuonConfig.MuonByteStreamCnvTestConfig import CscDigitToCscRDOCfg, CscOverlayDigitToCscRDOCfg @@ -83,7 +83,7 @@ def CSC_OutputCfg(flags): def CSC_DigitizationBasicCfg(flags, **kwargs): """Return ComponentAccumulator for CSC digitization""" acc = MuonGeoModelCfg(flags) - acc.merge(CscCoolStrSvcCfg(flags)) + acc.merge(CscCondDbAlgCfg(flags)) if "PileUpTools" not in kwargs: PileUpTools = acc.popToolsAndMerge(CSC_DigitizationToolCfg(flags)) kwargs["PileUpTools"] = PileUpTools @@ -94,7 +94,7 @@ def CSC_DigitizationBasicCfg(flags, **kwargs): def CSC_OverlayDigitizationBasicCfg(flags, **kwargs): """Return ComponentAccumulator with CSC Overlay digitization""" acc = MuonGeoModelCfg(flags) - acc.merge(CscCoolStrSvcCfg(flags)) + acc.merge(CscCondDbAlgCfg(flags)) if "DigitizationTool" not in kwargs: tool = acc.popToolsAndMerge(CSC_OverlayDigitizationToolCfg(flags)) kwargs["DigitizationTool"] = tool diff --git a/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py index 90d28f42feb93ad5b74cb04ee4d4a4d498e912d6..63a3e3bf72b9e8cfc9b740007a19caf082b898c4 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py @@ -1,12 +1,13 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Based on : https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py +from MuonConfig.MuonCondAlgConfig import CscCondDbAlgCfg from AthenaConfiguration.ComponentFactory import CompFactory MuonCalib__CscCoolStrSvc=CompFactory.MuonCalib__CscCoolStrSvc MuonCalib__MdtCalibDbCoolStrTool=CompFactory.MuonCalib__MdtCalibDbCoolStrTool from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline +from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg CscCalibTool=CompFactory.CscCalibTool @@ -20,7 +21,7 @@ log = logging.getLogger('MuonCalibConfig') def CscCalibToolCfg(flags, name="CscCalibTool", **kwargs): """Return ComponentAccumulator configured for CSC calibration with CscCalibTool as PrivateTools""" - acc = CscCoolStrSvcCfg(flags) + acc = CscCondDbAlgCfg(flags) kwargs.setdefault("Slope", 0.19) kwargs.setdefault("Noise", 3.5) @@ -40,323 +41,6 @@ def CscCalibToolCfg(flags, name="CscCalibTool", **kwargs): return acc -def _setupCscCondDB( flags, name, key, dataType, cat, default, folder, database, useLocal, override="" ): - - # The followng codes should be cleaned up by CSC experts, - # since they quate a few verses from the following two files - # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py - # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/python/CscCondDB.py - - acc = ComponentAccumulator() - - # This need to adapt FolderSuffix variable - #fullSuffix = " <key>" + key + "</key> " + self.FolderSuffix - fullSuffix = " <key>" + key + "</key> " - - oflFolderString = '/CSC/' + folder + fullSuffix - onlFolderString = '/CSC/ONL/' + folder + fullSuffix - - if useLocal: - #assume when local, the folder will be in offline location. - #Maybe add more options in future - acc.merge( addFolders( flags, oflFolderString, "LOCAL" ) ) - elif database=='CSC': - acc.merge( addFoldersSplitOnline( flags, database, onlFolderString, oflFolderString ) ) - elif database=='CSC_OFL': - acc.merge( addFolders( flags, oflFolderString, database ) ) - else: - log.error("Failed to recognize database: " + database + " for parameter " + name) - return acc - - if override: - if useLocal: - #assume when local, the folder will be in offline location. - #Maybe add more options in future - overfolder = oflFolderString.split()[0] #Get folder without suffix - elif database=='CSC': - if flags.Common.isOnline: - overfolder = onlFolderString.split()[0] #Get folder without suffix - else: - overfolder = oflFolderString.split()[0] #Get folder without suffix - elif database=='CSC_OFL': - overfolder = oflFolderString.split()[0] #Get folder without suffix - else: - log.error("Failed to recognize database: " + database + " for parameter " + name) - return acc - log.info("Overriding folder for " + name + "(" + overfolder + ") to " + override) - #acc.merge( addOverride( flags, overfolder, override ) ) - - return acc - -def CscCoolStrSvcCfg( flags ): - - acc = ComponentAccumulator() - - # used folders - pslopeFolder = "PSLOPE" # Pulser run gain - pedFolder = "PED" # Pedestals - noiseFolder = "NOISE" # Noise (Sigma from pedestal gaussian fit) - rmsFolder = "RMS" # Rms of pedestal histograms (not from fit) - f001Folder = "FTHOLD" # F001 threshold values - statusFolder = "STAT" # Status Bits - t0baseFolder = "T0BASE" - t0phaseFolder = "T0PHASE" - - # unused folders - #gainFolder = "GAIN" - #runSlopeFolder = "RSLOPE" - #tholdFolder = "THOLD" - #peaktFolder = "PEAKT" - #widthFolder = "WIDTH" - #sat1Folder = "SAT1" - #sat2Folder = "SAT2" - - # Set CscCoolStr Svc to prepare condDB for pedestal, noise and so on - CscCoolStrSvc = MuonCalib__CscCoolStrSvc() - acc.addService( CscCoolStrSvc ) - - # The followng codes should be cleaned up by CSC experts, - # since they quate a few verses from the following two files - # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonCnv/MuonCnvExample/python/MuonCalibConfig.py - # https://gitlab.cern.ch/atlas/athena/blob/master/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/python/CscCondDB.py - - # Adds pedestal and noise folders - if flags.Muon.Calib.CscPedFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="ped", key="CSC_PED", dataType="float", cat="CHANNEL", - default="2048", folder=pedFolder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "ped" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_PED" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "2048" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + pedFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + pedFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="ped", key="CSC_PED", dataType="float", cat="CHANNEL", - default="2048", folder=pedFolder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "ped" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_PED" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "2048" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + pedFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + pedFolder) - - # Load Noise File - if flags.Muon.Calib.CscNoiseFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="noise", key="CSC_NOISE", dataType="float", cat="CHANNEL", - default="3.5", folder=noiseFolder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "noise" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_NOISE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "3.5" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + noiseFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + noiseFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="noise", key="CSC_NOISE", dataType="float", cat="CHANNEL", - default="3.5", folder=noiseFolder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "noise" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_NOISE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "3.5" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + noiseFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + noiseFolder) - - ### Load PSlope File - if flags.Muon.Calib.CscPSlopeFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="pslope", key="CSC_PSLOPE", dataType="float", cat="CHANNEL", - default="0.189", folder=pslopeFolder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "pslope" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_PSLOPE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0.189" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + pslopeFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + pslopeFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="pslope", key="CSC_PSLOPE", dataType="float", cat="CHANNEL", - default="0.189", folder=pslopeFolder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "pslope" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_PSLOPE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0.189" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + pslopeFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + pslopeFolder) - - ## Load Status File - if flags.Muon.Calib.CscStatusFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="status", key="CSC_STAT", dataType="uint32_t", cat="CHANNEL", - default="0", folder=statusFolder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "status" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_STAT" ) - CscCoolStrSvc.ParDataTypes.append( "uint32_t" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + statusFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + statusFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="status", key="CSC_STAT", dataType="uint32_t", cat="CHANNEL", - default="0", folder=statusFolder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "status" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_STAT" ) - CscCoolStrSvc.ParDataTypes.append( "uint32_t" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + statusFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + statusFolder) - - ## Load Rms File - if flags.Muon.Calib.CscRmsFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="rms", key="CSC_RMS", dataType="float", cat="CHANNEL", - default="2.56", folder=rmsFolder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "rms" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_RMS" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "2.56" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + rmsFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + rmsFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="rms", key="CSC_RMS", dataType="float", cat="CHANNEL", - default="2.56", folder=rmsFolder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "rms" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_RMS" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "2.56" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + rmsFolder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + rmsFolder) - - ## Load F001 File - if flags.Muon.Calib.CscF001FromLocalFile: - acc.merge( _setupCscCondDB( flags, name="f001", key="CSC_FTHOLD", dataType="float", cat="CHANNEL", - default="0", folder=f001Folder, database="CSC", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "f001" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_FTHOLD" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + f001Folder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + f001Folder) - - else: - acc.merge( _setupCscCondDB( flags, name="f001", key="CSC_FTHOLD", dataType="float", cat="CHANNEL", - default="0", folder=f001Folder, database="CSC", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "f001" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_FTHOLD" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - - if flags.Common.isOnline: - CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + f001Folder) - else: - CscCoolStrSvc.ParFolders.append('/CSC/' + f001Folder) - - # Offline only - if not flags.Common.isOnline: - - ## Load T0Base File - if flags.Muon.Calib.CscT0BaseFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="t0base", key="CSC_T0BASE", dataType="float", cat="CHANNEL", - default="0", folder=t0baseFolder, database="CSC_OFL", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "t0base" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_T0BASE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - CscCoolStrSvc.ParFolders.append('/CSC/' + t0baseFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="t0base", key="CSC_T0BASE", dataType="float", cat="CHANNEL", - default="0", folder=t0baseFolder, database="CSC_OFL", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "t0base" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_T0BASE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "CHANNEL" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - CscCoolStrSvc.ParFolders.append('/CSC/' + t0baseFolder) - - ## Load T0Phase File - if flags.Muon.Calib.CscT0PhaseFromLocalFile: - acc.merge( _setupCscCondDB( flags, name="t0phase", key="CSC_T0PHASE", dataType="float", cat="ASM", - default="0", folder=t0phaseFolder, database="CSC_OFL", useLocal=True, override="" ) ) - - CscCoolStrSvc.ParNames.append( "t0phase" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_T0PHASE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "ASM" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - CscCoolStrSvc.ParFolders.append('/CSC/' + t0phaseFolder) - - else: - acc.merge( _setupCscCondDB( flags, name="t0phase", key="CSC_T0PHASE", dataType="float", cat="ASM", - default="0", folder=t0phaseFolder, database="CSC_OFL", useLocal=False, override="" ) ) - - CscCoolStrSvc.ParNames.append( "t0phase" ) - CscCoolStrSvc.ParSGKeys.append( "CSC_T0PHASE" ) - CscCoolStrSvc.ParDataTypes.append( "float" ) - CscCoolStrSvc.ParCats.append( "ASM" ) - CscCoolStrSvc.ParDefaults.append( "0" ) - CscCoolStrSvc.ParFolders.append('/CSC/' + t0phaseFolder) - - - return acc ################################################################################ # MDT calibration diff --git a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py index a1240cfd012f51283a2d812ad9b9259026918575..61cf8b76dc040ca52dfb12e537c3032294602177 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## Configuration Access to OFFLINE DB (COMP200) @@ -55,10 +55,19 @@ def RpcCondDbAlgCfg(flags, **kwargs): def CscCondDbAlgCfg(flags, **kwargs): result = ComponentAccumulator() - folders = ["/CSC/STAT"] + folders = ["/CSC/FTHOLD", "/CSC/NOISE", "/CSC/PED", "/CSC/PSLOPE", "/CSC/RMS", "/CSC/STAT", "/CSC/T0BASE", "/CSC/T0PHASE"] + scheme = "CSC_OFL" if flags.Common.isOnline: - return result ## avoid adding algo to the component accumulator - kwargs["isOnline"] = True + kwargs["isOnline" ] = True + kwargs['isData' ] = True + kwargs['ReadKey_FT'] = '/CSC/FTHOLD' # 'ConditionsStore+' prefix not necessarily needed in ReadKey + kwargs['ReadKey_NO'] = '/CSC/NOISE' + kwargs['ReadKey_PD'] = '/CSC/PED' + kwargs['ReadKey_PS'] = '/CSC/PSLOPE' + kwargs['ReadKey_RM'] = '/CSC/RMS' + kwargs['ReadKey_ST'] = '/CSC/STAT' + folders = ["/CSC/ONL/FTHOLD", "/CSC/ONL/NOISE", "/CSC/ONL/PED", "/CSC/ONL/PSLOPE", "/CSC/ONL/RMS", "/CSC/ONL/STAT"] + scheme = "CSC_ONL" else: kwargs["isOnline"] = False if flags.Input.isMC: @@ -67,7 +76,7 @@ def CscCondDbAlgCfg(flags, **kwargs): kwargs['isData'] = True kwargs['isRun1'] = flags.IOVDb.DatabaseInstance == 'COMP200' alg = CscCondDbAlg(**kwargs) - result.merge( addFolders(flags, folders , detDb="CSC_OFL", className='CondAttrListCollection') ) + result.merge( addFolders(flags, folders , detDb=scheme, className='CondAttrListCollection') ) result.addCondAlgo(alg) return result diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py index c96dd5743c3aa6ac561071a80147c33fd30f4c18..b688aec495bfb6e214571d182deaf34476fbd48d 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -142,8 +142,8 @@ def CscRDODecodeCfg(flags, forTrigger=False): from MuonConfig.MuonCablingConfig import CSCCablingConfigCfg # Not yet been prepared acc.merge( CSCCablingConfigCfg(flags) ) - from MuonConfig.MuonCalibConfig import CscCoolStrSvcCfg - acc.merge( CscCoolStrSvcCfg(flags) ) + from MuonConfig.MuonCondAlgConfig import CscCondDbAlgCfg + acc.merge( CscCondDbAlgCfg(flags) ) # Make sure muon geometry is configured from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg diff --git a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py index 8bd8a88ba6ef220671400c6146a1cac18fa3fb82..7477882d7cfdfe1592cf362c4de52ca67907cc28 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py @@ -1,5 +1,5 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # This file configures the Muon segment finding. It is based on a few files in the old configuration system: # Tools, which are configured here: @@ -429,16 +429,11 @@ def CscClusterUtilToolCfg(flags, name='CscClusterUtilTool', **kwargs): def CscSegmentUtilToolCfg(flags, name='CscSegmentUtilTool', **kwargs): CscSegmentUtilTool=CompFactory.CscSegmentUtilTool from MuonConfig.MuonRIO_OnTrackCreatorConfig import CscClusterOnTrackCreatorCfg - from MuonConfig.MuonCalibConfig import CscCoolStrSvcCfg result=CscClusterOnTrackCreatorCfg(flags) csc_cluster_creator = result.getPrimary() kwargs.setdefault("rot_creator", csc_cluster_creator ) - acc = CscCoolStrSvcCfg(flags) - # NB no property to configure right now. - result.merge(acc) - result.setPrivateTools(CscSegmentUtilTool( name=name, **kwargs)) return result diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CMakeLists.txt index 7334c8dd9ee2b809171408e1b13ab52fd95e37bc..3e3fe6efef4d02f84a8382f40db727311aad88f8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CMakeLists.txt @@ -23,7 +23,8 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkRoad @@ -38,7 +39,7 @@ atlas_add_component( CscSegmentMakers src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} GeoPrimitives GaudiKernel MuonPrepRawData MuonSegment AthenaBaseComps StoreGateLib SGtests Identifier EventPrimitives xAODEventInfo MuonReadoutGeometry MuonIdHelpersLib CscClusterizationLib MuonRIO_OnTrack MuonRecHelperToolsLib MuonRecToolInterfaces TrkSurfaces TrkEventPrimitives TrkRoad TrkSegment ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} GeoPrimitives GaudiKernel MuonPrepRawData MuonSegment AthenaBaseComps StoreGateLib SGtests Identifier EventPrimitives xAODEventInfo MuonReadoutGeometry MuonIdHelpersLib CscClusterizationLib MuonRIO_OnTrack MuonRecHelperToolsLib MuonRecToolInterfaces MuonCondData TrkSurfaces TrkEventPrimitives TrkRoad TrkSegment ) # Install files from the package: atlas_install_headers( CscSegmentMakers ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx index 97821d31fd4ed86eba38e7bf210fc071e616627d..b08921b545d57e415814220fc48ee719e16f1b70 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscSegmentUtilTool.h" @@ -25,10 +25,8 @@ #include "TrkSurfaces/RotatedTrapezoidBounds.h" #include "CscSegmentMakers/ICscSegmentFinder.h" -#include "MuonRecToolInterfaces/ICscClusterOnTrackCreator.h" #include "CscClusterization/ICscClusterFitter.h" #include "CscClusterization/ICscStripFitter.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "EventPrimitives/EventPrimitivesHelpers.h" @@ -96,9 +94,7 @@ namespace { CscSegmentUtilTool::CscSegmentUtilTool (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type,name,parent), - m_rotCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator"), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc", name) + m_rotCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator") { declareInterface<ICscSegmentUtilTool>(this); declareProperty("max_chisquare_tight", m_max_chisquare_tight = 16.); // 16 for outlier removal... @@ -126,12 +122,6 @@ CscSegmentUtilTool::CscSegmentUtilTool } -//****************************************************************************** - -/** destructor */ -CscSegmentUtilTool::~CscSegmentUtilTool() -{} - /*********************************/ StatusCode CscSegmentUtilTool::initialize() { @@ -145,7 +135,6 @@ StatusCode CscSegmentUtilTool::initialize() ATH_MSG_DEBUG ( " ROT tan(theta) tolerance: " << m_fitsegment_tantheta_tolerance ); ATH_MSG_DEBUG ( " cluster_error_scaler " << m_cluster_error_scaler); - //ATH_MSG_DEBUG ( " Precision cluster fitter is " << m_rotCreator->GetICscClusterFitter().typeAndName() ); ATH_MSG_DEBUG ( " ROT creator: " << m_rotCreator.typeAndName() ); @@ -155,22 +144,9 @@ StatusCode CscSegmentUtilTool::initialize() if (m_x5data) ATH_MSG_DEBUG (" Things for X5Data analysis is applied such as alignment "); - if ( m_rotCreator.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Could not get " << m_rotCreator ); - return StatusCode::FAILURE; - }else{ - ATH_MSG_DEBUG ( "Got " << m_rotCreator ); - } - - if ( m_idHelper.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Could not get " << m_idHelper ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_rotCreator.retrieve()); - if ( m_cscCoolStrSvc.retrieve().isFailure() ) { - ATH_MSG_FATAL ( "Unable to retrieve pointer to the CSC COLL Conditions Service" ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_DetectorManagerKey.initialize()); @@ -892,13 +868,6 @@ spoiled_count(const ICscSegmentFinder::RioList& rios, int& nspoil, int& nunspoil } -//****************************************************************************** -StatusCode CscSegmentUtilTool::finalize() { - ATH_MSG_DEBUG ( "Goodbye" ); - return StatusCode::SUCCESS; -} - - //****************************************************************************** // Build an ATLAS segment. // Using the muon convention that x is normal to the plane of measurement: @@ -915,9 +884,6 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch ATH_MSG_DEBUG ( "Building csc segment." ); - //if(use2Lay) std::cout<<"using 2-layer segments"<<std::endl; - //std::cout<<"CscSegmentUtilTool::build_segment in chamber "<<m_idHelper->toString(chid)<<std::endl; - const double pi = acos(-1.0); const double pi2 = 0.5*pi; SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; @@ -1091,8 +1057,6 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch // Create new calibrated hit to put into fitclus const CscPrepData* prd = pcl->prepRawData(); Amg::Vector3D lpos = gToLocal*pcl->globalPosition(); - // std::cout << " " << m_idHelper->toString(pcl->identify()) << " lpos " << lpos << " locPos " << prd->localPosition() << std::endl; - ATH_MSG_DEBUG ( " ---+++----> build_segment each rios time " << pcl->time() << " " << prd->time() ); @@ -2061,13 +2025,11 @@ make_4dMuonSegment(const MuonSegment& rsg, const MuonSegment& psg, bool use2LayS int iw_phi = m_idHelperSvc->cscIdHelper().wireLayer(id_phi); // Check to see if these are the same layers. - // if(use2LaySegs) std::cout<<" id_eta: " << m_idHelper->toString(id_eta) << " " <<" id_phi: " << m_idHelper->toString(id_phi)<<std::endl; if (iw_eta != iw_phi){ - // if(use2LaySegs) std::cout<<"hits in different layers, skip"<<std::endl; continue; } - ATH_MSG_DEBUG ( " id_eta: " << m_idHelper->toString(id_eta) << " " << - " id_phi: " << m_idHelper->toString(id_phi) ); + ATH_MSG_DEBUG ( " id_eta: " << m_idHelperSvc->toString(id_eta) << " " << + " id_phi: " << m_idHelperSvc->toString(id_phi) ); /* commenting out because : 1/ coverity defect 13763+4 "Unchecked dynamic_cast" 2/ segment finding must be fast, dynamic cast is time consuming, here only used for dbg cout ... @@ -2534,23 +2496,14 @@ bool CscSegmentUtilTool::isGood(uint32_t stripHashId) const { } int CscSegmentUtilTool::stripStatusBit ( uint32_t stripHashId ) const { - uint32_t status = 0x0; - if ( !m_cscCoolStrSvc->getStatus(status,stripHashId) ) { + + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + + int status = 0; + if(!readCdo->readChannelStatus(stripHashId, status).isSuccess()) ATH_MSG_WARNING ( " failed to access CSC conditions database - status - " << "strip hash id = " << stripHashId ); - - uint8_t status2 = 0x0; - if ( (m_cscCoolStrSvc->getStatus(status2,stripHashId)).isFailure() ) { - ATH_MSG_WARNING ( " failed to access CSC conditions database old way - status - " - << "strip hash id = " << stripHashId ); - }else{ - ATH_MSG_INFO ( " Accessed CSC conditions database old way - status - " - << "strip hash id = " << stripHashId ); - } - } else { - ATH_MSG_VERBOSE ( "The status word is " << std::hex << status - << " for strip hash = " << std::dec << stripHashId ); - } return status; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h index 9be71d07aec75c10d0d86e3e095a04709a48dd32..ba6ec5c13323735cdc652c59c0a1a70648d89c39 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CscSegmentUtilTool_H @@ -9,16 +9,16 @@ #include <string> #include <vector> #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" // separately... +#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "CscSegmentMakers/ICscSegmentUtilTool.h" #include "CscClusterization/ICscClusterUtilTool.h" -#include "MuonCondInterface/CscICoolStrSvc.h" +#include "MuonRecToolInterfaces/ICscClusterOnTrackCreator.h" +#include "MuonCondData/CscCondDbData.h" #include "xAODEventInfo/EventInfo.h" #include "StoreGate/ReadHandleKey.h" -//#include "CscClusterization/CalibCscStripFitter.h" namespace MuonGM { class MuonDetectorManager; @@ -28,12 +28,11 @@ namespace Trk { class PlaneSurface; } namespace Muon { - class MuonIdHelperTool; class MuonSegment; - class ICscClusterOnTrackCreator; class CscPrepData; } class ICscSegmentFinder; +class CscCondDbData; class CscSegmentUtilTool : virtual public ICscSegmentUtilTool, public AthAlgTool { @@ -44,14 +43,9 @@ public: const IInterface* parent ); // Destructor. - virtual ~CscSegmentUtilTool(); - - // AlgTool InterfaceID - // static const InterfaceID& interfaceID( ) ; + virtual ~CscSegmentUtilTool() {}; virtual StatusCode initialize(); - virtual StatusCode finalize(); - // calls get2dMuonSegmentCombination and get4dMuonSegmentCombination with 2d segments!! std::unique_ptr<std::vector<std::unique_ptr<Muon::MuonSegment> > > @@ -117,11 +111,9 @@ private: // data int m_nunspoil; ToolHandle<Muon::ICscClusterOnTrackCreator> m_rotCreator; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; - - ServiceHandle<MuonCalib::CscICoolStrSvc> m_cscCoolStrSvc; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - + + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"EventInfo","EventInfo","event info"}; SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey {this, "DetectorManagerKey", diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx index be79959a779b9ab4057e2a50817258d58d55dabd..c1d11f05ea037d21a582aa52346243d39158a0a4 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.cxx @@ -1,19 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// ******************************************************************** -// -// NAME: CscCalibMonToolBase.cxx -// PACKAGE: MuonCalibMonitoring -// -// AUTHOR: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #include <sstream> - #include "CscCalibMonToolBase.h" using namespace std; @@ -46,7 +36,6 @@ using namespace std; //m_histCol(kOrange -9), m_histColAlert(kRed), m_monGroupVec(NULL), - m_cscCoolSvc(NULL), m_statDbColl(NULL) { @@ -65,20 +54,16 @@ using namespace std; declareProperty("DoStatDb", m_doStatDb = true); } -CscCalibMonToolBase::~CscCalibMonToolBase() -{ - ATH_MSG_INFO( " deleting CscCalibMonToolBase " ); -} /*-----------------------------------------------------*/ StatusCode CscCalibMonToolBase::initialize() { // init message stream - Part 1: Get the messaging service, print where you are ATH_MSG_INFO( "CscCalibMonToolBase : in initialize()" ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_MSG_DEBUG( " Found the MuonIdHelperTool. " ); - ATH_CHECK( service("MuonCalib::CscCoolStrSvc",m_cscCoolSvc) ); + ATH_CHECK( m_readKey.initialize() ); //m_generic_path_csccalibmonitoring = "Muon/MuonCalibrationMonitoring/CSC"; m_generic_path_csccalibmonitoring = "MUON_CSC"; @@ -90,8 +75,8 @@ StatusCode CscCalibMonToolBase::initialize() //Loop through ids to find out what hash range we're working on, and to //initialize histograms. - IdContext chanContext = m_muonIdHelperTool->cscIdHelper().channel_context(); - vector<Identifier> ids = m_muonIdHelperTool->cscIdHelper().idVector(); + IdContext chanContext = m_idHelperSvc->cscIdHelper().channel_context(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); m_maxHashId = 0; @@ -99,26 +84,26 @@ StatusCode CscCalibMonToolBase::initialize() for(; chamItr != chamEnd; chamItr++) { IdentifierHash chamberHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(*chamItr,chamberHash); + m_idHelperSvc->cscIdHelper().get_module_hash(*chamItr,chamberHash); if(chamberHash > m_maxChamId) m_maxChamId = chamberHash; vector<Identifier> stripVect; - m_muonIdHelperTool->cscIdHelper().idChannels(*chamItr,stripVect); + m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); vector<Identifier>::const_iterator stripItr = stripVect.begin(); vector<Identifier>::const_iterator stripEnd = stripVect.end(); for(;stripItr != stripEnd; stripItr++) { IdentifierHash stripHash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(*stripItr,stripHash); - bool measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(*stripItr); + m_idHelperSvc->cscIdHelper().get_channel_hash(*stripItr,stripHash); + bool measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(*stripItr); //Find maximum hash if((unsigned int)stripHash > m_maxHashId) m_maxHashId = (int)stripHash; if(m_expectedChamberLayer - == (unsigned int)m_muonIdHelperTool->cscIdHelper().chamberLayer(*stripItr) + == (unsigned int)m_idHelperSvc->cscIdHelper().chamberLayer(*stripItr) ) { ATH_MSG_VERBOSE( "hash " << (int)stripHash << " is expected" ); @@ -469,19 +454,19 @@ StatusCode CscCalibMonToolBase::bookLayHists(std::string histTypeDir, std::strin ATH_MSG_DEBUG( "Allocated space for " << numHists << " histograms" ); - vector<Identifier> ids = m_muonIdHelperTool->cscIdHelper().idVector(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); for(; chamItr != chamEnd; chamItr++) { IdentifierHash chamHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(*chamItr,chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(*chamItr,chamHash); ATH_MSG_DEBUG( "Booking histograms for chamber with hash " << (int)chamHash ); - stationSize = m_muonIdHelperTool->cscIdHelper().stationName(*chamItr); - stationName = m_muonIdHelperTool->cscIdHelper().stationNameString(stationSize); - stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(*chamItr); - stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(*chamItr); + stationSize = m_idHelperSvc->cscIdHelper().stationName(*chamItr); + stationName = m_idHelperSvc->cscIdHelper().stationNameString(stationSize); + stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(*chamItr); + stationEta = m_idHelperSvc->cscIdHelper().stationEta(*chamItr); sector = getSector(stationPhi,stationSize); for(unsigned int orientationItr = 0; orientationItr < 2; orientationItr++) { @@ -594,18 +579,18 @@ StatusCode CscCalibMonToolBase::bookChamHists(std::string histTypeDir, std::stri int numHists = (ignoreY) ? 32 : 64; //32 chambers, 2 orientations histVector.resize(numHists,NULL); - vector<Identifier> ids = m_muonIdHelperTool->cscIdHelper().idVector(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); for(; chamItr != chamEnd; chamItr++) { IdentifierHash chamHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(*chamItr,chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(*chamItr,chamHash); ATH_MSG_DEBUG( "Booking histograms for chamber with hash " << (int)chamHash ); - stationSize = m_muonIdHelperTool->cscIdHelper().stationName(*chamItr); //50 - stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(*chamItr); - stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(*chamItr); + stationSize = m_idHelperSvc->cscIdHelper().stationName(*chamItr); //50 + stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(*chamItr); + stationEta = m_idHelperSvc->cscIdHelper().stationEta(*chamItr); sector = getSector(stationPhi,stationSize); for(unsigned int orientationItr = 0; orientationItr < 2; orientationItr++) @@ -683,6 +668,9 @@ StatusCode CscCalibMonToolBase::bookHistograms() if(m_doStatDb){ //This is a histogram collection both derived classes will probably like + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + m_statDbColl = new HistCollection(m_maxHashId +1); string statDbName = "stat_cool"; string statDbTitle = "Status Word Value From COOL"; @@ -701,8 +689,8 @@ StatusCode CscCalibMonToolBase::bookHistograms() //Loop through channels retrieving status words for(unsigned int chanItr = 0; chanItr <= m_maxHashId; chanItr++){ if(m_expectedHashIdsAll.count(chanItr)) { - uint8_t statWord; - if(!(m_cscCoolSvc->getStatus(statWord, chanItr)).isSuccess()){ + int statWord; + if(!readCdo->readChannelStatus(chanItr, statWord).isSuccess()){ ATH_MSG_WARNING( "Failed to retrieve statword for hashId " << chanItr ); } @@ -802,6 +790,9 @@ StatusCode CscCalibMonToolBase::procParameter(const CscCalibResultCollection *pa //missing channels set<int> missingChannels = procParameterInput->expectedChannels; + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + //--Cycle through values and fill histograms int numFailures = 0, maxFailures = 10; CscCalibResultCollection::const_iterator chanItr = parVals->begin(); @@ -822,7 +813,7 @@ StatusCode CscCalibMonToolBase::procParameter(const CscCalibResultCollection *pa if(procParameterInput->dbName != "") { //Get expected value from database - if(!(m_cscCoolSvc->getParameter(oldVal, procParameterInput->dbName, hashId)).isSuccess()) + if(!(readCdo->readChannelParam(hashId, oldVal, procParameterInput->dbName)).isSuccess()) { numFailures++; ATH_MSG_WARNING( "CscCalibMonToolBase : Failed to retrieve parameter" @@ -940,50 +931,46 @@ StatusCode CscCalibMonToolBase::copyDataToHists(HistCollection * histCollection) << " chamber spectrum " << (int)doChamSummary ); - //cout << "TEST! hash " << (int)(histCollection->hashHist != NULL) << endl; - //cout << "TEST! layHist " << (int)(histCollection->layHistVect != NULL) << endl; - //cout << "TEST! laySumm " << ((histCollection->laySummVect != NULL) ? 1 : 0 )<< endl; - //For shorter lines: std::vector<float> & data = histCollection->data; std::vector<float> & errors = histCollection->errors; //Loop through all channels, and copy relevant data from channel to histogram. - vector<Identifier> ids = m_muonIdHelperTool->cscIdHelper().idVector(); + vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); vector<Identifier>::const_iterator chamItr = ids.begin(); vector<Identifier>::const_iterator chamEnd = ids.end(); for(; chamItr != chamEnd; chamItr++) { IdentifierHash chamHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(*chamItr,chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(*chamItr,chamHash); ATH_MSG_DEBUG( "Copying data to histograms for chamber with hash" << (int)chamHash ); - unsigned int stationSize = m_muonIdHelperTool->cscIdHelper().stationName(*chamItr); //51 = large, 50 = small + unsigned int stationSize = m_idHelperSvc->cscIdHelper().stationName(*chamItr); //51 = large, 50 = small - unsigned int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(*chamItr); - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(*chamItr); + unsigned int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(*chamItr); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(*chamItr); unsigned int sector = getSector(stationPhi,stationSize); int sectorIndex = sector * stationEta; //Histogram will go from -16 to +16. Bin 0 ignored. vector<Identifier> stripVect; - m_muonIdHelperTool->cscIdHelper().idChannels(*chamItr,stripVect); + m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); vector<Identifier>::const_iterator stripItr = stripVect.begin(); vector<Identifier>::const_iterator stripEnd = stripVect.end(); for(;stripItr != stripEnd; stripItr++) { - unsigned int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(*stripItr); + unsigned int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(*stripItr); if(chamberLayer != 2) continue; - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(*stripItr); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(*stripItr); if(histCollection->ignoreY && measuresPhi) continue; IdentifierHash stripHash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(*stripItr,stripHash); - unsigned int layer = m_muonIdHelperTool->cscIdHelper().wireLayer(*stripItr); - unsigned int strip = m_muonIdHelperTool->cscIdHelper().strip(*stripItr); + m_idHelperSvc->cscIdHelper().get_channel_hash(*stripItr,stripHash); + unsigned int layer = m_idHelperSvc->cscIdHelper().wireLayer(*stripItr); + unsigned int strip = m_idHelperSvc->cscIdHelper().strip(*stripItr); float secLayer = (((float)stationEta*sector) + 0.2 * ((float)layer - 1) + 0.1); float datum = data.at(stripHash); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h index 191e49eefdc50ac245b7147ab2bef10ce5d68619..ee7307030e14090fb43805d597d80ac5e2019b78 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolBase.h @@ -1,16 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// ******************************************************************** -// -// NAME: CscCalibMonTool.h -// PACKAGE: MuonCalibMonTool.h -// -// AUTHORS: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #ifndef CSCCALIBMONITORING_CSCCALIBMONTOOLBASE_H #define CSCCALIBMONITORING_CSCCALIBMONTOOLBASE_H @@ -27,16 +18,17 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -#include "MuonIdHelpers/CscIdHelper.h" #include "MuonCondData/CscCondDataCollection.h" #include "MuonCondData/CscCondDataContainer.h" -#include "MuonCondInterface/CscICoolStrSvc.h" +#include "MuonCondData/CscCondDbData.h" #include "CscCalibData/CscCalibResultContainer.h" -#include "GaudiKernel/ToolHandle.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +class CscCondDbData; ///////////////////////////////////////////////////////////////////////////// @@ -66,12 +58,7 @@ class CscCalibMonToolBase: public ManagedMonitorToolBase CscCalibMonToolBase (const std::string & type, const std::string & name, const IInterface* parent); - /** - @brief destructor - - Doesn't do anything currently. - */ - ~CscCalibMonToolBase(); + ~CscCalibMonToolBase() {}; /** @brief initializes services, tools, etc. Also determines the maximum hash id. @@ -173,13 +160,10 @@ class CscCalibMonToolBase: public ManagedMonitorToolBase /**Calibration result storegate key*/ std::string m_calibResultKey; - /** Tool for CSC identifier helper*/ - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /**Access to COOL database*/ - MuonCalib::CscICoolStrSvc* m_cscCoolSvc; - + SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}; /** diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.cxx index e050e072bdaaac490bdc230d438b0562a498388f..6ff23f184b175d564323e13ec9d56d727e8cd852 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.cxx @@ -1,16 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// ******************************************************************** -// -// NAME: CscCalibMonToolPed.cxx -// PACKAGE: MuonCalibMonitoring -// -// AUTHORS: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #include "CscCalibMonToolPed.h" #include <cassert> @@ -21,8 +12,6 @@ #include "CscCalibData/CscCalibReportContainer.h" #include "CscCalibData/CscCalibReportPed.h" #include "MuonCondInterface/CscICoolStrSvc.h" -using namespace std; - CscCalibMonToolPed::CscCalibMonToolPed(const std::string & type, const std::string & name, const IInterface* parent) : @@ -91,7 +80,6 @@ StatusCode CscCalibMonToolPed::initialize() { StatusCode sc = CscCalibMonToolBase::initialize(); - m_generic_path_csccalibmonitoring = "MUON_CSC_PED"; return sc; @@ -117,13 +105,6 @@ StatusCode CscCalibMonToolPed::finalize() return CscCalibMonToolBase::finalize(); } - -CscCalibMonToolPed::~CscCalibMonToolPed() -{ - - ATH_MSG_INFO( "CscCalibMonToolPed : deleting CscCalibMonToolPed " ); -} - StatusCode CscCalibMonToolPed::bookHistograms() { if (!CscCalibMonToolBase::bookHistograms().isSuccess()) @@ -138,11 +119,11 @@ StatusCode CscCalibMonToolPed::bookHistograms() { m_monGroupVec = new DataVector<MonGroup>; - string geoPath = getGeoPath(); - string path = getFullPath(geoPath, "Misc", ""); + std::string geoPath = getGeoPath(); + std::string path = getFullPath(geoPath, "Misc", ""); MonGroup monGroup( this, path, run, ATTRIB_MANAGED ); - string name,title,xaxis,yaxis; + std::string name,title,xaxis,yaxis; int highbound,lowbound,nbins; //num bad histograms @@ -155,17 +136,17 @@ StatusCode CscCalibMonToolPed::bookHistograms() m_h_numBad = new TH1I(name.c_str(),title.c_str(),highbound-lowbound+1,lowbound,highbound+1); m_h_numBad->GetYaxis()->SetTitle(yaxis.c_str()); m_h_numBad->GetXaxis()->SetTitle(xaxis.c_str()); - stringstream pedBinTitle; pedBinTitle << "#Delta ped > " << m_pedMaxDiff; + std::stringstream pedBinTitle; pedBinTitle << "#Delta ped > " << m_pedMaxDiff; m_h_numBad->GetXaxis()->SetBinLabel(m_pedBadBin, pedBinTitle.str().c_str()); - stringstream noiseBinTitle; noiseBinTitle << "#Delta noise > "<< m_noiseMaxDiff; + std::stringstream noiseBinTitle; noiseBinTitle << "#Delta noise > "<< m_noiseMaxDiff; m_h_numBad->GetXaxis()->SetBinLabel(m_noiseBadBin, noiseBinTitle.str().c_str()); - stringstream rmsBinTitle; rmsBinTitle << "#Delta RMS > " << m_rmsMaxDiff; + std::stringstream rmsBinTitle; rmsBinTitle << "#Delta RMS > " << m_rmsMaxDiff; m_h_numBad->GetXaxis()->SetBinLabel(m_rmsBadBin, rmsBinTitle.str().c_str()); - stringstream f001BinTitle; f001BinTitle << "#Delta F001 > " << m_f001MaxDiff; + std::stringstream f001BinTitle; f001BinTitle << "#Delta F001 > " << m_f001MaxDiff; m_h_numBad->GetXaxis()->SetBinLabel(m_f001BadBin, f001BinTitle.str().c_str()); - stringstream statisticsBinTitle; statisticsBinTitle << "N Entries < " << m_minAmpHistEntries; + std::stringstream statisticsBinTitle; statisticsBinTitle << "N Entries < " << m_minAmpHistEntries; m_h_numBad->GetXaxis()->SetBinLabel(m_nEntriesBadBin, statisticsBinTitle.str().c_str()); - stringstream chiBinTitle; chiBinTitle << "#frac{#chi^{2}}{ndf} > " << m_chi2Max; + std::stringstream chiBinTitle; chiBinTitle << "#frac{#chi^{2}}{ndf} > " << m_chi2Max; m_h_numBad->GetXaxis()->SetBinLabel(m_chi2BadBin,chiBinTitle.str().c_str()); m_h_numBad->GetXaxis()->SetBinLabel(m_missingBadBin,"Missing channels "); m_h_numBad->GetXaxis()->SetBinLabel(m_onlTHoldBreachBadBin, "Onl THold Breaches"); @@ -187,86 +168,86 @@ StatusCode CscCalibMonToolPed::bookHistograms() monGroup.regHist(m_h_pedMissingChannels).ignore(); //Set naming parameters for datatypes - string pedDataName = "ped"; - string pedDataTitle = "Pedestals"; - string pedSubDir = "Ped"; + std::string pedDataName = "ped"; + std::string pedDataTitle = "Pedestals"; + std::string pedSubDir = "Ped"; - string noiseDataName = "noise"; - string noiseDataTitle = "Noise (ped sigma)"; - string noiseSubDir = "Noise"; + std::string noiseDataName = "noise"; + std::string noiseDataTitle = "Noise (ped sigma)"; + std::string noiseSubDir = "Noise"; - string chi2DataName = "chi2"; - string chi2DataTitle = "Chi^2/ndf for Pedestal Gaussian Fit"; - string chi2SubDir = "Chi2"; + std::string chi2DataName = "chi2"; + std::string chi2DataTitle = "Chi^2/ndf for Pedestal Gaussian Fit"; + std::string chi2SubDir = "Chi2"; - string rmsDataName = "rms"; - string rmsDataTitle = "RMS from gaussian distribution"; - string rmsSubDir = "RMS"; + std::string rmsDataName = "rms"; + std::string rmsDataTitle = "RMS from gaussian distribution"; + std::string rmsSubDir = "RMS"; - string f001DataName = "f001"; - string f001DataTitle = "F001"; - string f001SubDir = "F001"; + std::string f001DataName = "f001"; + std::string f001DataTitle = "F001"; + std::string f001SubDir = "F001"; - string onlTHoldBreachDataName = "onlTHoldBreach"; - string onlTHoldBreachDataTitle = "Online Threshold Breaches"; - string onlTHoldBreachSubDir = "OnlTHoldBreaches"; + std::string onlTHoldBreachDataName = "onlTHoldBreach"; + std::string onlTHoldBreachDataTitle = "Online Threshold Breaches"; + std::string onlTHoldBreachSubDir = "OnlTHoldBreaches"; - string nEntriesDataName = "nEntries"; - string nEntriesDataTitle = "Number of Entries from Pedestal Amplitude Hist"; - string nEntriesSubDir = "NumEntries"; + std::string nEntriesDataName = "nEntries"; + std::string nEntriesDataTitle = "Number of Entries from Pedestal Amplitude Hist"; + std::string nEntriesSubDir = "NumEntries"; - string maxBitCorrDataName = "maxBitCorr"; - string maxBitCorrDataTitle = "Maximimum Bit Correlation"; - string maxBitCorrSubDir = "MaxBitCorr"; + std::string maxBitCorrDataName = "maxBitCorr"; + std::string maxBitCorrDataTitle = "Maximimum Bit Correlation"; + std::string maxBitCorrSubDir = "MaxBitCorr"; //Set naming parameters for histogram category names - string newCatName = "new"; - string newCatTitle = "New"; + std::string newCatName = "new"; + std::string newCatTitle = "New"; - string oldCatName = "old"; - string oldCatTitle = "COOL"; + std::string oldCatName = "old"; + std::string oldCatTitle = "COOL"; - string diffCatName = "diff"; - string diffCatTitle = "Change of "; + std::string diffCatName = "diff"; + std::string diffCatTitle = "Change of "; //axis info - string pedAxisLabel = "Pedestal Mean (ADC counts)"; - string pedDiffAxisLabel = "Pedestal Difference (ADC counts)"; + std::string pedAxisLabel = "Pedestal Mean (ADC counts)"; + std::string pedDiffAxisLabel = "Pedestal Difference (ADC counts)"; int pedNumBins =300; float pedLowBound = 1900; float pedHighBound = 2200; - string noiseAxisLabel = "Pedestal Noise (ADC counts)"; - string noiseDiffAxisLabel = "Noise Difference (ADC counts)"; + std::string noiseAxisLabel = "Pedestal Noise (ADC counts)"; + std::string noiseDiffAxisLabel = "Noise Difference (ADC counts)"; int noiseNumBins = 300; float noiseLowBound = 0; float noiseHighBound = 30; - string chi2AxisLabel = "Chi^2/ndf"; + std::string chi2AxisLabel = "Chi^2/ndf"; int chi2NumBins = 500; float chi2LowBound = 0; float chi2HighBound = 500; - string rmsAxisLabel = "RMS (ADC Counts)"; - string rmsDiffAxisLabel = "RMS Difference (ADC Counts)"; + std::string rmsAxisLabel = "RMS (ADC Counts)"; + std::string rmsDiffAxisLabel = "RMS Difference (ADC Counts)"; int rmsNumBins = 300; float rmsLowBound =0; float rmsHighBound = 30; - string f001AxisLabel = "F001 (ADC)"; - string f001DiffAxisLabel = "F001 Difference (ADC)"; + std::string f001AxisLabel = "F001 (ADC)"; + std::string f001DiffAxisLabel = "F001 Difference (ADC)"; int f001NumBins = 350; float f001LowBound =1950; float f001HighBound = 2300; - string nEntriesAxisLabel = "Number of Entries"; + std::string nEntriesAxisLabel = "Number of Entries"; int nEntriesNumBins = 20; float nEntriesLowBound = 0; float nEntriesHighBound = 10000; uint16_t nEntriesHistMask = 0x3F; //only do overall spectra and 2d view - string maxBitCorrAxisLabel = "Correlation"; + std::string maxBitCorrAxisLabel = "Correlation"; int maxBitCorrNumBins = 300; float maxBitCorrLowBound = -3; float maxBitCorrHighBound = 3; @@ -399,7 +380,7 @@ StatusCode CscCalibMonToolPed::handleParameter(const CscCalibResultCollection* p ATH_MSG_FATAL("Blank parval passed to handle parameter"); return StatusCode::FAILURE; } - string parName = parVals->parName(); + std::string parName = parVals->parName(); if(parName == "ped") { ProcParameterInput.dbName = parVals->parName(); @@ -538,15 +519,15 @@ StatusCode CscCalibMonToolPed::postProc() { ATH_MSG_DEBUG( "CscCalibMonToolPed : in postProc()" ); - IdContext chanContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext chanContext = m_idHelperSvc->cscIdHelper().channel_context(); genThreshold(m_pedDiffColl, m_noiseDiffColl, m_tholdDiffColl, 3.5); copyDataToHists(m_tholdDiffColl); if(m_doRmsVNoise) { - string geoPath = getGeoPath(); - string path = getFullPath(geoPath, "Misc", ""); + std::string geoPath = getGeoPath(); + std::string path = getFullPath(geoPath, "Misc", ""); m_h2_rmsVnoiseEta = new TH2I("rmsVsigma_eta", "RMS versus sigma for #eta strips", 100, 0, 30, 100, 0,30) ; m_h2_rmsVnoiseEta->GetXaxis()->SetTitle("Sigma"); @@ -570,8 +551,8 @@ StatusCode CscCalibMonToolPed::postProc() for(unsigned int hashId = 0; hashId < nEntries; hashId++){ ATH_MSG_DEBUG( "Filling rmsVnoise for hash id " << hashId ); Identifier chanId; - m_muonIdHelperTool->cscIdHelper().get_id(IdentifierHash(hashId), chanId, &chanContext); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(chanId); + m_idHelperSvc->cscIdHelper().get_id(IdentifierHash(hashId), chanId, &chanContext); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(chanId); if(m_expectedHashIdsAll.count(hashId)) { if(measuresPhi) @@ -639,21 +620,21 @@ StatusCode CscCalibMonToolPed::postProc() TH1I * sourceHist; Identifier chanId; - m_muonIdHelperTool->cscIdHelper().get_id(IdentifierHash(idItr), chanId, &chanContext); - int stationSize = m_muonIdHelperTool->cscIdHelper().stationName(chanId); - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(chanId); - int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(chanId); - int wireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(chanId); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(chanId); - int strip = m_muonIdHelperTool->cscIdHelper().strip(chanId); + m_idHelperSvc->cscIdHelper().get_id(IdentifierHash(idItr), chanId, &chanContext); + int stationSize = m_idHelperSvc->cscIdHelper().stationName(chanId); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(chanId); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(chanId); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(chanId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(chanId); + int strip = m_idHelperSvc->cscIdHelper().strip(chanId); int sector = getSector(stationPhi, stationSize); - string geoPath = getGeoPath(stationEta, sector, wireLayer, measuresPhi); + std::string geoPath = getGeoPath(stationEta, sector, wireLayer, measuresPhi); - string pedAmpPath = getFullPath(geoPath, "PedAmpHists", ""); - string sampPath = getFullPath(geoPath, "SampHists",""); - string bitHistPath = getFullPath(geoPath, "BitHists", ""); - string bitCorrelationPath(""); + std::string pedAmpPath = getFullPath(geoPath, "PedAmpHists", ""); + std::string sampPath = getFullPath(geoPath, "SampHists",""); + std::string bitHistPath = getFullPath(geoPath, "BitHists", ""); + std::string bitCorrelationPath(""); if(bitCorrelations) bitCorrelationPath = getFullPath(geoPath, "BitCorrelations", ""); @@ -691,23 +672,20 @@ StatusCode CscCalibMonToolPed::postProc() if(m_detailedHashIds[idItr] || m_doAllDetailed){ - stringstream name; + std::stringstream name; name << "h_pedAmp" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip; - //TH1I * newHist = (TH1I*)sourceHist->Clone(name.str().c_str()); - //Calibration is finished with histogram, so we can modify it a bit: sourceHist->SetName(name.str().c_str()); sourceHist->SetFillColor((m_detailedHashIds[idItr] ? m_histColAlert : m_histCol)); - //regHist(newHist, chanPath, run, ATTRIB_MANAGED); regHist(sourceHist, pedAmpPath, run, ATTRIB_MANAGED); } } @@ -718,14 +696,14 @@ StatusCode CscCalibMonToolPed::postProc() size_t hNum = histVect->size(); for(size_t hCnt = 0; hCnt < hNum; hCnt++) { sourceHist = const_cast<TH1I*>((*histVect)[hCnt]); - stringstream name; + std::stringstream name; name << "h_samp" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip <<"_samp_" << hCnt; @@ -747,20 +725,18 @@ StatusCode CscCalibMonToolPed::postProc() return StatusCode::RECOVERABLE; } - stringstream name2; + std::stringstream name2; name2 << "h_bitMap" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip; - // TH1I * newHist2 = (TH1I*)sourceHist->Clone(name2.str().c_str()); sourceHist->SetName(name2.str().c_str()); sourceHist->SetFillColor((m_detailedHashIds[idItr] ? m_histColAlert : m_histCol)); - //regHist(newHist2, chanPath, run, ATTRIB_MANAGED); regHist(sourceHist, bitHistPath, run, ATTRIB_MANAGED); }//end if bithists*/ @@ -806,35 +782,35 @@ StatusCode CscCalibMonToolPed::postProc() void CscCalibMonToolPed::makeErrorReport(){ - stringstream report; + std::stringstream report; double numBadPed = m_h_numBad->GetBinContent(m_pedBadBin); - report << "Num channels with Delta Ped > " << m_pedMaxDiff << " : " << numBadPed << endl; + report << "Num channels with Delta Ped > " << m_pedMaxDiff << " : " << numBadPed << std::endl ; double numBadRms = m_h_numBad->GetBinContent(m_rmsBadBin); - report << "Num channels with Delta RMS > " << m_rmsMaxDiff << " : " << numBadRms << endl; + report << "Num channels with Delta RMS > " << m_rmsMaxDiff << " : " << numBadRms << std::endl ; double numBadF001 = m_h_numBad->GetBinContent(m_f001BadBin); - report << "Num channels with Delta f001 > " << m_f001MaxDiff << " : " << numBadF001 << endl; + report << "Num channels with Delta f001 > " << m_f001MaxDiff << " : " << numBadF001 << std::endl ; double numBadNoise = m_h_numBad->GetBinContent(m_noiseBadBin); - report << "Num channels with Delta sigma > " << m_noiseMaxDiff << " : " << numBadNoise << endl; + report << "Num channels with Delta sigma > " << m_noiseMaxDiff << " : " << numBadNoise << std::endl ; double numBadNEntries = m_h_numBad->GetBinContent(m_nEntriesBadBin); report << "Num channels with num pedestal amplitude entries < " << m_minAmpHistEntries - << ": " << numBadNEntries <<endl; + << ": " << numBadNEntries <<std::endl ; double numBreachEntries = m_h_numBad->GetBinContent(m_onlTHoldBreachBadBin); report << "Num channels with too high an occupancy (> " << m_onlTHoldBreachMax << ")." - << ": " << numBreachEntries <<endl; + << ": " << numBreachEntries <<std::endl ; if(!(numBadPed >100 || numBadRms > 100 || numBadNEntries>0|| numBreachEntries > 0)){ - ofstream allGoodFile(m_allGoodFileName.c_str()); + std::ofstream allGoodFile(m_allGoodFileName.c_str()); allGoodFile << "All tests past."; allGoodFile.close(); } - ofstream reportFile(m_statusReportName.c_str()); + std::ofstream reportFile(m_statusReportName.c_str()); reportFile << m_statusReportPrefix; reportFile << "\n\n"; reportFile << report.str(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h index 03e5f85a68a015a0af51ba1f8d1985afa0394f9d..948bfd4a817c23dfd83ddebb9caca3a0132510e1 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolPed.h @@ -1,16 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// ******************************************************************** -// -// NAME: CscCalibMonTool.h -// PACKAGE: MuonCalibMonTool.h -// -// AUTHORS: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #ifndef MUONCALIBMONITORING_CSCCALIBMONTOOLPED_H #define MUONCALIBMONITORING_CSCCALIBMONTOOLPED_H @@ -19,8 +10,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -#include "MuonIdHelpers/CscIdHelper.h" - #include "TH1.h" #include "TProfile.h" @@ -51,7 +40,7 @@ class CscCalibMonToolPed: public CscCalibMonToolBase const IInterface* parent); /**Destructor*/ - ~CscCalibMonToolPed(); + ~CscCalibMonToolPed() {}; /**initialize function. Calls base class's initialize function.*/ StatusCode initialize(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.cxx index 3ef95fab4ae6249fb0572a54c51662ec671d415c..a72ceefdd655fe18f0c20ff861fe8a725c1061ce 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.cxx @@ -1,16 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//******************************************************************** -// -// NAME: CscCalibMonToolSlope.cxx -// PACKAGE: MuonCalibMonitoring -// -// AUTHORS: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #include "CscCalibMonToolSlope.h" #include <cassert> @@ -28,10 +19,6 @@ #include "TH1I.h" #include "TF1.h" -using namespace std; - - - CscCalibMonToolSlope::CscCalibMonToolSlope(const std::string & type, const std::string & name, const IInterface* parent) : CscCalibMonToolBase(type, name, parent), @@ -89,13 +76,6 @@ CscCalibMonToolSlope::CscCalibMonToolSlope(const std::string & type, const std:: } - -CscCalibMonToolSlope::~CscCalibMonToolSlope() -{ - ATH_MSG_INFO( "CscCalibMonToolSlope : deleting CscCalibMonToolSlope " ); -} - - StatusCode CscCalibMonToolSlope::finalize() { ATH_MSG_DEBUG( "Slope Finalizing " ); @@ -110,31 +90,23 @@ StatusCode CscCalibMonToolSlope::finalize() delete m_peaktOldColl; delete m_peaktDiffColl; - return CscCalibMonToolBase::finalize(); } StatusCode CscCalibMonToolSlope::initialize() { m_onlyExpectPrecisionHashIds = true; - StatusCode sc = CscCalibMonToolBase::initialize(); - - IdContext channelContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + ATH_CHECK(CscCalibMonToolBase::initialize()); ATH_MSG_DEBUG( "Expected chamber layer is " << m_expectedChamberLayer ); for(unsigned int hash = 0 ; hash <= m_maxHashId; hash++) { m_fracProfs.push_back(NULL); - - Identifier id; - - - } m_generic_path_csccalibmonitoring = "MUON_CSC_PULSER"; - return sc; + return StatusCode::SUCCESS; } @@ -145,11 +117,11 @@ StatusCode CscCalibMonToolSlope::bookHistograms() if (newRunFlag()) { - string name,title,xaxis,yaxis; + std::string name,title,xaxis,yaxis; int highbound,lowbound,nbins; - string geoPath = getGeoPath(); - string path = getFullPath(geoPath, "Misc", ""); + std::string geoPath = getGeoPath(); + std::string path = getFullPath(geoPath, "Misc", ""); MonGroup monGroup(this, path, run, ATTRIB_MANAGED ); //num bad histograms @@ -255,78 +227,78 @@ StatusCode CscCalibMonToolSlope::bookHistograms() monGroup.regHist(m_h_slopeMissingChans).ignore(); - string peaktDataName = "peakt"; - string peaktDataTitle = "Peaking Time"; - string peaktSubDir = "Peakt"; + std::string peaktDataName = "peakt"; + std::string peaktDataTitle = "Peaking Time"; + std::string peaktSubDir = "Peakt"; - string slopeDataName = "slope"; - string slopeDataTitle = "Pulser Gain Slope"; - string slopeSubDir = "Slope"; + std::string slopeDataName = "slope"; + std::string slopeDataTitle = "Pulser Gain Slope"; + std::string slopeSubDir = "Slope"; - string slopeRatioDataName = "slopeRatio"; - string slopeRatioDataTitle = "Ratio of N : N+1 Channel Slopes"; - string slopeRatioSubDir = "SlopeRatio"; + std::string slopeRatioDataName = "slopeRatio"; + std::string slopeRatioDataTitle = "Ratio of N : N+1 Channel Slopes"; + std::string slopeRatioSubDir = "SlopeRatio"; - string interceptDataName = "intercept"; - string interceptDataTitle = "Intercept"; - string interceptSubDir = "Intercept"; + std::string interceptDataName = "intercept"; + std::string interceptDataTitle = "Intercept"; + std::string interceptSubDir = "Intercept"; - string chi2DataName = "chi2"; - string chi2DataTitle = "Chi^2/ndf for gain slope fit"; - string chi2SubDir = "Chi2"; + std::string chi2DataName = "chi2"; + std::string chi2DataTitle = "Chi^2/ndf for gain slope fit"; + std::string chi2SubDir = "Chi2"; - string deadDataName = "dead"; - string deadDataTitle = "Dead"; - string deadSubDir = "Dead"; + std::string deadDataName = "dead"; + std::string deadDataTitle = "Dead"; + std::string deadSubDir = "Dead"; - string fitResDataName = "fitRes"; - string fitResDataTitle = "Fit Return Value"; - string fitResSubDir = "FitResult"; + std::string fitResDataName = "fitRes"; + std::string fitResDataTitle = "Fit Return Value"; + std::string fitResSubDir = "FitResult"; //Set naming parameters for histogram category names - string newCatName = "new"; - string newCatTitle = "New"; + std::string newCatName = "new"; + std::string newCatTitle = "New"; - string oldCatName = "old"; - string oldCatTitle = "COOL"; + std::string oldCatName = "old"; + std::string oldCatTitle = "COOL"; - string diffCatName = "diff"; - string diffCatTitle = "Difference Between New and COOL"; + std::string diffCatName = "diff"; + std::string diffCatTitle = "Difference Between New and COOL"; //axis info - string peaktAxisLabel = "Peaking Time (ns)"; - string peaktDiffAxisLabel = "Peaking Time Difference (ns)"; + std::string peaktAxisLabel = "Peaking Time (ns)"; + std::string peaktDiffAxisLabel = "Peaking Time Difference (ns)"; int peaktNumBins = 100; float peaktLowBound = 0; float peaktHighBound = 100; - string slopeAxisLabel = "Gain (fC/ADC)"; - string slopeDiffAxisLabel = "Gain Difference (fC/ADC)"; + std::string slopeAxisLabel = "Gain (fC/ADC)"; + std::string slopeDiffAxisLabel = "Gain Difference (fC/ADC)"; int slopeNumBins =300; float slopeLowBound = 0; float slopeHighBound = 5; - string slopeRatioAxisLabel = "Ratio of N/(N+1) channel"; + std::string slopeRatioAxisLabel = "Ratio of N/(N+1) channel"; int slopeRatioNumBins = 500; float slopeRatioLowBound = 0; float slopeRatioHighBound = 5; - string interceptAxisLabel = "Intercept (ADC counts)"; + std::string interceptAxisLabel = "Intercept (ADC counts)"; int interceptNumBins = 200; float interceptLowBound = -100; float interceptHighBound = 100; - string chi2AxisLabel = "Chi^2/ndf"; + std::string chi2AxisLabel = "Chi^2/ndf"; int chi2NumBins = 1000; float chi2LowBound = 0; float chi2HighBound = 3000; - string deadAxisLabel = "Is Dead"; + std::string deadAxisLabel = "Is Dead"; int deadNumBins = 3; float deadLowBound = -1.5; float deadHighBound = 1.5; - string fitResAxisLabel = "Fit Return Value"; + std::string fitResAxisLabel = "Fit Return Value"; int fitResNumBins =10000; float fitResLowBound = 0; float fitResHighBound = 10000; @@ -439,7 +411,7 @@ StatusCode CscCalibMonToolSlope::handleParameter(const CscCalibResultCollection* ProcSetupInfo simpleSet; //--setup for this parameter - string parName = parVals->parName(); + std::string parName = parVals->parName(); /*if(parName == "peakt") { m_log << MSG::INFO << "Evaluating peaking times" << endmsg; @@ -553,7 +525,7 @@ StatusCode CscCalibMonToolSlope::postProc() - IdContext chanContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext chanContext = m_idHelperSvc->cscIdHelper().channel_context(); //Get the slopeReport, checking for pointer errors along the way const DataHandle<CscCalibReportContainer> repCont; @@ -587,7 +559,7 @@ StatusCode CscCalibMonToolSlope::postProc() } //ampProfs - const map<int,TProfile*> * ampProfs = slopeReport->getAmpProfs(); + const std::map <int,TProfile*> * ampProfs = slopeReport->getAmpProfs(); if(!ampProfs) { ATH_MSG_ERROR( "There are no amplitude profiles in the slope report! Can't find dead chans." ); @@ -595,13 +567,13 @@ StatusCode CscCalibMonToolSlope::postProc() } if(m_histAttenLevels){ - map<int,TProfile*>::const_iterator profItr = ampProfs->begin(); - map<int,TProfile*>::const_iterator profEnd = ampProfs->end(); + std::map <int,TProfile*>::const_iterator profItr = ampProfs->begin(); + std::map <int,TProfile*>::const_iterator profEnd = ampProfs->end(); for(; profItr != profEnd; profItr++){ float atten = profItr->first/2.0; - stringstream attenSS; attenSS << atten; - string attenStr = attenSS.str(); + std::stringstream attenSS; attenSS << atten; + std::string attenStr = attenSS.str(); HistCollection * ampColl = new HistCollection(m_maxHashId +1, m_maxHashId +1); ampColl->ignoreY = true; @@ -610,13 +582,13 @@ StatusCode CscCalibMonToolSlope::postProc() m_ampColls.push_back(ampColl); - string dataName = "amp_atten" + attenStr; - string dataTitle = "ADC response at attenuation " + attenStr + " db" ; - string axisLabel = "ADC"; + std::string dataName = "amp_atten" + attenStr; + std::string dataTitle = "ADC response at attenuation " + attenStr + " db" ; + std::string axisLabel = "ADC"; unsigned int numBins = 300; float lowBound = 0; float highBound = 3000; - string subDir = "AmpAtten" + attenStr; + std::string subDir = "AmpAtten" + attenStr; bookHistCollection(ampColl, dataName, dataTitle, "", "", axisLabel, numBins, lowBound, highBound, subDir).ignore(); for(unsigned int stripHash = 0; stripHash < m_maxHashId; stripHash++){ @@ -671,25 +643,25 @@ StatusCode CscCalibMonToolSlope::postProc() //These are the channels we will get detailed forr. for(unsigned int idItr = 0; idItr < m_maxHashId; idItr++) { - cerr << "Calgraph Address: " << (*calGraphs)[idItr] << endl; + ATH_MSG_ERROR("Calgraph Address: " << (*calGraphs)[idItr]); if(m_expectedHashIdsPrec.count(idItr) && (m_detailedHashIds[idItr] || (m_doAllDetailed) ) ) { - cerr << "Doing detailed plots of hash " << idItr << endl; + ATH_MSG_ERROR("Doing detailed plots of hash " << idItr); Identifier chanId; - m_muonIdHelperTool->cscIdHelper().get_id(IdentifierHash(idItr), chanId, &chanContext); - int stationSize = m_muonIdHelperTool->cscIdHelper().stationName(chanId); - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(chanId); - int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(chanId); - int wireLayer = m_muonIdHelperTool->cscIdHelper().wireLayer(chanId); - int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(chanId); - int strip = m_muonIdHelperTool->cscIdHelper().strip(chanId); + m_idHelperSvc->cscIdHelper().get_id(IdentifierHash(idItr), chanId, &chanContext); + int stationSize = m_idHelperSvc->cscIdHelper().stationName(chanId); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(chanId); + int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(chanId); + int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(chanId); + int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(chanId); + int strip = m_idHelperSvc->cscIdHelper().strip(chanId); int sector = getSector(stationPhi, stationSize); - string geoPath = getGeoPath(stationEta, sector, wireLayer, measuresPhi); - string calGraphPath = getFullPath(geoPath, "CalGraphs",""); - string fracPath = getFullPath(geoPath,"FracProf",""); - string bitHistPath = getFullPath(geoPath, "BitHists", ""); + std::string geoPath = getGeoPath(stationEta, sector, wireLayer, measuresPhi); + std::string calGraphPath = getFullPath(geoPath, "CalGraphs",""); + std::string fracPath = getFullPath(geoPath,"FracProf",""); + std::string bitHistPath = getFullPath(geoPath, "BitHists", ""); //Record calgraph TGraphErrors * sourceGraph = @@ -700,14 +672,14 @@ StatusCode CscCalibMonToolSlope::postProc() << idItr << " doesn't exist in CscCalibReport object!" ); } else { - stringstream name; + std::stringstream name; name << "calfit" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip; sourceGraph->SetName(name.str().c_str()); @@ -724,14 +696,14 @@ StatusCode CscCalibMonToolSlope::postProc() << idItr << ". Quitting retrieveHistos()." ); } else{ - stringstream fracName; + std::stringstream fracName; fracName << "frac_" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip; sourceProf->SetName(fracName.str().c_str()); @@ -751,14 +723,14 @@ StatusCode CscCalibMonToolSlope::postProc() } else { - stringstream name2; + std::stringstream name2; name2 << "h_bitMap" << "_EC" << getEndCap(stationEta) << "_sector_" << sector << "_layer_" << wireLayer << "_" << (measuresPhi ? "trans" : "prec") << "_strip_" - << setfill('0') << setw(measuresPhi ? 2 : 3) + << std::setfill ('0') << std::setw (measuresPhi ? 2 : 3) << strip; // TH1I * newHist2 = (TH1I*)bitHist->Clone(name2.str().c_str()); bitHist->SetName(name2.str().c_str()); @@ -771,7 +743,7 @@ StatusCode CscCalibMonToolSlope::postProc() }//end if (m_detailedHashIds) else - cerr << "Skipping hash " << idItr << " " << m_expectedHashIdsPrec.count(idItr) << " " << m_doAllDetailed << endl; + ATH_MSG_ERROR("Skipping hash " << idItr << " " << m_expectedHashIdsPrec.count(idItr) << " " << m_doAllDetailed); }//end idItr loop }//if numBad > 0 return StatusCode::SUCCESS; @@ -790,26 +762,26 @@ StatusCode CscCalibMonToolSlope::makeFracGraphs(const CscCalibReportSlope & slop } //Loop through all channels in geometry: - vector<Identifier> ids = m_muonIdHelperTool->cscIdHelper().idVector(); - vector<Identifier>::const_iterator chamItr = ids.begin(); - vector<Identifier>::const_iterator chamEnd = ids.end(); + std::vector <Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); + std::vector <Identifier>::const_iterator chamItr = ids.begin(); + std::vector <Identifier>::const_iterator chamEnd = ids.end(); for(; chamItr != chamEnd; chamItr++) { ATH_MSG_VERBOSE( "in Chamber loop " ); - unsigned int stationSize = m_muonIdHelperTool->cscIdHelper().stationName(*chamItr); //51 = large, 50 = small - unsigned int stationPhi = m_muonIdHelperTool->cscIdHelper().stationPhi(*chamItr); - int stationEta = m_muonIdHelperTool->cscIdHelper().stationEta(*chamItr); + unsigned int stationSize = m_idHelperSvc->cscIdHelper().stationName(*chamItr); //51 = large, 50 = small + unsigned int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(*chamItr); + int stationEta = m_idHelperSvc->cscIdHelper().stationEta(*chamItr); unsigned int sector = getSector(stationPhi,stationSize); - vector<Identifier> stripVect; - m_muonIdHelperTool->cscIdHelper().idChannels(*chamItr,stripVect); - vector<Identifier>::const_iterator stripItr = stripVect.begin(); - vector<Identifier>::const_iterator stripEnd = stripVect.end(); + std::vector <Identifier> stripVect; + m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); + std::vector <Identifier>::const_iterator stripItr = stripVect.begin(); + std::vector <Identifier>::const_iterator stripEnd = stripVect.end(); for(;stripItr != stripEnd; stripItr++) { ATH_MSG_VERBOSE( "in strip loop " ); IdentifierHash stripHash; - m_muonIdHelperTool->cscIdHelper().get_channel_hash(*stripItr,stripHash); + m_idHelperSvc->cscIdHelper().get_channel_hash(*stripItr,stripHash); if(!m_expectedHashIdsPrec.count((int)stripHash)){ ATH_MSG_VERBOSE( "Skipping hash" << (int)stripHash ); continue; @@ -839,21 +811,21 @@ StatusCode CscCalibMonToolSlope::makeFracGraphs(const CscCalibReportSlope & slop //Note, we don't ask for measuresPhi because there should be no //TGraphs with Y anyways. ATH_MSG_VERBOSE( "getting id info " ); - unsigned int layer = m_muonIdHelperTool->cscIdHelper().wireLayer(*stripItr); - unsigned int strip = m_muonIdHelperTool->cscIdHelper().strip(*stripItr); + unsigned int layer = m_idHelperSvc->cscIdHelper().wireLayer(*stripItr); + unsigned int strip = m_idHelperSvc->cscIdHelper().strip(*stripItr); ATH_MSG_VERBOSE( "Got strip and layer" ); //initialize fractional deviation profile ATH_MSG_VERBOSE( "initializing profile " ); - stringstream nameStream; - nameStream.setf(ios::right,ios::adjustfield); + std::stringstream nameStream; + nameStream.setf(std::ios::right,std::ios::adjustfield); nameStream << "dev_" << "X" //orientation << "_eta_" << stationEta - << "_sector_" << setw(2) << setfill('0') << sector + << "_sector_" << std::setw (2) << std::setfill ('0') << sector << "_layer_" << layer << "_strip_" << strip; - stringstream titleStream; + std::stringstream titleStream; titleStream << "Fractional Deviation of Measured ADC From Fit ADC for Precision Direction" << ", Sector " << sector << ", Eta " << stationEta @@ -900,7 +872,7 @@ StatusCode CscCalibMonToolSlope::makeFracGraphs(const CscCalibReportSlope & slop //Label bin with db amount ATH_MSG_VERBOSE( "labeling bin " ); - stringstream binLabel; + std::stringstream binLabel; binLabel << db; fracProf->GetXaxis()->SetBinLabel(itr+1, binLabel.str().c_str()); } @@ -934,26 +906,29 @@ StatusCode CscCalibMonToolSlope::makeFracGraphs(const CscCalibReportSlope & slop StatusCode CscCalibMonToolSlope::findDeadChannels(const CscCalibReportSlope & slopeReport) {//This function has grown a bit unwieldly, and duplicates info in sets and arrays. Can this be merged? + SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; + const CscCondDbData* readCdo{*readHandle}; + //****Find Dead channels - IdContext channelContext = m_muonIdHelperTool->cscIdHelper().channel_context(); + IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context(); - set<int> newDead, newUndead; + std::set <int> newDead, newUndead; - const set<int> * pulsedChambers = slopeReport.getPulsedChambers(); + const std::set <int> * pulsedChambers = slopeReport.getPulsedChambers(); if(!pulsedChambers) { ATH_MSG_ERROR( "No pulsed chambers stored in slopeReport! Skipping dead channel collecting!" ); return StatusCode::RECOVERABLE; } - const map<int,TProfile*> * ampProfs = slopeReport.getAmpProfs(); + const std::map <int,TProfile*> * ampProfs = slopeReport.getAmpProfs(); if(!ampProfs) { ATH_MSG_ERROR( "There are no amplitude profiles in the slope report! Can't find dead chans." ); return StatusCode::RECOVERABLE; } - map<int,TProfile*>::const_iterator profItr = ampProfs->begin(); + std::map <int,TProfile*>::const_iterator profItr = ampProfs->begin(); int pulserLevel = profItr->first; ATH_MSG_INFO( "Looking for dead channels. Lowest attenuation level is " @@ -984,20 +959,20 @@ StatusCode CscCalibMonToolSlope::findDeadChannels(const CscCalibReportSlope & sl //if its dead float adc, ped; bool wasDead, isDead; - uint8_t statusWord; + int statusWord; for(unsigned int hashItr = 0; hashItr <= m_maxHashId ; hashItr++) { Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id(hashItr,id, &channelContext); - int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(id); + m_idHelperSvc->cscIdHelper().get_id(hashItr,id, &channelContext); + int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(id); IdentifierHash chamberHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(id, chamberHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id, chamberHash); if(chamberLayer == 2 && pulsedChambers->count((int)chamberHash)) {//This is a good chamber layer and it is a pulsed chamber - m_cscCoolSvc->getStatus(statusWord, hashItr); - m_cscCoolSvc->getParameter(ped,"ped", hashItr); + ATH_CHECK(readCdo->readChannelStatus(hashItr, statusWord)); + ATH_CHECK(readCdo->readChannelPed (hashItr, ped )); wasDead = statusWord & 0x1; adc = ampProf->GetBinContent( hashItr + 1 ); @@ -1045,31 +1020,31 @@ StatusCode CscCalibMonToolSlope::findDeadChannels(const CscCalibReportSlope & sl ATH_MSG_INFO( "There are " << newDead.size() << " newly dead channels and " << newUndead.size() << " newly live channels" ); - ofstream out("deadInfo.cal"); + std::ofstream out("deadInfo.cal"); out <<"00-00 " << newDead.size() + newUndead.size() << " dead_stat END_HEADER\n"; - set<int>::const_iterator deadItr = newDead.begin(); - set<int>::const_iterator deadEnd = newDead.end(); + std::set <int>::const_iterator deadItr = newDead.begin(); + std::set <int>::const_iterator deadEnd = newDead.end(); for(; deadItr != deadEnd; deadItr++) { Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id(*deadItr,id, &channelContext); + m_idHelperSvc->cscIdHelper().get_id(*deadItr,id, &channelContext); IdentifierHash chamHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(id, chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id, chamHash); out << *deadItr << " " << (int)chamHash << " " - << m_muonIdHelperTool->cscIdHelper().show_to_string(id, &channelContext) << " 1\n"; + << m_idHelperSvc->cscIdHelper().show_to_string(id, &channelContext) << " 1\n"; } - set<int>::const_iterator undeadItr = newUndead.begin(); - set<int>::const_iterator undeadEnd = newUndead.end(); + std::set <int>::const_iterator undeadItr = newUndead.begin(); + std::set <int>::const_iterator undeadEnd = newUndead.end(); for(; undeadItr != undeadEnd; undeadItr++) { Identifier id; - m_muonIdHelperTool->cscIdHelper().get_id(*undeadItr,id, &channelContext); + m_idHelperSvc->cscIdHelper().get_id(*undeadItr,id, &channelContext); IdentifierHash chamHash; - m_muonIdHelperTool->cscIdHelper().get_module_hash(id, chamHash); + m_idHelperSvc->cscIdHelper().get_module_hash(id, chamHash); out << *undeadItr << " " << (int)chamHash << " " - << m_muonIdHelperTool->cscIdHelper().show_to_string(id, &channelContext) + << m_idHelperSvc->cscIdHelper().show_to_string(id, &channelContext) << "0\n"; } out.close(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h index baaa03109c265bf4b6f0c80f00d690437036f2ad..15e0ac6f159627dff33d7c63a628a3b81c4881ab 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonCalibMonitoring/src/CscCalibMonToolSlope.h @@ -1,16 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// ******************************************************************** -// -// NAME: CscCalibMonTool.h -// PACKAGE: MuonCalibMonTool.h -// -// AUTHORS: Caleb Parnell-Lampen <lampen@physics.arizona.edu> -// -// ******************************************************************** - #ifndef MUONCALIBMONITORING_CSCCALIBMONTOOLSLOPE_H #define MUONCALIBMONITORING_CSCCALIBMONTOOLSLOPE_H @@ -19,9 +10,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/MsgStream.h" -#include "MuonIdHelpers/CscIdHelper.h" - - ///////////////////////////////////////////////////////////////////////////// class TH1F; class TH1I; @@ -54,7 +42,7 @@ class CscCalibMonToolSlope: public CscCalibMonToolBase const IInterface* parent); /**Destructor*/ - ~CscCalibMonToolSlope(); + ~CscCalibMonToolSlope() {}; /**Initialize slope sepcific values. Also calls CscCalibMonToolBase::intialize*/ StatusCode initialize(); @@ -85,9 +73,6 @@ class CscCalibMonToolSlope: public CscCalibMonToolBase //Leftover from when I was using more arrays. I should get rid of this or replace it with something more vector friendly //Maybe when I start using the slope program again more.. 2009-09-24 std::vector<float> & setArray(std::vector<float> & array , const float &value, const int &numEntries); - - // CSC identifier helper - // const CscIdHelper * m_cscIdHelper; /**Generated next neighbor channel ratios of the slopes*/ void genNeighborRatios(const std::vector<float> & source, std::vector<float> & ratios) const;