From e436c11228043e6148f3d0b552e88711c7199cac Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Thu, 3 Jan 2019 16:06:57 +0100
Subject: [PATCH] TileRecUtils: Switch to using TileDQstatusAlg.

Change from (MT-unsafe) TileBeamInfoProvider to using TileDQstatusAlg
for TileCellBuilder, TileRawChannelBuilder, and TileRawChannelNoiseFilter.
---
 .../TileRecUtils/TileCellBuilder.h            |  23 +-
 .../TileRecUtils/TileRawChannelBuilder.h      |  24 ++-
 .../TileRecUtils/TileRawChannelNoiseFilter.h  |   9 +-
 .../python/TileRawChannelGetter.py            |  19 +-
 .../share/TileCellBuilder_test.py             | 203 ++++++++++--------
 .../share/TileCellBuilder_test.ref            | 123 +++++------
 .../share/TileRawChannelBuilder_test.py       | 180 +++++++++-------
 .../share/TileRawChannelBuilder_test.ref      | 112 +++++-----
 .../TileRecUtils/src/TileCellBuilder.cxx      |  55 +++--
 .../src/TileRawChannelBuilder.cxx             |  59 +++--
 .../src/TileRawChannelNoiseFilter.cxx         |  11 +-
 11 files changed, 450 insertions(+), 368 deletions(-)

diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
index 8e0bcabc98c..06b97d35941 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileCellBuilder.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef TILERECUTILS_TILECELLBUILDER_H
@@ -25,13 +25,14 @@
 // Tile includes
 #include "TileEvent/TileCellContainer.h"
 #include "TileEvent/TileRawChannelContainer.h"
+#include "TileEvent/TileDQstatus.h"
 #include "TileIdentifier/TileFragHash.h"
 #include "TileIdentifier/TileRawChannelUnit.h"
 #include "TileConditions/ITileBadChanTool.h"
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileCondToolTiming.h"
 #include "TileRecUtils/ITileRawChannelTool.h"
-//#include "TileRecUtils/TileBeamInfoProvider.h"
+#include "TileConditions/ITileDCSTool.h"
 
 // Calo includes
 #include "CaloInterface/ICaloCellMakerTool.h"
@@ -65,7 +66,6 @@ class MbtsDetDescrManager;
 class TileDetDescrManager;
 class TileCellCollection;
 class CaloCellContainer;
-class TileBeamInfoProvider;
 class TileDQstatus;
 
 
@@ -127,7 +127,8 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     virtual StatusCode process(CaloCellContainer* theCellContainer); // method to process all raw channels and store them in container
 
     template<class ITERATOR, class COLLECTION>
-    void build(const ITERATOR & begin, const ITERATOR & end, COLLECTION * coll); //!< method to process raw channels from a given vector and store them in collection
+    void build(const EventContext& ctx,
+               const ITERATOR & begin, const ITERATOR & end, COLLECTION * coll); //!< method to process raw channels from a given vector and store them in collection
 
     /** method to check if channels are good or bad. Puts zero if both channels are bad
      or recovers from single-channel failure. It returns true if cell was changed, false otherwise
@@ -155,6 +156,10 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfo",
                                                       "EventInfo", "Input Event info key"};
 
+    SG::ReadHandleKey<TileDQstatus> m_DQstatusKey{this, "TileDQstatus", 
+                                                  "TileDQstatus", 
+                                                  "TileDQstatus key"};
+
     SG::WriteHandleKey<TileCellContainer> m_MBTSContainerKey{this, "MBTSContainer", 
                                                              "MBTSContainer", 
                                                              "Output Tile MBTS container key"};
@@ -193,6 +198,8 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     bool m_maskBadChannels;      //!< if true=> bad channels are masked
     bool m_fakeCrackCells;       //!< if true=> fake E3/E4 cells added
     int  m_skipGain;             //!< for two-gain calib runs skip one of two gains
+    int m_useDemoCabling;
+    bool m_checkDCS;
 
     const TileID* m_tileID;   //!< Pointer to TileID
     const TileTBID* m_tileTBID; //!< Pointer to TileTBID
@@ -209,11 +216,11 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
         "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
 
-    ToolHandle<TileBeamInfoProvider> m_beamInfo; //!< Beam Info tool to get the DQ Status object
-
     ToolHandleArray<ITileRawChannelTool> m_noiseFilterTools{this,
         "NoiseFilterTools", {}, "Tile noise filter tools"};
 
+    ToolHandle<ITileDCSTool> m_tileDCS;
+
     const TileDetDescrManager* m_tileMgr; //!< Pointer to TileDetDescrManager
     const MbtsDetDescrManager* m_mbtsMgr; //!< Pointer to MbtsDetDescrManager
 
@@ -233,8 +240,6 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_global;
     std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_current_run;
 
-    int m_useDemoCabling;
-    
     void correctCell(TileCell* pCell, int correction, int pmt, int gain, float ener, float time,
         unsigned char iqual, unsigned char qbit, int ch_type); //!< Compute calibrated energy, time, etc. for TileCell and adjust it.
 
@@ -245,6 +250,8 @@ class TileCellBuilder: public AthAlgTool, virtual public ICaloCellMakerTool {
     unsigned char qbits(int ros, int drawer, bool count_over, bool good_time, bool good_ener,
         bool overflow, bool underflow, bool good_overflowfit); //!< method to compute the cell quality bits
 
+    bool isChanDCSgood (int ros, int drawer, int channel) const;
+
     template<typename T, typename V>
     class DoubleVectorIterator {
         T* m_first;
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h
index 49b1d2f520c..e90045565bd 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelBuilder.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
 */
 
 #ifndef TILERECUTILS_ITILERAWCHANNELBUILDER_H
@@ -32,6 +32,7 @@
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/TileCondToolTiming.h"
 #include "TileConditions/TileCondIdTransforms.h"
+#include "TileEvent/TileDQstatus.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
@@ -93,9 +94,6 @@ class TileRawChannelBuilder: public AthAlgTool {
       m_rawChannelCnt->push_back(std::unique_ptr<TileRawChannel>(rawChannel(digits)));
     }
 
-    // find all bad patterns in a drawer and fill internal static arrays
-    void fill_drawer_errors(const TileDigitsCollection* collection);
-
     // process all digits from one collection and store results in internal container
     void build(const TileDigitsCollection* collection);
 
@@ -139,7 +137,16 @@ class TileRawChannelBuilder: public AthAlgTool {
     friend class TileHid2RESrcID;
 
     // properties
-    // name of TDS container with output TileRawChannels
+    // DQ status.
+    SG::ReadHandleKey<TileDQstatus> m_DQstatusKey{this, "TileDQstatus", 
+                                                  "TileDQstatus", 
+                                                  "TileDQstatus key"};
+
+    // DSP container.  Only used of m_useDSP is set.
+    SG::ReadHandleKey<TileRawChannelContainer> m_DSPContainerKey
+      {this, "DSPContainer", "",  "DSP Container key"};
+
+  // name of TDS container with output TileRawChannels
     SG::WriteHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer","TileRawChannelFiltered",
                                                                          "Output Tile raw channels container key"};
 
