From 021bb0139a211dd23e52f333cfb592849279e153 Mon Sep 17 00:00:00 2001 From: Susumu Oda <susumu.oda@cern.ch> Date: Fri, 8 Mar 2019 10:48:04 +0000 Subject: [PATCH] Add ATLAS_CHECK_THREAD_SAFETY to SCT_CalibAlgs package --- .../SCT_CalibAlgs/ATLAS_CHECK_THREAD_SAFETY | 1 + .../SCT_CalibAlgs/ISCT_CalibHistoTool.h | 14 +++++------ .../SCT_CalibAlgs/SCTCalibWriteTool.h | 20 ++++++++-------- .../SCT_CalibAlgs/src/IElementStreamer.cxx | 5 +--- .../SCT_CalibAlgs/src/IElementStreamer.h | 4 ++-- .../SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx | 8 +++---- .../SCT_CalibAlgs/src/SCTCalib.cxx | 9 ++++--- .../SCT_CalibAlgs/src/SCTCalibWriteTool.cxx | 24 +++++++++---------- .../src/SCT_CalibBsErrorTool.cxx | 10 ++++---- .../SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h | 1 + 10 files changed, 48 insertions(+), 48 deletions(-) create mode 100644 InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ATLAS_CHECK_THREAD_SAFETY diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 00000000000..3b2aa4f2c9c --- /dev/null +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetCalibAlgs/SCT_CalibAlgs diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h index 1b58fe492ec..eaa5fd3122c 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/ISCT_CalibHistoTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -50,13 +50,13 @@ class ISCT_CalibHistoTool: virtual public IAlgTool { int size(const int histogramIndex) const; void binHistograms(const int nLbMerged); /// set number of lumiblocks - static void setNumberOfLb(const int nLb); + void setNumberOfLb(const int nLb); /// get number of lumiblocks - static int numberOfLb(); + int numberOfLb(); /// set number of lumiblocks - static void setLbToMerge(const int nLbMerge); + void setLbToMerge(const int nLbMerge); /// get number of lumiblocks - static int LbToMerge(); + int LbToMerge(); protected: std::vector<TH1F *> m_phistoVector; std::vector<TH2F *> m_phistoVector2D; @@ -66,8 +66,8 @@ class ISCT_CalibHistoTool: virtual public IAlgTool { //ServiceHandle<StoreGateSvc> m_detStore; //ServiceHandle<StoreGateSvc> m_evtStore; const SCT_ID* m_pSCTHelper; - static int m_nLb; - static int m_nLbMerge; + int m_nLb; + int m_nLbMerge; // bool init(); template<class T> diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h index a8fc81f48c3..e1bf6cbb1c4 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h @@ -167,19 +167,19 @@ class SCTCalibWriteTool : public AthAlgTool { // would it make sense to change the strings to properties? // that would be a fairly simple fix - static std::string s_separator; - static std::string s_defectFolderName; - static std::string s_deadStripFolderName; - static std::string s_deadChipFolderName; - static std::string s_effFolderName; - static std::string s_noFolderName; - static std::string s_RawOccuFolderName; - static std::string s_BSErrFolderName; - static std::string s_LAFolderName; + static const std::string s_separator; + static const std::string s_defectFolderName; + static const std::string s_deadStripFolderName; + static const std::string s_deadChipFolderName; + static const std::string s_effFolderName; + static const std::string s_noFolderName; + static const std::string s_RawOccuFolderName; + static const std::string s_BSErrFolderName; + static const std::string s_LAFolderName; // cache for the Collections, access by foldername mutable std::mutex m_mutex; - mutable std::map<const std::string, const CondAttrListCollection*> m_attrListCollectionMap; + mutable std::map<const std::string, const CondAttrListCollection*> m_attrListCollectionMap ATLAS_THREAD_SAFE; // Guarded by m_mutex CondAttrListCollection* m_attrListColl; CondAttrListCollection* m_attrListColl_deadStrip; CondAttrListCollection* m_attrListColl_deadChip; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx index c449b1c6146..8531a1de422 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.cxx @@ -12,11 +12,8 @@ namespace SCT_CalibAlgs { -unsigned int IElementStreamer::m_depth=0; -unsigned int IElementStreamer::m_nodeIndex=0; - IElementStreamer::IElementStreamer(const std::string & name, const std::map<std::string, std::string> & attributeMap, std::ostream & os): - m_name(name), m_os(os),m_nodeId(m_nodeIndex) { + m_name(name), m_os(os), m_depth(0), m_nodeIndex(0), m_nodeId(m_nodeIndex) { std::map<std::string, std::string>::const_iterator i(attributeMap.begin()); std::map<std::string, std::string>::const_iterator end(attributeMap.end()); for(; i!=end; ++i) { diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h index dfeb16ccf1c..a1708e2aa28 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/IElementStreamer.h @@ -23,8 +23,8 @@ class IElementStreamer { std::vector<std::string> m_attributeNames; std::vector<std::string> m_attributeValues; std::ostream & m_os; - static unsigned int m_depth; - static unsigned int m_nodeIndex; + unsigned int m_depth; + unsigned int m_nodeIndex; unsigned int m_nodeId; public: diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx index 3ab782315eb..dcf0375ba0c 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/ISCT_CalibHistoTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -15,10 +15,8 @@ #include "TMath.h" #include <stdexcept> // out_of_range exception -int ISCT_CalibHistoTool::m_nLb=0; -int ISCT_CalibHistoTool::m_nLbMerge=0; - -ISCT_CalibHistoTool::ISCT_CalibHistoTool():m_numberOfEventsHisto(0),m_thistSvc(0),m_pSCTHelper(0) { +ISCT_CalibHistoTool::ISCT_CalibHistoTool():m_numberOfEventsHisto(0),m_thistSvc(0),m_pSCTHelper(0), + m_nLb(0), m_nLbMerge(0) { //std::cout<<"Instantiation of ISCT_CalibHistoTool"<<std::endl; //nop } diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx index a1b99d0424b..a9537e5ab47 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx @@ -202,14 +202,17 @@ StatusCode SCTCalib::initialize() { //--- LB range try { m_LBRange = std::stoi( m_LBMax ); - ISCT_CalibHistoTool::setNumberOfLb(m_LBRange); + m_calibHitmapTool->setNumberOfLb(m_LBRange); + m_calibLbTool->setNumberOfLb(m_LBRange); + m_calibBsErrTool->setNumberOfLb(m_LBRange); } catch (...) { ATH_MSG_ERROR( "Couldn't cast m_LBMax=\""<< m_LBMax <<"\" to m_LBRange..."); m_LBRange = 0; } - ISCT_CalibHistoTool::setLbToMerge(m_nLbsMerged); - + m_calibHitmapTool->setLbToMerge(m_nLbsMerged); + m_calibLbTool->setLbToMerge(m_nLbsMerged); + m_calibBsErrTool->setLbToMerge(m_nLbsMerged); m_readHIST = m_doNoiseOccupancy || m_doRawOccupancy || m_doEfficiency || m_doBSErrorDB || m_doLorentzAngle; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx index 3748c82e541..b98c334f7e5 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx @@ -42,18 +42,18 @@ using std::string; ///////////////////////////////////////////////////////////////////////////// -string SCTCalibWriteTool::s_separator = string("-"); -string SCTCalibWriteTool::s_defectFolderName = string("/SCT/Derived/Monitoring"); -string SCTCalibWriteTool::s_deadStripFolderName = string("/SCT/Derived/DeadStrips"); -string SCTCalibWriteTool::s_deadChipFolderName = string("/SCT/Derived/DeadChips"); -string SCTCalibWriteTool::s_effFolderName = string("/SCT/Derived/Efficiency"); -string SCTCalibWriteTool::s_noFolderName = string("/SCT/Derived/NoiseOccupancy"); -string SCTCalibWriteTool::s_RawOccuFolderName = string("/SCT/Derived/RawOccupancy"); -string SCTCalibWriteTool::s_BSErrFolderName = string("/SCT/Derived/BSErrorsRun2"); -string SCTCalibWriteTool::s_LAFolderName = string("/SCT/Derived/LorentzAngleRun2_v2"); - -static bool becCapsFormat(true); -static bool becUnderscoreFormat(false); +const string SCTCalibWriteTool::s_separator = string("-"); +const string SCTCalibWriteTool::s_defectFolderName = string("/SCT/Derived/Monitoring"); +const string SCTCalibWriteTool::s_deadStripFolderName = string("/SCT/Derived/DeadStrips"); +const string SCTCalibWriteTool::s_deadChipFolderName = string("/SCT/Derived/DeadChips"); +const string SCTCalibWriteTool::s_effFolderName = string("/SCT/Derived/Efficiency"); +const string SCTCalibWriteTool::s_noFolderName = string("/SCT/Derived/NoiseOccupancy"); +const string SCTCalibWriteTool::s_RawOccuFolderName = string("/SCT/Derived/RawOccupancy"); +const string SCTCalibWriteTool::s_BSErrFolderName = string("/SCT/Derived/BSErrorsRun2"); +const string SCTCalibWriteTool::s_LAFolderName = string("/SCT/Derived/LorentzAngleRun2_v2"); + +const bool becCapsFormat(true); +const bool becUnderscoreFormat(false); SCTCalibWriteTool::SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx index 3f97044896a..3fe1ffba284 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -34,7 +34,6 @@ const static string detectorNames[] = { "negativeEndcap", "barrel", "positiveEnd const static int n_BSErrorType = 15; const static int firstBSErrorType = 0; const static int lastBSErrorType = 14; -static int MAXHASH(0); SCT_CalibBsErrorTool::SCT_CalibBsErrorTool(const std::string& type, const std::string& name, const IInterface* parent) : base_class(type, name, parent), @@ -46,7 +45,8 @@ SCT_CalibBsErrorTool::SCT_CalibBsErrorTool(const std::string& type, const std::s m_scterr_eta(0), m_scterr_phi(0), m_scterr_side(0), - m_scterr_type(0) + m_scterr_type(0), + m_maxHash(0) { } @@ -56,7 +56,7 @@ SCT_CalibBsErrorTool::initialize() { if ( m_detStore->retrieve( m_pSCTHelper, "SCT_ID").isFailure()) return msg( MSG::ERROR) << "Unable to retrieve SCTHelper" << endmsg, StatusCode::FAILURE; if ( m_bytestreamErrorsTool.retrieve().isFailure()) return msg( MSG::ERROR) << "Unable to retrieve BS Error Tool" << endmsg, StatusCode::FAILURE; // - MAXHASH=m_pSCTHelper->wafer_hash_max(); + m_maxHash=m_pSCTHelper->wafer_hash_max(); m_waferItrBegin = m_pSCTHelper->wafer_begin(); m_waferItrEnd = m_pSCTHelper->wafer_end(); @@ -161,7 +161,7 @@ SCT_CalibBsErrorTool::fillBsErrorsForWafer(const Identifier & waferId, const int int iWaferHash = (int) m_pSCTHelper->wafer_hash( waferId ); const string osWafer=formatPosition(waferId, m_pSCTHelper,"."); //--- Protection for wrong waferID - if ( iWaferHash < 0 || iWaferHash >= MAXHASH ) { + if ( iWaferHash < 0 || iWaferHash >= m_maxHash ) { msg( MSG::WARNING ) << "WaferHash " << iWaferHash << " is out of range : [ bec.layer.eta.phi.side, BSErrorType ] = [ " << osWafer << ", " << type << " ]" << endmsg; } else { if (msgLvl(MSG::DEBUG)) msg( MSG::DEBUG ) << "BSError : [ bec.layer.eta.phi.side, Type ] = [ " << osWafer<< ", " << type << " ]"<< endmsg; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h index 9eafa8854b8..b21ef94a797 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibBsErrorTool.h @@ -68,6 +68,7 @@ class SCT_CalibBsErrorTool : public extends<AthAlgTool, ISCT_CalibHistoTool> VecInt *m_scterr_phi; VecInt *m_scterr_side; VecInt *m_scterr_type; + int m_maxHash; void fillBsErrorsForWafer(const Identifier & waferId, const int type); -- GitLab