From 2b8ab80bab36faa501447ba7e2d7634785892982 Mon Sep 17 00:00:00 2001 From: scott snyder <scott.snyder@cern.ch> Date: Tue, 2 Oct 2018 15:17:41 +0200 Subject: [PATCH] TileRecUtils: Make ITileRawChannelTool::process const. Working on making calo tools reentrant. Still have issues with TileBeamInfoProvider and TileCondToolOFC. Former-commit-id: 1e6d1d4f3f8837dde4792c82b86a4a0013726a26 --- .../TileRecUtils/ITileRawChannelTool.h | 12 +++++------- .../TileRecUtils/TileRawChannelNoiseFilter.h | 12 +++++------- .../TileRecUtils/TileRawChannelOF1Corrector.h | 10 ++++------ .../src/TileRawChannelNoiseFilter.cxx | 19 ++++++------------- .../src/TileRawChannelOF1Corrector.cxx | 18 +++++------------- 5 files changed, 25 insertions(+), 46 deletions(-) diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h b/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h index 27b58b3894e..8cfd9c49288 100644 --- a/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h +++ b/TileCalorimeter/TileRecUtils/TileRecUtils/ITileRawChannelTool.h @@ -13,15 +13,13 @@ class TileRawChannelContainer ; #include "GaudiKernel/IAlgTool.h" -static const InterfaceID IID_ITileRawChannelTool("ITileRawChannelTool", 1 , 0); - -class ITileRawChannelTool: virtual public IAlgTool { - +class ITileRawChannelTool: virtual public IAlgTool +{ public: - // update TileRawChannelContainer, subtract common mode noise for example - virtual StatusCode process(TileRawChannelContainer * rchCnt)=0 ; + DeclareInterfaceID (ITileRawChannelTool, 1, 0); - static const InterfaceID& interfaceID() { return IID_ITileRawChannelTool;} + // update TileRawChannelContainer, subtract common mode noise for example + virtual StatusCode process(TileRawChannelContainer * rchCnt) const = 0; }; #endif diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h index 4b77aea3255..677b80da209 100644 --- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h +++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h @@ -32,7 +32,8 @@ class TileBeamInfoProvider; @class TileRawChannelNoiseFilter @brief This tool subtracts common-mode noise from all TileRawChannels in one container */ -class TileRawChannelNoiseFilter: public AthAlgTool, virtual public ITileRawChannelTool { +class TileRawChannelNoiseFilter: public extends<AthAlgTool, ITileRawChannelTool> +{ public: /** AlgTool like constructor */ @@ -42,16 +43,13 @@ class TileRawChannelNoiseFilter: public AthAlgTool, virtual public ITileRawChann /** Virtual destructor */ virtual ~TileRawChannelNoiseFilter() {}; - /** AlgTool InterfaceID */ - static const InterfaceID& interfaceID(); - /** AlgTool initialize method.*/ - virtual StatusCode initialize(); + virtual StatusCode initialize() override; /** AlgTool finalize method */ - virtual StatusCode finalize(); + virtual StatusCode finalize() override; /** proceed the coherent noise subtruction algorithm and correct TileRawChannel amplitudes */ - virtual StatusCode process(TileRawChannelContainer *rchCnt); + virtual StatusCode process(TileRawChannelContainer *rchCnt) const override; private: diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h index 6aa0872edf0..cb5b8ba9e1d 100644 --- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h +++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelOF1Corrector.h @@ -36,8 +36,9 @@ class TileCondToolEmscale; @class TileRawChannelOF1Corrector @brief This tool correct TileRawChannels amplitudes which came from OF1 DSP if pedestal changed */ -class TileRawChannelOF1Corrector: public AthAlgTool, virtual public ITileRawChannelTool { - public: +class TileRawChannelOF1Corrector: public extends<AthAlgTool, ITileRawChannelTool> +{ +public: /** AlgTool like constructor */ TileRawChannelOF1Corrector(const std::string& type, const std::string& name, const IInterface* parent); @@ -45,16 +46,13 @@ class TileRawChannelOF1Corrector: public AthAlgTool, virtual public ITileRawChan /** Virtual destructor */ virtual ~TileRawChannelOF1Corrector() {}; - /** AlgTool InterfaceID */ - static const InterfaceID& interfaceID(); - /** AlgTool initialize method.*/ virtual StatusCode initialize() override; /** AlgTool finalize method */ virtual StatusCode finalize() override; /** Correct TileRawChannel amplitudes if pedestal changed */ - virtual StatusCode process(TileRawChannelContainer* rawChannelContainer) override; + virtual StatusCode process(TileRawChannelContainer* rawChannelContainer) const override; private: diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx index bde807b6800..65dde282fd9 100644 --- a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx +++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx @@ -17,17 +17,12 @@ #include "TileConditions/TileCondToolNoiseSample.h" #include "TileRecUtils/TileBeamInfoProvider.h" -static const InterfaceID IID_ITileRawChannelNoiseFilter("TileRawChannelNoiseFilter", 1, 0); - -const InterfaceID& TileRawChannelNoiseFilter::interfaceID() { - return IID_ITileRawChannelNoiseFilter; -} //======================================================== // constructor TileRawChannelNoiseFilter::TileRawChannelNoiseFilter(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent) + : base_class(type, name, parent) , m_tileHWID(0) , m_tileToolEmscale("TileCondToolEmscale") , m_tileToolNoiseSample("TileCondToolNoiseSample") @@ -38,9 +33,6 @@ TileRawChannelNoiseFilter::TileRawChannelNoiseFilter(const std::string& type, , m_useTwoGaussNoise(false) // do not use 2G - has no sense for ADC HF noise for the moment , m_useGapCells(false) // use gap cells for noise filter as all normal cells { - declareInterface<ITileRawChannelTool>(this); - declareInterface<TileRawChannelNoiseFilter>(this); - declareProperty("TileCondToolEmscale", m_tileToolEmscale); declareProperty("TileCondToolNoiseSample", m_tileToolNoiseSample); declareProperty("TileBadChanTool", m_tileBadChanTool); @@ -88,9 +80,9 @@ StatusCode TileRawChannelNoiseFilter::initialize() { // ============================================================================ // process container -StatusCode TileRawChannelNoiseFilter::process( - TileRawChannelContainer *rchCont) { - +StatusCode TileRawChannelNoiseFilter::process ( + TileRawChannelContainer *rchCont) const +{ ATH_MSG_DEBUG("in process()"); TileRawChannelUnit::UNIT rChUnit = rchCont->get_unit(); @@ -111,7 +103,8 @@ StatusCode TileRawChannelNoiseFilter::process( ATH_MSG_VERBOSE( "Units in container is " << units[rChUnit] ); // Now retrieve the TileDQStatus - const TileDQstatus* DQstatus = m_beamInfo->getDQstatus(); + // FIXME: const violation + const TileDQstatus* DQstatus = m_beamInfo.unConst()->getDQstatus(); TileRawChannelContainer::const_iterator collItr = rchCont->begin(); TileRawChannelContainer::const_iterator lastColl = rchCont->end(); diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx index 0c937e2655c..f5e65e9feb5 100644 --- a/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx +++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelOF1Corrector.cxx @@ -18,17 +18,11 @@ #include "StoreGate/ReadHandle.h" #include "AthenaKernel/errorcheck.h" -static const InterfaceID IID_ITileRawChannelOF1Corrector("TileRawChannelOF1Corrector", 1, 0); - -const InterfaceID& TileRawChannelOF1Corrector::interfaceID() { - return IID_ITileRawChannelOF1Corrector; -} - //======================================================== // constructor TileRawChannelOF1Corrector::TileRawChannelOF1Corrector(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent) + : base_class(type, name, parent) , m_tileHWID(0) , m_tileToolNoiseSample("TileCondToolNoiseSample") , m_tileCondToolOfc("TileCondToolOfcCool/TileCondToolOfcCoolOF1") @@ -36,9 +30,6 @@ TileRawChannelOF1Corrector::TileRawChannelOF1Corrector(const std::string& type, , m_tileToolEms("TileCondToolEmscale") , m_tileDspThreshold("TileCondToolDspThreshold") { - declareInterface<ITileRawChannelTool>(this); - declareInterface<TileRawChannelOF1Corrector>(this); - declareProperty("TileCondToolNoiseSample", m_tileToolNoiseSample); declareProperty("TileCondToolOfc", m_tileCondToolOfc); declareProperty("TileCondToolTiming", m_tileToolTiming); @@ -97,8 +88,8 @@ StatusCode TileRawChannelOF1Corrector::initialize() { // ============================================================================ // process container -StatusCode TileRawChannelOF1Corrector::process(TileRawChannelContainer* rawChannelContainer) { - +StatusCode TileRawChannelOF1Corrector::process(TileRawChannelContainer* rawChannelContainer) const +{ ATH_MSG_DEBUG("in process()"); TileFragHash::TYPE rawChannelType = rawChannelContainer->get_type(); @@ -153,7 +144,8 @@ StatusCode TileRawChannelOF1Corrector::process(TileRawChannelContainer* rawChann float onlinePedestalDifference = m_tileToolNoiseSample->getOnlinePedestalDifference(drawerIdx, channel, gain, rawChannelUnit); float phase = -m_tileToolTiming->getSignalPhase(drawerIdx, channel, gain); - const TileOfcWeightsStruct* weights = m_tileCondToolOfc->getOfcWeights(drawerIdx, channel, gain, phase, false); + // FIXME: const violation + const TileOfcWeightsStruct* weights = m_tileCondToolOfc.unConst()->getOfcWeights(drawerIdx, channel, gain, phase, false); float weightsSum(0.0); for (int i = 0; i < weights->n_samples; ++i) weightsSum += weights->w_a[i]; float energyCorrection = onlinePedestalDifference * weightsSum; -- GitLab