@@ -174,7 +181,6 @@ class TileRawChannelBuilder: public AthAlgTool {
     const TileHWID* m_tileHWID;
     const TileInfo* m_tileInfo;
 
-    ToolHandle<TileBeamInfoProvider> m_beamInfo;
     ToolHandleArray<ITileRawChannelTool> m_noiseFilterTools{this,
         "NoiseFilterTools", {}, "Tile nose filter tools"};
 
@@ -216,6 +222,12 @@ class TileRawChannelBuilder: public AthAlgTool {
     static bool s_badDrawer;
     
     bool m_notUpgradeCabling;
+
+private:
+    // find all bad patterns in a drawer and fill internal static arrays
+    void fill_drawer_errors(const EventContext& ctx,
+                            const TileDigitsCollection* collection);
+
 };
 
 #endif
diff --git a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
index b7865feb8af..a15dfc55dbd 100644
--- a/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
+++ b/TileCalorimeter/TileRecUtils/TileRecUtils/TileRawChannelNoiseFilter.h
@@ -16,9 +16,11 @@
 #include "TileConditions/TileCondToolEmscale.h"
 #include "TileConditions/ITileBadChanTool.h"
 #include "TileConditions/TileCondToolNoiseSample.h"
+#include "TileEvent/TileDQstatus.h"
 
 // Atlas includes
 #include "AthenaBaseComps/AthAlgTool.h"
+#include "StoreGate/ReadHandleKey.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "GaudiKernel/ServiceHandle.h"
 
@@ -27,7 +29,6 @@ class TileHWID;
 class TileRawChannel;
 class TileRawChannelContainer;
 class TileRawChannelCollection;
-class TileBeamInfoProvider;
 
 /**
  @class TileRawChannelNoiseFilter
@@ -66,9 +67,11 @@ class TileRawChannelNoiseFilter: public extends<AthAlgTool, ITileRawChannelTool>
     ToolHandle<ITileBadChanTool> m_tileBadChanTool{this,
         "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};
 
-    ToolHandle<TileBeamInfoProvider> m_beamInfo; //!< Beam Info tool to get the DQ Status object
-
     // properties
+    SG::ReadHandleKey<TileDQstatus> m_DQstatusKey{this, "TileDQstatus", 
+                                                  "TileDQstatus", 
+                                                  "TileDQstatus key"};
+
     float m_truncationThresholdOnAbsEinSigma;
     float m_minimumNumberOfTruncatedChannels;
     bool m_useTwoGaussNoise;
diff --git a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
index 1ee5c18cc2e..ffc874c681c 100644
--- a/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
+++ b/TileCalorimeter/TileRecUtils/python/TileRawChannelGetter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 # Author: J. Poveda (Ximo.Poveda@cern.ch)
 # TileRawChannel creation from TileDigits 
@@ -88,6 +88,12 @@ class TileRawChannelGetter ( Configured)  :
             theTileBeamInfoProvider.TileDigitsContainer="";
             theTileBeamInfoProvider.TileRawChannelContainer="";
 
+        from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault
+        dq = TileDQstatusAlgDefault (TileRawChannelContainer = theTileBeamInfoProvider.TileRawChannelContainer,
+                                     TileDigitsContainer = theTileBeamInfoProvider.TileDigitsContainer,
+                                     TileBeamElemContainer = theTileBeamInfoProvider.TileBeamElemContainer)
+                                
+
         # set time window for amplitude correction if it was not set correctly before
         if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() <= jobproperties.TileRecFlags.TimeMinForAmpCorrection() :
             from AthenaCommon.BeamFlags import jobproperties
@@ -198,6 +204,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderQIEFilter.correctTime     = jobproperties.TileRecFlags.correctTime()
                 theTileRawChannelBuilderQIEFilter.NoiseFilterTools= NoiseFilterTools
                 theTileRawChannelBuilderQIEFilter.PedestalMode = 1
+                theTileRawChannelBuilderQIEFilter.DSPContainer = dq.TileRawChannelContainer
       
                 mlog.info(" adding now TileRawChannelBuilderQIEFilter to the algorithm: %s" % theTileRawChannelMaker.name())
       
@@ -221,6 +228,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderManyAmps.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                 theTileRawChannelBuilderManyAmps.correctTime     = jobproperties.TileRecFlags.correctTime()    
                 theTileRawChannelBuilderManyAmps.NoiseFilterTools= NoiseFilterTools
+                theTileRawChannelBuilderManyAmps.DSPContainer = dq.TileRawChannelContainer
                  
                 mlog.info(" adding now TileRawChannelBuilderManyAmps to the algorithm: %s" % theTileRawChannelMaker.name())
       
@@ -246,6 +254,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderFlatFilter.NoiseFilterTools= NoiseFilterTools
                 theTileRawChannelBuilderFlatFilter.FrameLength = TileFrameLength
                 theTileRawChannelBuilderFlatFilter.SignalLength = TileFrameLength - 1
+                theTileRawChannelBuilderFlatFilter.DSPContainer = dq.TileRawChannelContainer
       
                 mlog.info(" adding now TileRawChannelBuilderFlatFilter to the algorithm: %s" % theTileRawChannelMaker.name())
       
@@ -269,6 +278,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderFitFilter.correctTime     = jobproperties.TileRecFlags.correctTime()    
                 theTileRawChannelBuilderFitFilter.NoiseFilterTools= NoiseFilterTools
                 theTileRawChannelBuilderFitFilter.FrameLength = TileFrameLength
+                theTileRawChannelBuilderFitFilter.DSPContainer = dq.TileRawChannelContainer
                 
                 # add the tool to list of tool ( should use ToolHandle eventually)
                 mlog.info(" adding now TileRawChannelBuilderFitFilter to the algorithm: %s" % theTileRawChannelMaker.name())
@@ -304,6 +314,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderFitFilterCool.correctTime     = jobproperties.TileRecFlags.correctTime()    
                 theTileRawChannelBuilderFitFilterCool.NoiseFilterTools= NoiseFilterTools
                 theTileRawChannelBuilderFitFilterCool.FrameLength = TileFrameLength
+                theTileRawChannelBuilderFitFilterCool.DSPContainer = dq.TileRawChannelContainer
                 
                 # add the tool to list of tool ( should use ToolHandle eventually)
                 mlog.info(" adding now TileRawChannelBuilderFitFilterCool to the algorithm: %s" % theTileRawChannelMaker.name())
@@ -344,6 +355,7 @@ class TileRawChannelGetter ( Configured)  :
                     theTileRawChannelBuilderMF.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                     theTileRawChannelBuilderMF.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()
 
+                theTileRawChannelBuilderMF.DSPContainer = dq.TileRawChannelContainer
                 mlog.info(" adding now TileRawChannelBuilderMF to the algorithm: %s" % theTileRawChannelMaker.name())
       
                 theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderMF]
@@ -369,6 +381,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderOptFilter.Minus1Iteration = True
                 theTileRawChannelBuilderOptFilter.AmplitudeCorrection = False; # don't need correction after iterations
                 theTileRawChannelBuilderOptFilter.TimeCorrection = False # don't need correction after iterations
+                theTileRawChannelBuilderOptFilter.DSPContainer = dq.TileRawChannelContainer
                 
                 ServiceMgr.TileInfoLoader.LoadOptFilterWeights=True
                 
@@ -417,6 +430,7 @@ class TileRawChannelGetter ( Configured)  :
                     theTileRawChannelBuilderOF1.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                     theTileRawChannelBuilderOF1.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()
       
+                theTileRawChannelBuilderOF1 = dq.TileRawChannelContainer
                 mlog.info(" adding now TileRawChannelBuilderOF1 to the algorithm: %s" % theTileRawChannelMaker.name())
       
                 theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOF1]
@@ -448,6 +462,7 @@ class TileRawChannelGetter ( Configured)  :
                 theTileRawChannelBuilderOpt2Filter.Minus1Iteration = True
                 theTileRawChannelBuilderOpt2Filter.AmplitudeCorrection = False; # don't need correction after iterations
                 theTileRawChannelBuilderOpt2Filter.TimeCorrection    = False; # don't need correction after iterations
+                theTileRawChannelBuilderOpt2Filter.DSPContainer = dq.TileRawChannelContainer
       
                 mlog.info(" adding now TileRawChannelBuilderOpt2Filter to the algorithm: %s" % theTileRawChannelMaker.name())
       
@@ -494,6 +509,8 @@ class TileRawChannelGetter ( Configured)  :
                 if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                     theTileRawChannelBuilderOptATLAS.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                     theTileRawChannelBuilderOptATLAS.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()
+
+                theTileRawChannelBuilderOptATLAS.DSPContainer = dq.TileRawChannelContainer
                 
                 mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name TileRawChannelBuilderOptATLAS to the algorithm: %s"
                           % theTileRawChannelMaker.name())
diff --git a/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.py b/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.py
index ee913b05f76..3236aa274dd 100644
--- a/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.py
+++ b/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.py
@@ -185,7 +185,7 @@ exp_mbts_3 = exp_merge (exp_mbts_0, {
     (4, 1,  6,  1, 0) : [  0.6891,  0.0,      0.0,   0.0, 2, 0,  34,   0, 1,-1],
 })
 
-# TileBeamInfoProvider errors
+# TileDQstatus errors
 exp_cells_4 = exp_merge (exp_cells_0, {
     (2, 1, 18, 10, 1):[620.2579,620.2579,  1.3,  1.3,   3,   3, 161, 169, 1, 1],
     (2, 1, 18, 12, 0):[  0.5,     0.5,     0.0,  0.0, 255, 255,   9,   9, 1, 1],
@@ -264,55 +264,33 @@ class TileFragHash:
 
 
 from AthenaPython.PyAthenaComps import Alg, StatusCode
-class TestAlg (Alg):
+
+
+###########################################################
+
+class PrepareDataAlg (Alg):
     def __init__ (self, name):
         Alg.__init__ (self, name)
         return
-
+    
     def initialize (self):
-        ROOT.ICaloCellMakerTool
-
-        def gettool (name):
-            tool = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('TileCellBuilder/' + name)
-            if not tool.retrieve():
-                assert 0
-            return tool
-
-        self.tool1 = gettool ('tool1')
-        self.tool2 = gettool ('tool2')
-        self.tool4 = gettool ('tool4')
-        self.tool5 = gettool ('tool5')
-        self.tool6 = gettool ('tool6')
-        self.tool7 = gettool ('tool7')
-        self.tool8 = gettool ('tool8')
-        self.tool9 = gettool ('tool9')
-        self.tool10 = gettool ('tool10')
-        self.tool11 = gettool ('tool11')
-
-        self.beaminfo4 = ROOT.ToolHandle(ROOT.TileBeamInfoProvider)('TileBeamInfoProvider/beaminfo4')
-        if not self.beaminfo4.retrieve():
-            return StatusCode.Failure
         return StatusCode.Success
 
-
-    def finalize (self):
-        self.check_bad_chan_lines()
-        return StatusCode.Success
-
-
     def execute (self):
         iev = self.getContext().evt()
 
         hits = hits_0
-        exp_cells = exp_cells_0
-        exp_mbts = exp_mbts_0
-        extra_ei_flags = 0
-        tool = self.tool1
+        self.exp_cells = exp_cells_0
+        self.exp_mbts = exp_mbts_0
+        self.extra_ei_flags = 0
+        self.tool = 'tool1'
         baddq = {}
         bsflags = 0x32002000
         dspbsflags = 0x32002000
-        rctype = TileFragHash.OptFilterOffline
+        self.rctype = TileFragHash.OptFilterOffline
         dspcolls = set()
+        dqhits = {}
+
         if iev == 0:
             # Event 0: nominal
             pass
@@ -320,96 +298,82 @@ class TestAlg (Alg):
         elif iev == 1:
             # Event 1: Add an underflow.
             hits = hits_1
-            extra_ei_flags = 0x40
-            exp_cells = exp_cells_1
+            self.extra_ei_flags = 0x40
+            self.exp_cells = exp_cells_1
 
         elif iev == 2:
             # Event 2: Add an overflow.
             hits = hits_2
-            extra_ei_flags = 0x400
-            exp_cells = exp_cells_2
+            self.extra_ei_flags = 0x400
+            self.exp_cells = exp_cells_2
 
         elif iev == 3:
             # Event 3: Bad channels
-            tool = self.tool2
-            exp_cells = exp_cells_3
-            exp_mbts = exp_mbts_3
+            self.tool = 'tool2'
+            self.exp_cells = exp_cells_3
+            self.exp_mbts = exp_mbts_3
 
         elif iev == 4:
-            # Event 4: Bad channels from BeamInfoProvider.
-            tool = self.tool4
-            rctype = TileFragHash.OptFilterDsp
+            # Event 4: Bad channels from TileDQstatus
+            self.rctype = TileFragHash.OptFilterDsp
             baddq = {146 : [2, 10]}
-            exp_cells = exp_cells_4
+            self.exp_cells = exp_cells_4
+            dqhits = hits
 
         elif iev == 5:
             # Event 5: fakeCrackCells
-            tool = self.tool5
-            exp_cells = exp_cells_5
+            self.tool = 'tool5'
+            self.exp_cells = exp_cells_5
 
         elif iev == 6:
             # Event 6: Threshold.
-            tool = self.tool6
-            exp_cells = exp_cells_6
+            self.tool = 'tool6'
+            self.exp_cells = exp_cells_6
 
         elif iev == 7:
             # Event 7: Corrections
-            tool = self.tool7
+            self.tool = 'tool7'
             bsflags = 0x32000000
-            exp_cells = exp_cells_7
-            exp_mbts = exp_mbts_7
+            self.exp_cells = exp_cells_7
+            self.exp_mbts = exp_mbts_7
 
         elif iev == 8:
             # Event 8: noise filter
-            tool = self.tool8
-            exp_cells = exp_cells_8
+            self.tool = 'tool8'
+            self.exp_cells = exp_cells_8
 
         elif iev == 9:
             # Event 9: dsp container
-            tool = self.tool9
+            self.tool = 'tool9'
             dspcolls.add (0)
 
         elif iev == 10:
             # Event 10: dsp container + corrections
-            tool = self.tool10
+            self.tool = 'tool10'
             dspcolls.add (0)
             bsflags = 0x32000000
             dspbsflags = 0x20000000
-            exp_cells = exp_cells_10
-            exp_mbts = exp_mbts_7
+            self.exp_cells = exp_cells_10
+            self.exp_mbts = exp_mbts_7
 
         else:
             # Event 11: dsp container + noise filter
-            tool = self.tool11
+            self.tool = 'tool11'
             dspcolls.add (0)
-            exp_cells = exp_cells_8
-
+            self.exp_cells = exp_cells_8
 
-        self.record_raw_data (hits, rctype, baddq, bsflags, dspbsflags, dspcolls)
-        if iev == 4:
-            self.beaminfo4.setContainers (None,
-                                          self.evtStore['TileRawChannelCnt'],
-                                          None)
 
-        ccc = ROOT.CaloCellContainer()
-        if not tool.process (ccc):
-            return StatusCode.Failure
+        self.record_raw_data (hits, self.rctype, baddq, bsflags, dspbsflags, dspcolls)
 
-        self.compare_cells (ccc, exp_cells, rctype)
-        self.compare_cells (self.evtStore['MBTSContainer'], exp_mbts, rctype)
-        self.compare_cells (self.evtStore['E4prContainer'], exp_e4_0, rctype)
+        self.record_raw_data (dqhits, self.rctype, baddq, bsflags,
+                              rawname = 'TRCDQ')
 
-        self.check_ei (extra_ei_flags)
         return StatusCode.Success
 
 
-    @staticmethod
-    def update_qbit (qb, rctype):
-        if qb == 0: return 0
-        return qb&(~7) | rctype
-
-
-    def record_raw_data (self, hits, typ, baddq, bsflags, dspbsflags, dspcolls):
+    def record_raw_data (self, hits, typ, baddq, bsflags,
+                         dspbsflags=0, dspcolls=set(),
+                         rawname = 'TileRawChannelCnt'):
         idHelper  = self.detStore['CaloCell_ID'].tile_idHelper()
 
         unit = 0 # TileRawChannelUnit::ADCcounts
@@ -446,12 +410,70 @@ class TestAlg (Alg):
             thiscont.addCollection (coll, ROOT.IdentifierHash(icoll))
             ROOT.SetOwnership (coll, False)
 
-        self.evtStore.record (cont, 'TileRawChannelCnt', False)
+        self.evtStore.record (cont, rawname, False)
         if dspcont:
             self.evtStore.record (dspcont, 'TileRawChannelCntDsp', False)
         return
 
 
+###########################################################
+
+
+class TestAlg (Alg):
+    def __init__ (self, name, prepAlg):
+        Alg.__init__ (self, name)
+        self.prepAlg = prepAlg
+        return
+
+    def initialize (self):
+        ROOT.ICaloCellMakerTool
+
+        def gettool (name):
+            tool = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('TileCellBuilder/' + name)
+            if not tool.retrieve():
+                assert 0
+            return tool
+
+        self.tool1 = gettool ('tool1')
+        self.tool2 = gettool ('tool2')
+        self.tool5 = gettool ('tool5')
+        self.tool6 = gettool ('tool6')
+        self.tool7 = gettool ('tool7')
+        self.tool8 = gettool ('tool8')
+        self.tool9 = gettool ('tool9')
+        self.tool10 = gettool ('tool10')
+        self.tool11 = gettool ('tool11')
+
+        return StatusCode.Success
+
+
+    def finalize (self):
+        self.check_bad_chan_lines()
+        return StatusCode.Success
+
+
+    def execute (self):
+        tool = getattr (self, self.prepAlg.tool)
+
+        ccc = ROOT.CaloCellContainer()
+        if not tool.process (ccc):
+            return StatusCode.Failure
+
+        rctype = self.prepAlg.rctype
+        self.compare_cells (ccc, self.prepAlg.exp_cells, rctype)
+        self.compare_cells (self.evtStore['MBTSContainer'], self.prepAlg.exp_mbts, rctype)
+        self.compare_cells (self.evtStore['E4prContainer'], exp_e4_0, rctype)
+
+        self.check_ei (self.prepAlg.extra_ei_flags)
+        return StatusCode.Success
+
+
+    @staticmethod
+    def update_qbit (qb, rctype):
+        if qb == 0: return 0
+        return qb&(~7) | rctype
+
+
     def compare_cells (self, ccc, exp_cells, rctype):
         exp_cells = exp_cells.copy()
         idHelper  = self.detStore['CaloCell_ID'].tile_idHelper()
@@ -502,7 +524,6 @@ class TestAlg (Alg):
 
     def check_ei (self, extra_flags):
         ei = self.evtStore['EventInfo']
-        print ('zzz', hex(ei.eventFlags (ROOT.xAOD.EventInfo.Tile)), ei.errorState (ROOT.xAOD.EventInfo.Tile), hex(0xf0f0005 | extra_flags))
         assert ei.eventFlags (ROOT.xAOD.EventInfo.Tile) == (0xf0f0005 | extra_flags)
         assert ei.errorState (ROOT.xAOD.EventInfo.Tile) == ROOT.xAOD.EventInfo.Error
         return
@@ -640,16 +661,14 @@ bct2 = make_tileBadChanTool ('tilecellbuilder_bct2',
 
 
 
-from TileRecUtils.TileRecUtilsConf import TileCellBuilder, TileBeamInfoProvider, TileRawChannelNoiseFilter
-beaminfo4 = TileBeamInfoProvider ('beaminfo4')
-ToolSvc += beaminfo4
+from TileRecUtils.TileRecUtilsConf import TileCellBuilder, \
+    TileRawChannelNoiseFilter, TileDQstatusAlg
 noisefilter = TileRawChannelNoiseFilter ('noisefilter')
 
 def maketool (name, bct, **kw):
     return TileCellBuilder (name, TileBadChanTool = bct, **kw)
 ToolSvc += maketool ('tool1', bct1)
 ToolSvc += maketool ('tool2', bct2)
-ToolSvc += maketool ('tool4', bct1, BeamInfo = beaminfo4)
 ToolSvc += maketool ('tool5', bct1, fakeCrackCells = True)
 ToolSvc += maketool ('tool6', bct1, EThreshold = 300)
 ToolSvc += maketool ('tool7', bct1, correctAmplitude = True, correctTime = True)
@@ -663,7 +682,13 @@ ToolSvc += maketool ('tool11', bct1, TileDSPRawChannelContainer = 'TileRawChanne
 from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg
 topSequence += xAODMaker__EventInfoCnvAlg (DoBeginRun = False)
 
-testalg1 = TestAlg ('testalg1')
+prepalg1 = PrepareDataAlg ('prepalg1')
+topSequence += prepalg1
+
+dqstat1 = TileDQstatusAlg ('dqstat1', TileRawChannelContainer = 'TRCDQ')
+topSequence += dqstat1
+
+testalg1 = TestAlg ('testalg1', prepalg1)
 topSequence += testalg1
 
 
diff --git a/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.ref b/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.ref
index ec0260496ca..7d40749d01d 100644
--- a/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.ref
+++ b/TileCalorimeter/TileRecUtils/share/TileCellBuilder_test.ref
@@ -1,14 +1,14 @@
-Mon Dec 17 01:54:08 CET 2018
+Thu Jan  3 16:18:39 CET 2019
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.1] [x86_64-slc6-gcc62-dbg] [atlas-work3/d6d3116653c] -- built on [2018-12-16T1848]
+Py:Athena            INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3g/be87ec46e65] -- built on [2019-01-03T1609]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "TileRecUtils/TileCellBuilder_test.py"
 [?1034hSetGeometryVersion.py obtained major release version 22
 Py:Athena            INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py"
-Py:ConfigurableDb    INFO Read module info for 5459 configurables from 51 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5435 configurables from 6 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 EventInfoMgtInit: Got release version  Athena-22.0.1
 Py:IOVDbSvc.CondDB    INFO Setting up conditions DB access to instance OFLP200
@@ -28,7 +28,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v30r5)
-                                          running on lxplus073.cern.ch on Mon Dec 17 01:54:30 2018
+                                          running on lxplus064.cern.ch on Thu Jan  3 16:18:56 2019
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -36,7 +36,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 6864 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 6912 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 MetaDataSvc          INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
@@ -45,8 +45,8 @@ PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.x
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
 DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host lxplus073.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus064.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc              INFO Setting up APR FileCatalog and Streams
 PoolSvc           WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
@@ -83,7 +83,7 @@ IOVDbSvc             INFO Added taginfo remove for /TILE/OFL02/STATUS/ADC
 IOVDbSvc             INFO Added taginfo remove for /TILE/OFL02/TIME/CHANNELOFFSET/PHY
 IOVDbSvc             INFO Added taginfo remove for /TILE/ONL01/STATUS/ADC
 IOVDbSvc             INFO Added taginfo remove for /LAR/LArCellPositionShift
-ClassIDSvc           INFO  getRegistryEntries: read 1919 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1871 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 17 CLIDRegistry entries for module ALL
 DetDescrCnvSvc       INFO  initializing 
 DetDescrCnvSvc       INFO Found DetectorStore service
@@ -176,7 +176,7 @@ TileDddbManager      INFO n_tileSwitches = 1
 ClassIDSvc           INFO  getRegistryEntries: read 213 CLIDRegistry entries for module ALL
 CaloIDHelper_ID...   INFO in createObj: creating a TileID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/TileNeighbour_reduced.txt
+TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNeighbour_reduced.txt
 TileHWIDDetDesc...   INFO in createObj: creating a TileHWID helper object in the detector store
 TileHWID             INFO initialize_from_dictionary 
 AtlasDetectorID      INFO initialize_from_dictionary - OK
@@ -188,9 +188,9 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_ID helper object in th
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal2DNeighbors-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal3DNeighborsNext-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal3DNeighborsPrev-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal2DNeighbors-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsNext-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsPrev-April2011.txt
 CaloIDHelper_ID...   INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 LArMiniFCAL_ID       INFO  initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.
@@ -217,11 +217,11 @@ TileInfoLoader       INFO Sampling fraction for E2 cells 1/107
 TileInfoLoader       INFO Sampling fraction for E3 cells 1/97
 TileInfoLoader       INFO Sampling fraction for E4 cells 1/75
 TileInfoLoader       INFO Sampling fraction for E4' cells 1/75
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulsehi_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulselo_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_tower_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_muonRcv_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_muon_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulsehi_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulselo_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_tower_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_muonRcv_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_muon_physics.dat
 CaloIDHelper_ID...   INFO in createObj: creating a CaloLVL1_ID helper object in the detector store
 CaloLVL1_ID          INFO initialize_from_dictionary
 AtlasDetectorID      INFO initialize_from_dictionary - OK
@@ -277,18 +277,18 @@ TileTimingCondA...   INFO Creating TileCondProxyCool(TileTimingCondAlg.TileCondP
 tilecellbuilder...   INFO ProxyOnlBch and ProxyOflBch will be used for bad channel status
 tilecellbuilder...   INFO ProxyOnlBch and ProxyOflBch will be used for bad channel status
 ClassIDSvc           INFO  getRegistryEntries: read 504 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 4846 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...WARNING Beam conditions service not available
 xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
 xAODMaker::Even...   INFO Luminosity information not available
 xAODMaker::Even...   INFO Will take information from the EventInfo object
-ClassIDSvc           INFO  getRegistryEntries: read 319 CLIDRegistry entries for module ALL
 PyComponentMgr       INFO Initializing PyComponentMgr...
+prepalg1             INFO Initializing prepalg1...
 testalg1             INFO Initializing testalg1...
-ClassIDSvc           INFO  getRegistryEntries: read 4946 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 389 CLIDRegistry entries for module ALL
 ToolSvc.tool1        INFO Storing MBTS cells in MBTSContainer
-ToolSvc.TileBea...   INFO in initialize()
 ToolSvc.tool1        INFO none of thresholds set, all RawChannels will be converted to Cells
 ToolSvc.tool1        INFO size of temp vector set to 5184
 ToolSvc.tool1        INFO taking RawChannels from 'TileRawChannelCnt'
@@ -300,13 +300,6 @@ ToolSvc.tool2        INFO size of temp vector set to 5184
 ToolSvc.tool2        INFO taking RawChannels from 'TileRawChannelCnt'
 ToolSvc.tool2        INFO Storing E4'  cells in E4prContainer
 ToolSvc.tool2        INFO TileCellBuilder initialization completed
-ToolSvc.tool4        INFO Storing MBTS cells in MBTSContainer
-ToolSvc.beaminfo4    INFO in initialize()
-ToolSvc.tool4        INFO none of thresholds set, all RawChannels will be converted to Cells
-ToolSvc.tool4        INFO size of temp vector set to 5184
-ToolSvc.tool4        INFO taking RawChannels from 'TileRawChannelCnt'
-ToolSvc.tool4        INFO Storing E4'  cells in E4prContainer
-ToolSvc.tool4        INFO TileCellBuilder initialization completed
 ToolSvc.tool5        INFO Storing MBTS cells in MBTSContainer
 ToolSvc.tool5        INFO none of thresholds set, all RawChannels will be converted to Cells
 ToolSvc.tool5        INFO size of temp vector set to 5184
@@ -358,7 +351,6 @@ ToolSvc.tool11       INFO Storing E4'  cells in E4prContainer
 ToolSvc.tool11       INFO TileCellBuilder initialization completed
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
-ClassIDSvc           INFO  getRegistryEntries: read 274 CLIDRegistry entries for module ALL
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CES'
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CIS/FIT/LIN'
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CIS/FIT/NLN'
@@ -398,12 +390,12 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_SuperCell_ID helper ob
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells2DNeighborsNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
 CaloIDHelper_ID...   INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/TileSuperCellNeighbour.txt
+TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileSuperCellNeighbour.txt
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIdMgrDetDes...   INFO  Finished 
 CaloIdMgrDetDes...   INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv 
@@ -433,8 +425,8 @@ TileBadChannels...   INFO TileBchStatus::isNoisy() is defined by: Large HF noise
 TileBadChannels...   INFO TileBchStatus::isNoGainL1() is defined by: ADC dead; No PMT connected; No HV; Channel masked for LV1 (unspecified); LV1 channel no gain; LV1 channel noisy; Channel disabled for LV1; 
 TileBadChannels...   INFO TileBchStatus::isBadTiming() is defined by: Bad timing; Online bad timing; 
 TileBadChannels...   INFO No drawer trips probabilities found in DB
-tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct1Cond.tilecellbuilder_bct1_onl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/TileNoBad.oflBch"
-tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct1Cond.tilecellbuilder_bct1_ofl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/TileNoBad.oflBch"
+tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct1Cond.tilecellbuilder_bct1_onl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNoBad.oflBch"
+tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct1Cond.tilecellbuilder_bct1_ofl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNoBad.oflBch"
 tilecellbuilder...   INFO No TileBchStatus::isBad() definition found in DB, using defaults
 tilecellbuilder...   INFO No TileBchStatus::isNoisy() definition found in DB, using defaults
 tilecellbuilder...   INFO No TileBchStatus::isNoGainL1() definition found in DB, using defaults
@@ -444,8 +436,8 @@ tilecellbuilder...   INFO TileBchStatus::isNoisy() is defined by: Large HF noise
 tilecellbuilder...   INFO TileBchStatus::isNoGainL1() is defined by: ADC dead; No PMT connected; No HV; Channel masked for LV1 (unspecified); LV1 channel no gain; LV1 channel noisy; Channel disabled for LV1; 
 tilecellbuilder...   INFO TileBchStatus::isBadTiming() is defined by: Bad timing; Online bad timing; 
 tilecellbuilder...   INFO No drawer trips probabilities found in DB
-tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct2Cond.tilecellbuilder_bct2_onl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/TileNoBad.oflBch"
-tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct2Cond.tilecellbuilder_bct2_ofl) for ASCII file name: "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3/build-x86_64-slc6-gcc62-dbg/TileCalorimeter/TileRecUtils/unitTestRun/tilecellbuilder_bct2.bch"
+tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct2Cond.tilecellbuilder_bct2_onl) for ASCII file name: "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNoBad.oflBch"
+tilecellbuilder...   INFO Creating TileCondProxyFile(tilecellbuilder_bct2Cond.tilecellbuilder_bct2_ofl) for ASCII file name: "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3g/build-x86_64-slc6-gcc62-opt/TileCalorimeter/TileRecUtils/unitTestRun/tilecellbuilder_bct2.bch"
 tilecellbuilder...   INFO No TileBchStatus::isBad() definition found in DB, using defaults
 tilecellbuilder...   INFO No TileBchStatus::isNoisy() definition found in DB, using defaults
 tilecellbuilder...   INFO No TileBchStatus::isNoGainL1() definition found in DB, using defaults
@@ -456,43 +448,32 @@ tilecellbuilder...   INFO TileBchStatus::isNoGainL1() is defined by: ADC dead; N
 tilecellbuilder...   INFO TileBchStatus::isBadTiming() is defined by: Bad timing; Online bad timing; 
 tilecellbuilder...   INFO No drawer trips probabilities found in DB
 ClassIDSvc           INFO  getRegistryEntries: read 650 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 67 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 187 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 8 CLIDRegistry entries for module ALL
-zzz 0xf0f0005L 2 0xf0f0005
+ClassIDSvc           INFO  getRegistryEntries: read 37 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
-ClassIDSvc           INFO  getRegistryEntries: read 51 CLIDRegistry entries for module ALL
-zzz 0xf0f0045L 2 0xf0f0045
+ClassIDSvc           INFO  getRegistryEntries: read 15 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #3, run #1 2 events processed so far  <<<===
-zzz 0xf0f0405L 2 0xf0f0405
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 3 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #4, run #1 3 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 4 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #5, run #1 4 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #5, run #1 5 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #6, run #1 5 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #6, run #1 6 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #7, run #1 6 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #7, run #1 7 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #8, run #1 7 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #8, run #1 8 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #9, run #1 8 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #9, run #1 9 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #10, run #1 9 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #10, run #1 10 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #11, run #1 10 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #11, run #1 11 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #12, run #1 11 events processed so far  <<<===
-zzz 0xf0f0005L 2 0xf0f0005
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #12, run #1 12 events processed so far  <<<===
 TileInfoLoader       INFO Handling EndRun incident
 TileInfoLoader       INFO Removed TileInfo object from detector store.
@@ -504,27 +485,28 @@ Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All]
 ApplicationMgr       INFO Application Manager Stopped successfully
 IncidentProcAlg1     INFO Finalize
 CondInputLoader      INFO Finalizing CondInputLoader...
+prepalg1             INFO Finalizing prepalg1...
 testalg1             INFO Finalizing testalg1...
 IncidentProcAlg2     INFO Finalize
 PyComponentMgr       INFO Finalizing PyComponentMgr...
 IdDictDetDescrCnv    INFO in finalize
-IOVDbFolder          INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.60 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CES (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/103344 ((     0.66 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.56 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.56 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/EMS (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/92 ((     0.50 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/FIBER (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/940 ((     0.57 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/72 ((     1.04 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.65 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/NOISE/SAMPLE (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/641476 ((     0.85 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/97884 ((     0.04 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/TIME/CHANNELOFFSET/PHY (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/96 ((     0.04 ))s
-IOVDbFolder          INFO Folder /TILE/ONL01/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.02 ))s
-IOVDbFolder          INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.44 ))s
-IOVDbSvc             INFO  bytes in ((      6.52 ))s
+IOVDbFolder          INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.18 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CES (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/103344 ((     0.16 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.05 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.04 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/EMS (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/92 ((     0.03 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/FIBER (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/940 ((     0.04 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/72 ((     0.03 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.04 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/NOISE/SAMPLE (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/641476 ((     0.13 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/97884 ((     0.83 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/TIME/CHANNELOFFSET/PHY (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/96 ((     0.59 ))s
+IOVDbFolder          INFO Folder /TILE/ONL01/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.06 ))s
+IOVDbFolder          INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.03 ))s
+IOVDbSvc             INFO  bytes in ((      2.21 ))s
 IOVDbSvc             INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: ((     0.00 ))s
-IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     1.03 ))s
-IOVDbSvc             INFO Connection COOLOFL_TILE/OFLP200 : nConnect: 2 nFolders: 11 ReadTime: ((     5.48 ))s
+IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.21 ))s
+IOVDbSvc             INFO Connection COOLOFL_TILE/OFLP200 : nConnect: 2 nFolders: 11 ReadTime: ((     2.00 ))s
 TileInfoLoader       INFO TileInfoLoader::finalize()
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
@@ -535,17 +517,14 @@ ToolSvc.tool8        INFO Finalizing
 ToolSvc.tool7        INFO Finalizing
 ToolSvc.tool6        INFO Finalizing
 ToolSvc.tool5        INFO Finalizing
-ToolSvc.tool4        INFO Finalizing
 ToolSvc.tool2        INFO Finalizing
 ToolSvc.tool1        INFO Finalizing
-ToolSvc.beaminfo4    INFO Finalizing
-ToolSvc.TileBea...   INFO Finalizing
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot= 0.82  [s] Ave/Min/Max= 0.41(+- 0.39)/ 0.02/  0.8  [s] #=  2
-cObj_ALL             INFO Time User   : Tot= 1.09  [s] Ave/Min/Max=0.0838(+-0.243)/    0/ 0.91  [s] #= 13
-ChronoStatSvc        INFO Time User   : Tot=   66  [s]                                             #=  1
+cObjR_ALL            INFO Time User   : Tot=  470 [ms] Ave/Min/Max=  235(+-  235)/    0/  470 [ms] #=  2
+cObj_ALL             INFO Time User   : Tot= 0.57  [s] Ave/Min/Max=0.0438(+-0.136)/    0/ 0.51  [s] #= 13
+ChronoStatSvc        INFO Time User   : Tot= 46.6  [s]                                             #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.py b/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.py
index 2a539f98a8c..b3e1e0fbf13 100644
--- a/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.py
+++ b/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.py
@@ -146,7 +146,7 @@ def exp_merge (base, d):
     return new
 
 
-# TileBeamInfoProvider errors
+# TileDQstatus errors
 exp_chans_1 = exp_merge (exp_chans_0, {
     (3, 1, 18, 13, 3, 0) : [  4.4, -26.5, 23.9,  70051.2],
     (3, 1, 18, 15, 3, 0) : [ -0.1, -75.0,  3.7,  70051.0],
@@ -193,6 +193,88 @@ class TileFragHash:
 
 
 from AthenaPython.PyAthenaComps import Alg, StatusCode
+#########################################################################
+
+
+class PrepareDataAlg (Alg):
+    def __init__ (self, name):
+        Alg.__init__ (self, name)
+        return
+
+
+    def initialize (self):
+        return StatusCode.Success
+
+
+    def execute (self):
+        iev = self.getContext().evt()
+
+        if iev == 1:
+            baddq = {146: (2, 10)}
+            rc = self.make_bad_rc (baddq)
+        elif iev == 3:
+            rc = self.make_rc (digits_0)
+        else:
+            rc = self.make_rc ({})
+
+        self.evtStore.record (rc, 'TRCDQ', False)
+
+        return StatusCode.Success
+
+            
+    def make_rc (self, digits):
+        idHelper  = self.detStore['CaloCell_ID'].tile_idHelper()
+
+        unit = 0 # TileRawChannelUnit::ADCcounts
+        typ = TileFragHash.Default
+        cont = ROOT.TileRawChannelContainer (False, typ, unit)
+        hashFunc = cont.hashFunc()
+
+        digits = dict (digits)
+        for icoll in range(256):
+            colldata = digits.get (icoll, [])
+
+            coll = self.make_rc_coll (idHelper, hashFunc, icoll, colldata)
+            cont.addCollection (coll, ROOT.IdentifierHash(icoll))
+            ROOT.SetOwnership (coll, False)
+
+        return cont
+
+
+    def make_rc_coll (self, idHelper, hashFunc, icoll, colldata):
+        coll = ROOT.TileRawChannelCollection (hashFunc.identifier(icoll))
+
+        for addr, data in colldata:
+            if type(addr) == type(()):
+                adc_id = idHelper.adc_id (*addr)
+                chan = ROOT.TileRawChannel (adc_id, *data)
+            else:
+                hwid = ROOT.HWIdentifier (addr)
+                chan = ROOT.TileRawChannel (hwid, *data)
+            chan.setPedestal (0)
+            coll.push_back (chan)
+
+        return coll
+
+
+    def make_bad_rc (self, baddq):
+        cont = ROOT.TileRawChannelContainer (False, TileFragHash.OptFilterDsp, 0)
+        hashFunc = cont.hashFunc()
+        for icoll, chans in baddq.items():
+            coll = ROOT.TileRawChannelCollection (hashFunc.identifier (icoll))
+            mask = 0
+            for chan in chans:
+                mask |= (1<<(chan/3))
+            coll.setFragMemoryPar(mask)
+            cont.addCollection (coll, ROOT.IdentifierHash(icoll))
+            ROOT.SetOwnership (coll, False)
+        return cont
+
+
+
+#########################################################################
+
+
 class TestAlg (Alg):
     def __init__ (self, name):
         Alg.__init__ (self, name)
@@ -209,15 +291,6 @@ class TestAlg (Alg):
 
         self.tool1 = gettool ('tool1')
         self.tool2 = gettool ('tool2')
-        self.tool3 = gettool ('tool3')
-        self.tool4 = gettool ('tool4')
-
-        self.beaminfo2 = ROOT.ToolHandle(ROOT.TileBeamInfoProvider)('TileBeamInfoProvider/beaminfo2')
-        if not self.beaminfo2.retrieve():
-            return StatusCode.Failure
-        self.beaminfo4 = ROOT.ToolHandle(ROOT.TileBeamInfoProvider)('TileBeamInfoProvider/beaminfo4')
-        if not self.beaminfo4.retrieve():
-            return StatusCode.Failure
 
         return StatusCode.Success
 
@@ -230,6 +303,9 @@ class TestAlg (Alg):
     def execute (self):
         iev = self.getContext().evt()
 
+        if iev == 3:
+            return StatusCode.Success
+
         dspcolls = set()
 
         tool = self.tool1
@@ -240,29 +316,17 @@ class TestAlg (Alg):
             pass
 
         elif iev == 1:
-            # Event 1: BeamInfoProvider bad channels
-            tool = self.tool2
+            # Event 1: DQstatus bad channels
             exp_chans = exp_chans_1
 
-            baddq = {146: (2, 10)}
-            rc = self.make_bad_rc (baddq)
-            self.beaminfo2.setContainers (None,
-                                          rc,
-                                          None)
-
         elif iev == 2:
             # Event 2: noise filter
-            tool = self.tool3
+            tool = self.tool2
             exp_chans = exp_chans_2
 
         else:
             # Event 3: noise filter + dsp
-            tool = self.tool4
             exp_chans = exp_chans_3
-            rc = self.make_rc (digits_0)
-            self.beaminfo4.setContainers (None,
-                                          rc,
-                                          None)
 
         digits = self.make_digits (digits_0)
 
@@ -322,56 +386,6 @@ class TestAlg (Alg):
         return coll
 
 
-    def make_rc (self, digits):
-        idHelper  = self.detStore['CaloCell_ID'].tile_idHelper()
-
-        unit = 0 # TileRawChannelUnit::ADCcounts
-        typ = TileFragHash.Default
-        cont = ROOT.TileRawChannelContainer (False, typ, unit)
-        hashFunc = cont.hashFunc()
-
-        digits = dict (digits)
-        for icoll in range(256):
-            colldata = digits.get (icoll, [])
-
-            coll = self.make_rc_coll (idHelper, hashFunc, icoll, colldata)
-            cont.addCollection (coll, ROOT.IdentifierHash(icoll))
-            ROOT.SetOwnership (coll, False)
-
-        return cont
-
-
-    def make_rc_coll (self, idHelper, hashFunc, icoll, colldata):
-        coll = ROOT.TileRawChannelCollection (hashFunc.identifier(icoll))
-
-        for addr, data in colldata:
-            if type(addr) == type(()):
-                adc_id = idHelper.adc_id (*addr)
-                chan = ROOT.TileRawChannel (adc_id, *data)
-            else:
-                hwid = ROOT.HWIdentifier (addr)
-                chan = ROOT.TileRawChannel (hwid, *data)
-            chan.setPedestal (0)
-            coll.push_back (chan)
-
-        return coll
-
-
-    def make_bad_rc (self, baddq):
-        cont = ROOT.TileRawChannelContainer (False, TileFragHash.OptFilterDsp, 0)
-        hashFunc = cont.hashFunc()
-        for icoll, chans in baddq.items():
-            coll = ROOT.TileRawChannelCollection (hashFunc.identifier (icoll))
-            mask = 0
-            for chan in chans:
-                mask |= (1<<(chan/3))
-            coll.setFragMemoryPar(mask)
-            cont.addCollection (coll, ROOT.IdentifierHash(icoll))
-            ROOT.SetOwnership (coll, False)
-        return cont
-
-
-
     def compare_chans (self, chans, exp_chans):
         assert chans.get_type() == 0
         assert chans.get_unit() == 0
@@ -422,22 +436,22 @@ class TestAlg (Alg):
 
 
 from TileRecUtils.TileRecUtilsConf import \
-    TileRawChannelBuilderTest, TileBeamInfoProvider, TileRawChannelNoiseFilter
-beaminfo2 = TileBeamInfoProvider ('beaminfo2')
-ToolSvc += beaminfo2
-beaminfo4 = TileBeamInfoProvider ('beaminfo4')
-ToolSvc += beaminfo4
+    TileRawChannelBuilderTest, TileRawChannelNoiseFilter, \
+    TileDQstatusAlg
 noisefilter = TileRawChannelNoiseFilter ('noisefilter')
 
 ToolSvc += TileRawChannelBuilderTest ('tool1')
-ToolSvc += TileRawChannelBuilderTest ('tool2', BeamInfo = beaminfo2)
-ToolSvc += TileRawChannelBuilderTest ('tool3', NoiseFilterTools = [noisefilter])
-ToolSvc += TileRawChannelBuilderTest ('tool4', NoiseFilterTools = [noisefilter],
-                                      BeamInfo = beaminfo4)
+ToolSvc += TileRawChannelBuilderTest ('tool2', NoiseFilterTools = [noisefilter])
 
 from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg
 topSequence += xAODMaker__EventInfoCnvAlg (DoBeginRun = False)
 
+prepalg1 = PrepareDataAlg ('prepalg1')
+topSequence += prepalg1
+
+dqstat1 = TileDQstatusAlg ('dqstat1', TileRawChannelContainer = 'TRCDQ')
+topSequence += dqstat1
+
 testalg1 = TestAlg ('testalg1')
 topSequence += testalg1
 
diff --git a/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.ref b/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.ref
index 2b1203680da..43a1b469be9 100644
--- a/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.ref
+++ b/TileCalorimeter/TileRecUtils/share/TileRawChannelBuilder_test.ref
@@ -1,14 +1,14 @@
-Mon Dec 17 01:46:59 CET 2018
+Thu Jan  3 16:25:19 CET 2019
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.1] [x86_64-slc6-gcc62-dbg] [atlas-work3/d6d3116653c] -- built on [2018-12-16T1848]
+Py:Athena            INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3g/be87ec46e65] -- built on [2019-01-03T1609]
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "TileRecUtils/TileRawChannelBuilder_test.py"
 [?1034hSetGeometryVersion.py obtained major release version 22
 Py:Athena            INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py"
-Py:ConfigurableDb    INFO Read module info for 5459 configurables from 51 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5435 configurables from 6 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 EventInfoMgtInit: Got release version  Athena-22.0.1
 Py:IOVDbSvc.CondDB    INFO Setting up conditions DB access to instance OFLP200
@@ -28,7 +28,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
                                                    Welcome to ApplicationMgr (GaudiCoreSvc v30r5)
-                                          running on lxplus073.cern.ch on Mon Dec 17 01:47:20 2018
+                                          running on lxplus064.cern.ch on Thu Jan  3 16:25:37 2019
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -36,7 +36,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 6864 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 6912 CLIDRegistry entries for module ALL
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
 MetaDataSvc          INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
@@ -45,8 +45,8 @@ PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.x
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
 DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
-DBReplicaSvc         INFO Total of 10 servers found for host lxplus073.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus064.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc              INFO Setting up APR FileCatalog and Streams
 PoolSvc           WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml check your ATLAS_POOLCOND_PATH and DATAPATH variables
@@ -83,7 +83,7 @@ IOVDbSvc             INFO Added taginfo remove for /TILE/OFL02/STATUS/ADC
 IOVDbSvc             INFO Added taginfo remove for /TILE/OFL02/TIME/CHANNELOFFSET/PHY
 IOVDbSvc             INFO Added taginfo remove for /TILE/ONL01/STATUS/ADC
 IOVDbSvc             INFO Added taginfo remove for /LAR/LArCellPositionShift
-ClassIDSvc           INFO  getRegistryEntries: read 1919 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1871 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO  getRegistryEntries: read 17 CLIDRegistry entries for module ALL
 DetDescrCnvSvc       INFO  initializing 
 DetDescrCnvSvc       INFO Found DetectorStore service
@@ -172,7 +172,7 @@ EndcapDMConstru...   INFO Start building EC electronics geometry
   multi-layered version of absorbers activated, mlabs == 1
 ================================================
 EndcapDMConstru...   INFO Start building EC electronics geometry
-GeoModelSvc          INFO GeoModelSvc.LArDetectorToolNV	 SZ= 28576Kb 	 Time = 1.51S
+GeoModelSvc          INFO GeoModelSvc.LArDetectorToolNV	 SZ= 22940Kb 	 Time = 0.66S
 GeoModelSvc.Til...   INFO  Entering TileDetectorTool::create()
 TileDddbManager      INFO m_tag = ATLAS-R2-2016-01-00-01
 TileDddbManager      INFO n_tiglob = 5
@@ -184,7 +184,7 @@ TileDddbManager      INFO n_tileSwitches = 1
 ClassIDSvc           INFO  getRegistryEntries: read 213 CLIDRegistry entries for module ALL
 CaloIDHelper_ID...   INFO in createObj: creating a TileID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/TileNeighbour_reduced.txt
+TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileNeighbour_reduced.txt
 TileHWIDDetDesc...   INFO in createObj: creating a TileHWID helper object in the detector store
 TileHWID             INFO initialize_from_dictionary 
 AtlasDetectorID      INFO initialize_from_dictionary - OK
@@ -196,9 +196,9 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_ID helper object in th
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal2DNeighbors-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal3DNeighborsNext-April2011.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCal3DNeighborsPrev-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal2DNeighbors-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsNext-April2011.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCal3DNeighborsPrev-April2011.txt
 CaloIDHelper_ID...   INFO in createObj: creating a LArMiniFCAL_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 LArMiniFCAL_ID       INFO  initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.
@@ -233,7 +233,7 @@ GeoModelSvc.Til...   INFO  Global positioning of barrel with rotation (0,0,0)) a
 GeoModelSvc.Til...   INFO  Global positioning of positive ext.barrel with rotation (0,0,0)) and translation (0,0,0) GeoModelKernelUnits::cm
 GeoModelSvc.Til...   INFO  Global positioning of negative ext.barrel with rotation (0,0,0)) and translation (0,0,1) GeoModelKernelUnits::cm
 TileDetDescrMan...   INFO Entering create_elements()
-GeoModelSvc          INFO GeoModelSvc.TileDetectorTool	 SZ= 5196Kb 	 Time = 1.64S
+GeoModelSvc          INFO GeoModelSvc.TileDetectorTool	 SZ= 3568Kb 	 Time = 0.2S
 ClassIDSvc           INFO  getRegistryEntries: read 65 CLIDRegistry entries for module ALL
 TileInfoLoader       INFO Initializing....TileInfoLoader
 TileInfoLoader       INFO New ATLAS geometry detected: ATLAS-R2-2016-01-00-01 (010001) version 10001
@@ -255,11 +255,11 @@ TileInfoLoader       INFO Sampling fraction for E2 cells 1/107
 TileInfoLoader       INFO Sampling fraction for E3 cells 1/97
 TileInfoLoader       INFO Sampling fraction for E4 cells 1/75
 TileInfoLoader       INFO Sampling fraction for E4' cells 1/75
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulsehi_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulselo_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_tower_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_muonRcv_physics.dat
-TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-15T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-dbg/share/pulse_adder_muon_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulsehi_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulselo_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_tower_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_muonRcv_physics.dat
+TileInfoLoader       INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/pulse_adder_muon_physics.dat
 CaloIDHelper_ID...   INFO in createObj: creating a CaloLVL1_ID helper object in the detector store
 CaloLVL1_ID          INFO initialize_from_dictionary
 AtlasDetectorID      INFO initialize_from_dictionary - OK
@@ -313,28 +313,22 @@ TileEMScaleCond...   INFO Creating TileCondProxyCool(TileEMScaleCondAlg.TileCond
 TileSampleNoise...   INFO Creating TileCondProxyCool(TileSampleNoiseCondAlg.TileCondProxyCool_NoiseSample) for folder: "/TILE/OFL02/NOISE/SAMPLE"
 TileTimingCondA...   INFO Creating TileCondProxyCool(TileTimingCondAlg.TileCondProxyCool_AdcOffset) for folder: "/TILE/OFL02/TIME/CHANNELOFFSET/PHY"
 ClassIDSvc           INFO  getRegistryEntries: read 504 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 4846 CLIDRegistry entries for module ALL
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...   INFO Initializing - Package version: xAODEventInfoCnv-00-00-00
 xAODMaker::Even...WARNING Beam conditions service not available
 xAODMaker::Even...WARNING Will not fill beam spot information into xAOD::EventInfo
 xAODMaker::Even...   INFO Luminosity information not available
 xAODMaker::Even...   INFO Will take information from the EventInfo object
-ClassIDSvc           INFO  getRegistryEntries: read 319 CLIDRegistry entries for module ALL
 PyComponentMgr       INFO Initializing PyComponentMgr...
+prepalg1             INFO Initializing prepalg1...
 testalg1             INFO Initializing testalg1...
-ClassIDSvc           INFO  getRegistryEntries: read 5073 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 532 CLIDRegistry entries for module ALL
 ToolSvc.tool1        INFO TileRawChannelBuilder::initialize()
-ToolSvc.TileBea...   INFO in initialize()
 ToolSvc.tool2        INFO TileRawChannelBuilder::initialize()
-ToolSvc.beaminfo2    INFO in initialize()
-ToolSvc.tool3        INFO TileRawChannelBuilder::initialize()
-ToolSvc.tool3.n...   INFO Initializing...
-ToolSvc.tool4        INFO TileRawChannelBuilder::initialize()
-ToolSvc.beaminfo4    INFO in initialize()
-ToolSvc.tool4.n...   INFO Initializing...
+ToolSvc.tool2.n...   INFO Initializing...
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
-ClassIDSvc           INFO  getRegistryEntries: read 147 CLIDRegistry entries for module ALL
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CES'
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CIS/FIT/LIN'
 CondInputLoader      INFO created CondCont<CondAttrListCollection> with key 'ConditionStore+/TILE/OFL02/CALIB/CIS/FIT/NLN'
@@ -374,12 +368,12 @@ CaloIDHelper_ID...   INFO in createObj: creating a LArHEC_SuperCell_ID helper ob
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIDHelper_ID...   INFO in createObj: creating a LArFCAL_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells2DNeighborsNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
-LArFCAL_Base_ID      INFO Reading file /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells2DNeighborsNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsNextNew-April2014.txt
+LArFCAL_Base_ID      INFO Reading file /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/FCalSuperCells3DNeighborsPrevNew-April2014.txt
 CaloIDHelper_ID...   INFO in createObj: creating a Tile_SuperCell_ID helper object in the detector store
 AtlasDetectorID      INFO initialize_from_dictionary - OK
-TileNeighbour        INFO Reading file  /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-dbg/x86_64-slc6-gcc62-dbg/share/TileSuperCellNeighbour.txt
+TileNeighbour        INFO Reading file  /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2019-01-02T2256/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/TileSuperCellNeighbour.txt
 AtlasDetectorID      INFO initialize_from_dictionary - OK
 CaloIdMgrDetDes...   INFO  Finished 
 CaloIdMgrDetDes...   INFO Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv 
@@ -410,63 +404,57 @@ TileBadChannels...   INFO TileBchStatus::isNoGainL1() is defined by: ADC dead; N
 TileBadChannels...   INFO TileBchStatus::isBadTiming() is defined by: Bad timing; Online bad timing; 
 TileBadChannels...   INFO No drawer trips probabilities found in DB
 ClassIDSvc           INFO  getRegistryEntries: read 650 CLIDRegistry entries for module ALL
-ClassIDSvc           INFO  getRegistryEntries: read 67 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 154 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #3, run #1 2 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #3, run #1 3 events processed so far  <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #4, run #1 3 events processed so far  <<<===
-ToolSvc.beaminfo4    INFO RawChannelContainer didn't come from BS - don't check DQ flags
-ToolSvc.beaminfo4    INFO RChType = 0
 AthenaEventLoopMgr   INFO   ===>>>  done processing event #4, run #1 4 events processed so far  <<<===
 TileInfoLoader       INFO Handling EndRun incident
 TileInfoLoader       INFO Removed TileInfo object from detector store.
 /cvmfs/atlas-co...   INFO Database being retired...
-Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 8667C6F2-1559-DE11-A611-000423D9A21A
-/cvmfs/atlas-co...   INFO Database being retired...
 Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] EACFEBD4-9BD2-E211-848A-02163E006B20
+/cvmfs/atlas-co...   INFO Database being retired...
+Domain[ROOT_All]     INFO ->  Deaccess DbDatabase   READ      [ROOT_All] 8667C6F2-1559-DE11-A611-000423D9A21A
 Domain[ROOT_All]     INFO >   Deaccess DbDomain     READ      [ROOT_All] 
 ApplicationMgr       INFO Application Manager Stopped successfully
 IncidentProcAlg1     INFO Finalize
 CondInputLoader      INFO Finalizing CondInputLoader...
+prepalg1             INFO Finalizing prepalg1...
 testalg1             INFO Finalizing testalg1...
 IncidentProcAlg2     INFO Finalize
 PyComponentMgr       INFO Finalizing PyComponentMgr...
 IdDictDetDescrCnv    INFO in finalize
-IOVDbFolder          INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.46 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CES (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/103344 ((     2.26 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.83 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.64 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/EMS (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/92 ((     0.60 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/FIBER (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/940 ((     0.67 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/72 ((     0.59 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.61 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/NOISE/SAMPLE (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/641476 ((     0.70 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/97884 ((     0.74 ))s
-IOVDbFolder          INFO Folder /TILE/OFL02/TIME/CHANNELOFFSET/PHY (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/96 ((     0.79 ))s
-IOVDbFolder          INFO Folder /TILE/ONL01/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.07 ))s
-IOVDbFolder          INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.35 ))s
-IOVDbSvc             INFO  bytes in ((      9.32 ))s
+IOVDbFolder          INFO Folder /LAR/Align (PoolRef) db-read 1/1 objs/chan/bytes 1/1/170 ((     0.04 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CES (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/103344 ((     0.03 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.02 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/CIS/FIT/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/80 ((     0.03 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/EMS (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/92 ((     0.02 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/FIBER (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/940 ((     0.02 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/LIN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/72 ((     0.03 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/CALIB/LAS/NLN (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.02 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/NOISE/SAMPLE (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/641476 ((     0.13 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/97884 ((     0.79 ))s
+IOVDbFolder          INFO Folder /TILE/OFL02/TIME/CHANNELOFFSET/PHY (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/96 ((     0.88 ))s
+IOVDbFolder          INFO Folder /TILE/ONL01/STATUS/ADC (AttrListColl) db-read 1/1 objs/chan/bytes 277/277/76 ((     0.06 ))s
+IOVDbFolder          INFO Folder /LAR/LArCellPositionShift (PoolRef) db-read 1/1 objs/chan/bytes 1/1/195 ((     0.02 ))s
+IOVDbSvc             INFO  bytes in ((      2.10 ))s
 IOVDbSvc             INFO Connection sqlite://;schema=mycool.db;dbname=OFLP200 : nConnect: 0 nFolders: 0 ReadTime: ((     0.00 ))s
-IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.81 ))s
-IOVDbSvc             INFO Connection COOLOFL_TILE/OFLP200 : nConnect: 2 nFolders: 11 ReadTime: ((     8.51 ))s
+IOVDbSvc             INFO Connection COOLOFL_LAR/OFLP200 : nConnect: 2 nFolders: 2 ReadTime: ((     0.07 ))s
+IOVDbSvc             INFO Connection COOLOFL_TILE/OFLP200 : nConnect: 2 nFolders: 11 ReadTime: ((     2.03 ))s
 TileInfoLoader       INFO TileInfoLoader::finalize()
 AthDictLoaderSvc     INFO in finalize...
 ToolSvc              INFO Removing all tools created by ToolSvc
-ToolSvc.tool4        INFO Finalizing
-ToolSvc.tool3        INFO Finalizing
 ToolSvc.tool2        INFO Finalizing
 ToolSvc.tool1        INFO Finalizing
-ToolSvc.beaminfo4    INFO Finalizing
-ToolSvc.beaminfo2    INFO Finalizing
-ToolSvc.TileBea...   INFO Finalizing
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-cObjR_ALL            INFO Time User   : Tot= 0.74  [s] Ave/Min/Max= 0.37(+- 0.35)/ 0.02/ 0.72  [s] #=  2
-cObj_ALL             INFO Time User   : Tot= 0.98  [s] Ave/Min/Max=0.0754(+-0.217)/    0/ 0.81  [s] #= 13
-ChronoStatSvc        INFO Time User   : Tot= 66.1  [s]                                             #=  1
+cObjR_ALL            INFO Time User   : Tot=  430 [ms] Ave/Min/Max=  215(+-  205)/   10/  420 [ms] #=  2
+cObj_ALL             INFO Time User   : Tot= 0.55  [s] Ave/Min/Max=0.0423(+-0.123)/    0/ 0.46  [s] #= 13
+ChronoStatSvc        INFO Time User   : Tot= 46.1  [s]                                             #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx b/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
index 74333df6512..ce788cf8b64 100644
--- a/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileCellBuilder.cxx
@@ -7,11 +7,11 @@
 // Tile includes
 #include "TileRecUtils/TileCellBuilder.h"
 #include "TileRecUtils/TileRawChannelBuilder.h"
-#include "TileRecUtils/TileBeamInfoProvider.h"
 #include "TileEvent/TileMutableRawChannelContainer.h"
 #include "TileEvent/TileCell.h"
 #include "TileEvent/TileCellCollection.h"
 #include "TileEvent/TileRawChannel.h"
+#include "TileEvent/TileDQstatus.h"
 #include "CaloIdentifier/TileID.h"
 #include "CaloIdentifier/TileTBID.h"
 #include "TileIdentifier/TileHWID.h"
@@ -67,7 +67,7 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   , m_tileHWID(0)
   , m_cabling(0)
   , m_DQstatus(0)
-  , m_beamInfo("TileBeamInfoProvider/TileBeamInfoProvider")
+  , m_tileDCS("TileDCSTool")
   , m_tileMgr(0)
   , m_mbtsMgr(0)
   , m_RChType(TileFragHash::Default)
@@ -94,8 +94,6 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   //!< MBTS channel energy threshold for masking (not used currently(
   m_minEneChan[2] = -999999. * MeV;
 
-  declareProperty("BeamInfo", m_beamInfo);
-
   declareProperty( "MinEnergyChan", m_minEneChan[0]);
   declareProperty( "MinEnergyGap",  m_minEneChan[1]);
   declareProperty( "MinEnergyMBTS", m_minEneChan[2]);
@@ -150,6 +148,9 @@ TileCellBuilder::TileCellBuilder(const std::string& type, const std::string& nam
   declareProperty("SkipGain", m_skipGain = -1); // never skip any gain by default
 
   declareProperty("UseDemoCabling", m_useDemoCabling = 0); // if set to 2015 - assume TB 2015 cabling
+
+  declareProperty("TileDCSTool", m_tileDCS); // FIXME
+  declareProperty("CheckDCS", m_checkDCS = false);
 }
 
 /**
@@ -178,6 +179,7 @@ StatusCode TileCellBuilder::initialize() {
   }
 
   ATH_CHECK( m_eventInfoKey.initialize() );
+  ATH_CHECK( m_DQstatusKey.initialize() );
 
   ATH_CHECK( detStore()->retrieve(m_tileMgr) );
   ATH_CHECK( detStore()->retrieve(m_tileID) );
@@ -187,9 +189,6 @@ StatusCode TileCellBuilder::initialize() {
   //=== get TileBadChanTool
   ATH_CHECK( m_tileBadChanTool.retrieve() );
 
-  //=== get TileBeamInfo
-  ATH_CHECK( m_beamInfo.retrieve() );
-
   // access tools and store them
   ATH_CHECK( m_noiseFilterTools.retrieve() );
 
@@ -199,6 +198,13 @@ StatusCode TileCellBuilder::initialize() {
   //=== get TileCondToolTiming
   ATH_CHECK( m_tileToolTiming.retrieve() );
 
+  if (m_checkDCS) {
+    CHECK( m_tileDCS.retrieve() );
+  }
+  else {
+    m_tileDCS.disable();
+  }
+
   m_cabling = TileCablingService::getInstance();
 
   reset(true, false);
@@ -287,6 +293,7 @@ StatusCode TileCellBuilder::finalize() {
 }
 
 StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
+  const EventContext& ctx = Gaudi::Hive::currentContext();
 
   //**
   //* Get TileRawChannels
@@ -468,7 +475,7 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
                       << " offline vector size = " << oflVec.size()
                       << ", dsp vector size = " << dspVec.size() );
 
-        build(vecBeg, vecEnd, theCellContainer);
+        build(ctx, vecBeg, vecEnd, theCellContainer);
         begin = end;
       }
 
@@ -496,7 +503,7 @@ StatusCode TileCellBuilder::process(CaloCellContainer * theCellContainer) {
       }
       
       ATH_MSG_DEBUG( " Calling build() method for rawChannels from " << m_rawChannelContainerKey.key() );
-      build(begin, end, theCellContainer);
+      build(ctx, begin, end, theCellContainer);
     }
     
     if (!m_MBTSContainerKey.key().empty()) {
@@ -740,7 +747,7 @@ bool TileCellBuilder::maskBadChannel(TileCell* pCell, HWIdentifier hwid) {
     // Now checking the DQ status
     if (!bad && m_notUpgradeCabling) {
       bad = !(m_DQstatus->isAdcDQgood(ros, drawer, chan, gain)
-            && m_beamInfo->isChanDCSgood(ros, drawer, chan));
+            && isChanDCSgood(ros, drawer, chan));
     }
   }
 
@@ -804,7 +811,7 @@ bool TileCellBuilder::maskBadChannels(TileCell* pCell) {
     // Now checking the DQ status
     if (!bad1 && m_notUpgradeCabling) {
       bad1 = !(m_DQstatus->isAdcDQgood(ros1, drawer1, chan1, gain1)
-              && m_beamInfo->isChanDCSgood(ros1, drawer1, chan1));
+              && isChanDCSgood(ros1, drawer1, chan1));
     }
   }
 
@@ -856,7 +863,7 @@ bool TileCellBuilder::maskBadChannels(TileCell* pCell) {
       // Now checking the DQ status
       if (!bad2 && m_notUpgradeCabling) {
         bad2 = !(m_DQstatus->isAdcDQgood(ros2, drawer2, chan2, gain2)
-                && m_beamInfo->isChanDCSgood(ros2, drawer2, chan2));
+                && isChanDCSgood(ros2, drawer2, chan2));
       }
     }
 
@@ -1001,10 +1008,12 @@ bool TileCellBuilder::maskBadChannels(TileCell* pCell) {
 
 
 template<class ITERATOR, class COLLECTION>
-void TileCellBuilder::build(const ITERATOR & begin, const ITERATOR & end, COLLECTION * coll) {
+void TileCellBuilder::build(const EventContext& ctx,
+                            const ITERATOR & begin, const ITERATOR & end, COLLECTION * coll) {
 
-  // Now retrieve the TileDQStatus
-  if(m_notUpgradeCabling) m_DQstatus = m_beamInfo->getDQstatus();
+  if(m_notUpgradeCabling) {
+    m_DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
+  }
 
   /* zero all counters and sums */
   int nTwo = 0;
@@ -1417,3 +1426,19 @@ void TileCellBuilder::build(const ITERATOR & begin, const ITERATOR & end, COLLEC
     msg(MSG::DEBUG) << endmsg;
   }
 }
+
+
+bool TileCellBuilder::isChanDCSgood (int ros, int drawer, int channel) const
+{
+  if (!m_checkDCS) return true;
+  TileDCSState::TileDCSStatus status = m_tileDCS->getDCSStatus(ros, drawer, channel);
+
+  if (status > TileDCSState::WARNING) {
+    ATH_MSG_DEBUG("Module=" << TileCalibUtils::getDrawerString(ros, drawer)
+                  << " channel=" << channel
+                  << " masking becasue of bad DCS status=" << status);
+    return false;
+  }
+
+  return true;
+}
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
index 93a5188eda4..ed64393ac8e 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelBuilder.cxx
@@ -1,10 +1,9 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 // Tile includes
 #include "TileRecUtils/TileRawChannelBuilder.h"
-#include "TileRecUtils/TileBeamInfoProvider.h"
 #include "TileEvent/TileDigits.h"
 #include "TileEvent/TileRawChannel.h"
 #include "TileIdentifier/TileHWID.h"
@@ -17,6 +16,7 @@
 #include "AthAllocators/DataPool.h"
 
 // Gaudi includes
+#include "GaudiKernel/ThreadLocalContext.h"
 
 
 static const InterfaceID IID_ITileRawChannelBuilder("TileRawChannelBuilder", 1, 0);
@@ -60,7 +60,6 @@ TileRawChannelBuilder::TileRawChannelBuilder(const std::string& type
   , m_tileID(nullptr)
   , m_tileHWID(nullptr)
   , m_tileInfo(nullptr)
-  , m_beamInfo("TileBeamInfoProvider/TileBeamInfoProvider")
   , m_trigType(0)
   , m_idophys(false)
   , m_idolas(false)
@@ -86,7 +85,6 @@ TileRawChannelBuilder::TileRawChannelBuilder(const std::string& type
   declareProperty("TimeMinForAmpCorrection", m_timeMinThresh = -25.0);
   declareProperty("TimeMaxForAmpCorrection", m_timeMaxThresh =  25.0);
   declareProperty("RunType", m_runType = 0);
-  declareProperty("BeamInfo", m_beamInfo);
   declareProperty("DataPoolSize", m_dataPoollSize = -1);
   declareProperty("UseDSPCorrection", m_useDSP = true);
 
@@ -124,8 +122,6 @@ StatusCode TileRawChannelBuilder::initialize() {
 
   ATH_CHECK( detStore()->retrieve(m_tileInfo, "TileInfo") );
 
-  ATH_CHECK( m_beamInfo.retrieve() );
-
   // access tools and store them
   ATH_CHECK( m_noiseFilterTools.retrieve() );
   ATH_MSG_DEBUG( "Successfully retrieve  NoiseFilterTools: " << m_noiseFilterTools );
@@ -194,6 +190,14 @@ StatusCode TileRawChannelBuilder::initialize() {
   }
 
   ATH_CHECK( m_rawChannelContainerKey.initialize() );
+  ATH_CHECK( m_DQstatusKey.initialize() );
+
+  if (m_useDSP && !m_DSPContainerKey.key().empty()) {
+    ATH_CHECK( m_DSPContainerKey.initialize() );
+  }
+  else {
+    m_DSPContainerKey = "";
+  }
 
   return StatusCode::SUCCESS;
 }
@@ -218,18 +222,21 @@ StatusCode TileRawChannelBuilder::createContainer() {
 
 void TileRawChannelBuilder::initLog() {
 
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
+
   // update only if there is new event
-  if (m_evtCounter != m_beamInfo->eventCounter()) {
+  if (m_evtCounter != ctx.evt()) {
 
-    m_evtCounter = m_beamInfo->eventCounter();
+    m_evtCounter = ctx.evt();
     if (m_runType != 0) m_trigType = m_runType;
-    else m_trigType = m_beamInfo->trigType();
+    else m_trigType = DQstatus->trigType();
 
     if (0 == m_trigType) {
-      m_idophys = (m_beamInfo->calibMode() == 0);
+      m_idophys = (DQstatus->calibMode() == 0);
       m_idolas = false;
       m_idoped = false;
-      m_idocis = (m_beamInfo->calibMode() == 1);
+      m_idocis = (DQstatus->calibMode() == 1);
     } else {
       m_idophys = (m_trigType <= 1);
       m_idolas = ((m_trigType == 2) || (m_trigType == 3));
@@ -237,7 +244,7 @@ void TileRawChannelBuilder::initLog() {
       m_idocis = ((m_trigType == 8) || (m_trigType == 9));
     }
 
-    const unsigned int *cispar = m_beamInfo->cispar();
+    const unsigned int *cispar = DQstatus->cispar();
     if (0 == cispar[7]) { // if capdaq not set, it can't be CIS event
       if (m_idocis) { // cis flag was set incorrectly, change to ped
         m_idoped = true;
@@ -268,8 +275,10 @@ TileRawChannel* TileRawChannelBuilder::rawChannel(const TileDigits* digits) {
   return rawCh;
 }
 
-void TileRawChannelBuilder::fill_drawer_errors(const TileDigitsCollection* coll) {
-  const TileDQstatus* DQstatus = m_beamInfo->getDQstatus();
+void TileRawChannelBuilder::fill_drawer_errors(const EventContext& ctx,
+                                               const TileDigitsCollection* coll)
+{
+  const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
 
   int frag = coll->identify();
   int ros = (frag >> 8);
@@ -459,12 +468,14 @@ const char * TileRawChannelBuilder::BadPatternName(float ped) {
 }
 
     
-void TileRawChannelBuilder::build(const TileDigitsCollection* coll) {
+void TileRawChannelBuilder::build(const TileDigitsCollection* coll)
+{
+  const EventContext& ctx = Gaudi::Hive::currentContext();
   int frag = coll->identify();
 
   // make sure that error array is up-to-date
   if (frag != s_lastDrawer && m_notUpgradeCabling) {
-    fill_drawer_errors(coll);
+    fill_drawer_errors(ctx, coll);
   }
 
   // Iterate over all digits in this collection
@@ -503,17 +514,21 @@ void TileRawChannelBuilder::build(const TileDigitsCollection* coll) {
   }
 }
 
-StatusCode TileRawChannelBuilder::commitContainer() {
+StatusCode TileRawChannelBuilder::commitContainer()
+{
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
 
   ToolHandleArray<ITileRawChannelTool>::iterator itrTool = m_noiseFilterTools.begin();
   ToolHandleArray<ITileRawChannelTool>::iterator endTool = m_noiseFilterTools.end();
 
-  const TileRawChannelContainer * dspCnt = m_beamInfo->dspContainer();
-  std::unique_ptr<TileMutableRawChannelContainer> copiedDspCnt;
-
-  if ( m_useDSP && (m_beamInfo->incompleteDigits() || m_chCounter<12288) && dspCnt && itrTool!=endTool) {
+  if ( m_useDSP && !m_DSPContainerKey.key().empty() &&
+       (DQstatus->incompleteDigits() || m_chCounter<12288) && itrTool!=endTool )
+  {
+    const TileRawChannelContainer * dspCnt =
+      SG::makeHandle (m_DSPContainerKey, ctx).get();
     ATH_MSG_DEBUG( "Incomplete container - use noise filter corrections from DSP container" );
-    copiedDspCnt = std::make_unique<TileMutableRawChannelContainer> (*dspCnt);
+    auto copiedDspCnt = std::make_unique<TileMutableRawChannelContainer> (*dspCnt);
     ATH_CHECK( copiedDspCnt->status() );
     dspCnt = copiedDspCnt.get();
     for (;itrTool!=endTool;++itrTool){
diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
index 26b613e27a3..218f4a22673 100644
--- a/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
+++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelNoiseFilter.cxx
@@ -9,11 +9,11 @@
 #include "TileEvent/TileRawChannelContainer.h"
 #include "TileEvent/TileMutableRawChannelContainer.h"
 #include "TileCalibBlobObjs/TileCalibUtils.h"
-#include "TileRecUtils/TileBeamInfoProvider.h"
 
 // Atlas includes
 #include "AthenaKernel/errorcheck.h"
 #include "Identifier/Identifier.h"
+#include "GaudiKernel/ThreadLocalContext.h"
 
 
 //========================================================
@@ -22,13 +22,11 @@ TileRawChannelNoiseFilter::TileRawChannelNoiseFilter(const std::string& type,
     const std::string& name, const IInterface* parent)
     : base_class(type, name, parent)
     , m_tileHWID(0)
-    , m_beamInfo( "TileBeamInfoProvider/TileBeamInfoProvider")
     , m_truncationThresholdOnAbsEinSigma(3.0) // 3 sigma of ADC HF noise by default
     , m_minimumNumberOfTruncatedChannels(0.6) // at least 60% of channels should be below threshold
     , 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
 {
-  declareProperty("BeamInfo", m_beamInfo);
 
   declareProperty("TruncationThresholdOnAbsEinSigma", m_truncationThresholdOnAbsEinSigma);
   declareProperty("MinimumNumberOfTruncatedChannels", m_minimumNumberOfTruncatedChannels);
@@ -64,8 +62,7 @@ StatusCode TileRawChannelNoiseFilter::initialize() {
   //=== get TileBadChanTool
   ATH_CHECK( m_tileBadChanTool.retrieve() );
 
-  //=== get TileBeamInfo
-  ATH_CHECK( m_beamInfo.retrieve() );
+  ATH_CHECK( m_DQstatusKey.initialize() );
 
   return StatusCode::SUCCESS;
 }
@@ -75,6 +72,7 @@ StatusCode TileRawChannelNoiseFilter::initialize() {
 StatusCode
 TileRawChannelNoiseFilter::process (TileMutableRawChannelContainer& rchCont) const
 {
+  const EventContext& ctx = Gaudi::Hive::currentContext();
   ATH_MSG_DEBUG("in process()");
 
   TileRawChannelUnit::UNIT rChUnit = rchCont.get_unit();
@@ -95,8 +93,7 @@ TileRawChannelNoiseFilter::process (TileMutableRawChannelContainer& rchCont) con
   ATH_MSG_VERBOSE( "Units in container is " << units[rChUnit] );
 
   // Now retrieve the TileDQStatus
-  // FIXME: const violation
-  const TileDQstatus* DQstatus = m_beamInfo->getDQstatus();
+  const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
 
   for (IdentifierHash hash : rchCont.GetAllCurrentHashes()) {
     TileRawChannelCollection* coll = rchCont.indexFindPtr (hash);
-- 
GitLab