diff --git a/TileCalorimeter/TileRec/TileRec/TileAANtuple.h b/TileCalorimeter/TileRec/TileRec/TileAANtuple.h
index c1a42046713095f46cbf5e814e89478268412862..a6fe7a458143584ff04d717bf14045049c53d9e6 100755
--- a/TileCalorimeter/TileRec/TileRec/TileAANtuple.h
+++ b/TileCalorimeter/TileRec/TileRec/TileAANtuple.h
@@ -67,6 +67,7 @@
 #define N_SAMPLES 7
 #define N_RODS 65
 #define N_CISPAR 110
+#define N_TMDBCHANS 4 // 4 in EB and 7 in B
 
 class TTree;
 
@@ -105,11 +106,11 @@ class TileAANtuple : public AthAlgorithm {
   private:
 
     StatusCode storeRawChannels(std::string cntID
-		  	                        , float ene[N_ROS2][N_MODULES][N_CHANS]
-			                          , float time[N_ROS2][N_MODULES][N_CHANS]
-			                          , float chi2[N_ROS2][N_MODULES][N_CHANS]
-			                          , float ped[N_ROS2][N_MODULES][N_CHANS]
-			                          , bool fillAll);
+		  	        , float ene[N_ROS2][N_MODULES][N_CHANS]
+			        , float time[N_ROS2][N_MODULES][N_CHANS]
+			        , float chi2[N_ROS2][N_MODULES][N_CHANS]
+			        , float ped[N_ROS2][N_MODULES][N_CHANS]
+			        , bool fillAll);
                                
     StatusCode storeMFRawChannels(std::string cntID
                                   , float ene[N_ROS2][N_MODULES][N_CHANS][N_SAMPLES]
@@ -119,10 +120,14 @@ class TileAANtuple : public AthAlgorithm {
                                   , bool fillAll);
 
     StatusCode storeDigits(std::string cntID
-			                     , short sample[N_ROS2][N_MODULES][N_CHANS][N_SAMPLES]
-			                     , short gain[N_ROS2][N_MODULES][N_CHANS]
-		  	                   , bool fillAll);
-   
+			   , short sample[N_ROS2][N_MODULES][N_CHANS][N_SAMPLES]
+			   , short gain[N_ROS2][N_MODULES][N_CHANS]
+		  	   , bool fillAll);
+
+    StatusCode storeTMDBDecision();
+    StatusCode storeTMDBDigits();
+    StatusCode storeTMDBRawChannel();
+
     StatusCode storeBeamElements();
     StatusCode storeLaser();
     StatusCode storeDCS();
@@ -136,11 +141,13 @@ class TileAANtuple : public AthAlgorithm {
     void CISPAR_addBranch(void);
     void DIGI_addBranch(void);
     void DCS_addBranch(void);
+    void TMDB_addBranch(void);
 
     void TRIGGER_clearBranch(void);
     void LASER_clearBranch(void);
     void CISPAR_clearBranch(void);
     void DIGI_clearBranch(void);
+    void TMDB_clearBranch(void); 
 
     inline int digiChannel2PMT(int fragType, int chan) {
       return (abs(m_cabling->channel2hole(fragType, chan)) - 1);
@@ -250,7 +257,7 @@ class TileAANtuple : public AthAlgorithm {
     float m_ene[N_ROS2][N_MODULES][N_CHANS];
     float m_time[N_ROS2][N_MODULES][N_CHANS];
     float m_ped[N_ROS2][N_MODULES][N_CHANS];
-    float m_chi2[N_ROS2][N_MODULES][N_CHANS];
+    float m_chi2[N_ROS2][N_MODULES][N_CHANS]; 
 
     float m_eFit[N_ROS2][N_MODULES][N_CHANS];
     float m_tFit[N_ROS2][N_MODULES][N_CHANS];
@@ -296,6 +303,10 @@ class TileAANtuple : public AthAlgorithm {
     short m_ROD_DMUrodCRC[N_ROS][N_MODULES][N_DMUS];
     uint16_t m_ROD_DMUMask[N_ROS][N_MODULES][2];
 
+    float m_eTMDB[N_ROS][N_MODULES][N_TMDBCHANS]; // TMDB
+    unsigned char m_sampleTMDB[N_ROS][N_MODULES][N_TMDBCHANS][N_SAMPLES]; // TMDB
+    unsigned char m_decisionTMDB[N_ROS][N_MODULES][N_TMDBCHANS]; // TMDB
+ 
     float m_TEMP[4][64][7];
     float m_HV[4][64][48];
     float m_HVSET[4][64][48];
@@ -321,8 +332,11 @@ class TileAANtuple : public AthAlgorithm {
     std::string m_mfRawChannelContainer;
     std::string m_of1RawChannelContainer;
     std::string m_laserObject;
+    std::string m_tileMuRcvRawChannelContainer; // TMDB
+    std::string m_tileMuRcvDigitsContainer; // TMDB
+    std::string m_tileMuRcvContainer; // TMDB
 
-    // other jobOptions parameters
+   // other jobOptions parameters
     bool m_calibrateEnergy; //!< convert energy to new units or use amplitude from RawChannel directly
     bool m_useDspUnits; //!< true if energy should be converted to units used in DSP
     bool m_bsInput;    //!< true if bytestream file is used
diff --git a/TileCalorimeter/TileRec/TileRec/TileDigitsToNtuple.h b/TileCalorimeter/TileRec/TileRec/TileDigitsToNtuple.h
new file mode 100755
index 0000000000000000000000000000000000000000..58e9e303a77c54ed40f365095e21c609bae592bc
--- /dev/null
+++ b/TileCalorimeter/TileRec/TileRec/TileDigitsToNtuple.h
@@ -0,0 +1,88 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+//****************************************************************************
+// Filename : TileDigitsToNtuple.h
+// Author   : 
+// Created  : 
+//
+// DESCRIPTION
+// 
+//    To create Digits Ntuple file from TileHitContainer
+//
+// Properties (JobOption Parameters):
+//
+//    TileDigitsContainer         string   key value of Digits in TDS 
+//    NtupleLoc                   string   pathname of ntuple file
+//    NtupleID                    string   ID of ntuple
+//
+// BUGS:
+//  
+// History:
+//  
+//  
+//****************************************************************************
+#ifndef TILEDIGITSTONTUPLE_H
+#define TILEDIGITSTONTUPLE_H
+
+#include "GaudiKernel/NTuple.h"
+#include "AthenaBaseComps/AthAlgorithm.h"
+
+class TileID;
+class TileHWID;
+class TileTBID;
+
+#include <string>
+
+class TileDigitsToNtuple : public AthAlgorithm {
+ public:
+  //Constructor
+  TileDigitsToNtuple(const std::string name, ISvcLocator* pSvcLocator);
+  
+  //Destructor 
+  virtual ~TileDigitsToNtuple();                         
+  
+  //Gaudi Hooks
+  StatusCode initialize();    
+  StatusCode execute();
+  StatusCode finalize();
+  
+ private:
+
+  const TileID* m_tileID;
+  const TileHWID* m_tileHWID;
+  const TileTBID* m_tileTBID;
+
+  NTuple::Tuple* m_ntuplePtr;
+  std::string m_ntupleID;
+  std::string m_ntupleLoc;
+  bool m_commitNtuple;
+
+  
+  NTuple::Item<short> m_nChannel;
+
+  NTuple::Array<short> m_ros;
+  NTuple::Array<short> m_drawer;
+  NTuple::Array<short> m_channel;
+  NTuple::Array<short> m_gain;
+
+  NTuple::Array<short> m_section;
+  NTuple::Array<short> m_side;
+  NTuple::Array<short> m_phi;
+  NTuple::Array<short> m_eta;
+  NTuple::Array<short> m_sample;
+  NTuple::Array<short> m_pmt;
+  NTuple::Array<short> m_adc;
+
+  NTuple::Matrix<short> m_samples;
+  
+  std::string m_digitsContainer;
+  std::string m_infoName;
+  int m_saveMaxChannels;
+  int m_nSamples;
+  bool m_saveAll;
+  bool m_saveE4prAndMBTS;
+};
+
+#endif
diff --git a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py
index f66ee10e0d3b0e3f3c56832bc215fc0e0122ad63..540ce7aecfb3a001c0b4b2f1a2fcb7516289cc91 100755
--- a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py
+++ b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py
@@ -38,9 +38,11 @@ if not hasattr( ToolSvc, "TileCellBuilderHG" ):
 from TileRecUtils.TileRecFlags import jobproperties
 ToolSvc.TileCellBuilderLG.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer()
 ToolSvc.TileCellBuilderLG.maskBadChannels = True
+ToolSvc.TileCellBuilderLG.SkipGain = 1
 
 ToolSvc.TileCellBuilderHG.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer()
 ToolSvc.TileCellBuilderHG.maskBadChannels = True
+ToolSvc.TileCellBuilderHG.SkipGain = 0
 
 theCaloCellMakerLG.CaloCellMakerToolNames += [ ToolSvc.TileCellBuilderLG.getFullName() ]
 theCaloCellMakerHG.CaloCellMakerToolNames += [ ToolSvc.TileCellBuilderHG.getFullName() ]
diff --git a/TileCalorimeter/TileRec/share/TileDefaults_jobOptions.py b/TileCalorimeter/TileRec/share/TileDefaults_jobOptions.py
index 9f2faa6dd386a6ecd8cb037a610da37b0650ac9e..4ba33679efe8fca7bdf344efe92b9ce73310f314 100755
--- a/TileCalorimeter/TileRec/share/TileDefaults_jobOptions.py
+++ b/TileCalorimeter/TileRec/share/TileDefaults_jobOptions.py
@@ -18,6 +18,8 @@ if ('doSim' in dir()) and doSim:
     TileMonoRun = False
     TilePhysRun = True
     TileRunType = 1
+    if not 'useTMDB' in dir():
+        useTMDB = False
 
 
 # set options for TileRawChannelMaker
@@ -81,6 +83,9 @@ if not 'TileLasRun' in dir():
 if not 'TileMonoRun' in dir():
     TileMonoRun = False
 
+if not 'useTMDB' in dir():
+    useTMDB = True
+
 if not 'TileRunType' in dir():
     TileRunType = jobproperties.TileRecFlags.TileRunType()
 else:
diff --git a/TileCalorimeter/TileRec/share/TileNtuple_jobOptions.py b/TileCalorimeter/TileRec/share/TileNtuple_jobOptions.py
index b2abb60697d0a7644764ff42f9d76d0d6ebeae19..2d4c0a9d17fad6606483a3ebee85d7efef50b6ce 100755
--- a/TileCalorimeter/TileRec/share/TileNtuple_jobOptions.py
+++ b/TileCalorimeter/TileRec/share/TileNtuple_jobOptions.py
@@ -19,6 +19,9 @@ TileNtuple.TileRawChannelContainerOF1  = ""
 TileNtuple.TileRawChannelContainerMF = ""
 TileNtuple.TileRawChannelContainerDsp  = ""
 TileNtuple.TileLaserObject = ""
+TileNtuple.TileMuRcvRawChannelContainer= ""
+TileNtuple.TileMuRcvDigitsContainer= ""
+TileNtuple.TileMuRcvContainer = ""
 
 from TileRecUtils.TileRecFlags import jobproperties
 
@@ -79,6 +82,11 @@ else:
     if doTileMF:
         TileNtuple.TileRawChannelContainerMF = "TileRawChannelMF"
 
+    if useTMDB:
+        TileNtuple.TileMuRcvRawChannelContainer = "MuRcvRawChCnt"
+        TileNtuple.TileMuRcvDigitsContainer = "MuRcvDigitsCnt"
+        TileNtuple.TileMuRcvContainer = "TileMuRcvCnt"
+
     if TileCisRun:
         # parameters for bigain CIS run
         if not 'TileCalibMode' in dir():
diff --git a/TileCalorimeter/TileRec/share/TileRec_jobOptions.py b/TileCalorimeter/TileRec/share/TileRec_jobOptions.py
index 43d03cc3ad846e5aea11696f8f982d3969ee08b7..62ead5b3e7308f03a940f41421b89e5617f67cb5 100755
--- a/TileCalorimeter/TileRec/share/TileRec_jobOptions.py
+++ b/TileCalorimeter/TileRec/share/TileRec_jobOptions.py
@@ -5,11 +5,12 @@ from AthenaCommon.AppMgr import ServiceMgr
 if not hasattr( ServiceMgr, "ByteStreamAddressProviderSvc" ):
     from ByteStreamCnvSvcBase. ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
     ServiceMgr += ByteStreamAddressProviderSvc()
-    
+ 
 ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += ["TileBeamElemContainer/TileBeamElemCnt",
                                                       "TileDigitsContainer/TileDigitsCnt",
                                                       "TileL2Container/TileL2Cnt",
-                                                      "TileLaserObject/TileLaserObj" ]
+                                                      "TileLaserObject/TileLaserObj",
+						      "TileMuonReceiverContainer/TileMuRcvCnt"]
 
 from TileRecUtils.TileRawChannelGetter import *
 theTileRawChannelGetter=TileRawChannelGetter()
diff --git a/TileCalorimeter/TileRec/share/jobOptions_TileRecNtuple.py b/TileCalorimeter/TileRec/share/jobOptions_TileRecNtuple.py
new file mode 100644
index 0000000000000000000000000000000000000000..87b7076caf7b9e818943d1e39bb343e374dcfc30
--- /dev/null
+++ b/TileCalorimeter/TileRec/share/jobOptions_TileRecNtuple.py
@@ -0,0 +1,80 @@
+from RecExConfig.RecFlags  import rec
+from AthenaCommon.BeamFlags import jobproperties
+from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+from AthenaCommon.GlobalFlags import globalflags
+from AthenaCommon.JobProperties import jobproperties
+
+if not 'OutputLevel' in dir():
+    OutputLevel = WARNING
+
+if not 'OutputDirectory' in dir():
+    OutputDirectory = '.'
+
+if not 'Version' in dir():
+    Version = 0
+
+
+if "FileNameVec" not in dir():
+    if 'FileName' not in dir() or FileName=="":
+        FileNameVec=['']
+    else:
+        FileNameVec=[FileName]
+
+if 'EvtMax' in dir():
+    athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax)
+
+athenaCommonFlags.FilesInput.set_Value_and_Lock(FileNameVec)
+athenaCommonFlags.PoolESDInput.set_Value_and_Lock(FileNameVec)
+
+from RecExConfig.InputFilePeeker import inputFileSummary
+
+if not 'RunNumber' in dir():
+    if inputFileSummary.has_key('run_number'): RunNumber = inputFileSummary['run_number'][0]
+    else:                                            RunNumber = 000000
+
+
+rec.AutoConfiguration=['everything']
+rec.readESD.set_Value_and_Lock(True)
+rec.readAOD.set_Value_and_Lock(False)
+rec.doHist.set_Value_and_Lock(False)
+rec.doCBNT.set_Value_and_Lock(False)
+rec.doWriteTAGCOM.set_Value_and_Lock(False)
+rec.doWriteTAG.set_Value_and_Lock(False)
+rec.doWriteAOD.set_Value_and_Lock(False)
+rec.doAOD.set_Value_and_Lock(False)
+rec.doMonitoring.set_Value_and_Lock(False)
+rec.doPerfMon.set_Value_and_Lock(False)
+rec.doDetailedPerfMon.set_Value_and_Lock(False)
+rec.doSemiDetailedPerfMon.set_Value_and_Lock(False)
+rec.OutputLevel.set_Value_and_Lock(OutputLevel)
+
+# RecExCommon
+include ("RecExCommon/RecExCommon_topOptions.py")
+
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+
+if 'doTileDigitsNtuple' in dir():
+    if doTileDigitsNtuple:
+        from AthenaCommon import CfgMgr
+        topSequence += CfgMgr.TileDigitsToNtuple( "TileDigitsToNtuple")
+
+
+from AthenaCommon.AppMgr import theApp
+
+theApp.HistogramPersistency = 'ROOT'
+NTupleSvc = Service( 'NTupleSvc' )
+NTupleSvc.Output = [ "TILE DATAFILE='tile_" + str(RunNumber) + "_" + str(Version) + ".ntuple.root' OPT='NEW'" ]
+
+
+
+svcMgr = theApp.serviceMgr()
+
+if 'EvtMin' in dir():
+    svcMgr.EventSelector.SkipEvents = EvtMin
+
+if 'EventPrintoutInterval' in dir():
+    from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
+    svcMgr += AthenaEventLoopMgr()
+    svcMgr.AthenaEventLoopMgr.EventPrintoutInterval = EventPrintoutInterval
diff --git a/TileCalorimeter/TileRec/src/TileAANtuple.cxx b/TileCalorimeter/TileRec/src/TileAANtuple.cxx
index f799dd6147b427a8f647201b3f653a22d87e7f57..46492a2c6d16c05caf1ce618d9515b42cccd231c 100755
--- a/TileCalorimeter/TileRec/src/TileAANtuple.cxx
+++ b/TileCalorimeter/TileRec/src/TileAANtuple.cxx
@@ -45,6 +45,7 @@
 #include "TileEvent/TileRawChannelContainer.h"
 #include "TileEvent/TileContainer.h"
 #include "TileEvent/TileLaserObject.h"
+#include "TileEvent/TileMuonReceiverContainer.h"
 #include "TileRecUtils/TileBeamInfoProvider.h"
 #include "TileByteStream/TileBeamElemContByteStreamCnv.h"
 #include "TileL2Algs/TileL2Builder.h"
@@ -163,6 +164,9 @@ TileAANtuple::TileAANtuple(std::string name, ISvcLocator* pSvcLocator)
 , m_ROD_DMUfeCRC()
 , m_ROD_DMUrodCRC()
 , m_ROD_DMUMask()
+, m_eTMDB()
+, m_sampleTMDB()
+, m_decisionTMDB()
 , m_TEMP()
 , m_HV()
 , m_HVSET()
@@ -213,6 +217,9 @@ TileAANtuple::TileAANtuple(std::string name, ISvcLocator* pSvcLocator)
   declareProperty("TileRawChannelContainerOF1", m_of1RawChannelContainer = "");      //
   declareProperty("TileRawChannelContainerDsp", m_dspRawChannelContainer = "");      //
   declareProperty("TileRawChannelContainerMF", m_mfRawChannelContainer = "");      //
+  declareProperty("TileMuRcvRawChannelContainer", m_tileMuRcvRawChannelContainer = "MuRcvRawChCnt");// TMDB
+  declareProperty("TileMuRcvDigitsContainer", m_tileMuRcvDigitsContainer = "MuRcvDigitsCnt");// TMDB
+  declareProperty("TileMuRcvContainer", m_tileMuRcvContainer = "TileMuRcvCnt");// TMDB
   declareProperty("TileLaserObject", m_laserObject = "" /* "TileLaserObj" */);       //
   declareProperty("CalibrateEnergy", m_calibrateEnergy = true);
   declareProperty("UseDspUnits", m_useDspUnits = false);
@@ -258,8 +265,12 @@ TileAANtuple::TileAANtuple(std::string name, ISvcLocator* pSvcLocator)
   memset(m_las_PMT_TDC,        0, sizeof(m_las_PMT_TDC));
   memset(m_las_PMT_Ped,        0, sizeof(m_las_PMT_Ped));
   memset(m_las_PMT_Ped_RMS,    0, sizeof(m_las_PMT_Ped_RMS));
-}
 
+  // TMDB
+  memset(m_eTMDB,0,sizeof(m_eTMDB));
+  memset(m_sampleTMDB,0,sizeof(m_sampleTMDB));
+  memset(m_decisionTMDB,0,sizeof(m_decisionTMDB));
+}
 
 TileAANtuple::~TileAANtuple() {
 }
@@ -442,6 +453,12 @@ StatusCode TileAANtuple::execute() {
   empty &= storeRawChannels(m_optRawChannelContainer,  m_eOpt,  m_tOpt,  m_chi2Opt, m_pedOpt, false).isFailure();
   empty &= storeRawChannels(m_of1RawChannelContainer,  m_eOF1,  m_tOF1,  m_chi2OF1, m_pedOF1, false).isFailure();
   
+  // store TMDB data
+  //
+  empty &= storeTMDBDecision().isFailure();
+  empty &= storeTMDBDigits().isFailure();
+  empty &= storeTMDBRawChannel().isFailure();
+
   if (m_beamCnv) {
     m_evTime = m_beamCnv->eventFragment()->bc_time_seconds();
     m_evt = m_beamCnv->eventFragment()->global_id();
@@ -522,7 +539,7 @@ StatusCode TileAANtuple::execute() {
   if (m_checkDCS) {
     empty &= storeDCS().isFailure();
   }
-  
+ 
   if (empty) {
     ATH_MSG_WARNING( "Some problems in execute - ntuple was not filled at all" );
   }
@@ -1128,7 +1145,7 @@ TileAANtuple::storeDigits(std::string containerId
   if (containerId.size() == 0) // empty name, nothing to do
     return StatusCode::FAILURE;
   
-  // Read Digits from TDS
+  // Read Digits from TES
   const TileDigitsContainer* digitsCnt;
   CHECK( evtStore()->retrieve(digitsCnt, containerId) );
   
@@ -1299,6 +1316,189 @@ TileAANtuple::storeDigits(std::string containerId
   else return StatusCode::SUCCESS;
 }
 
+StatusCode TileAANtuple::storeTMDBDecision() {
+
+  const char * part[4] = {"LBA","LBC","EBA","EBC"};
+
+  // Read Decision from TES
+  //
+  if (m_tileMuRcvContainer.size()>0){
+
+    ATH_MSG_VERBOSE( "reading TMDB decision from " << m_tileMuRcvContainer ); 
+
+    const TileMuonReceiverContainer *decisionCnt;
+    CHECK( evtStore()->retrieve(decisionCnt, m_tileMuRcvContainer) );
+  
+    TileMuonReceiverContainer::const_iterator it = decisionCnt->begin();
+    TileMuonReceiverContainer::const_iterator itLast = decisionCnt->end();
+  
+    // Go through all decisions
+    for(; it != itLast; ++it) {
+
+      const TileMuonReceiverObj * obj = (*it);
+
+      const std::vector<bool> & decision = obj->GetDecision(); 
+      int siz = decision.size();
+
+      if (siz>0) {
+
+        int fragId = (*it)->identify();
+        int drawer = fragId & 0x3F;
+        int ros    = (fragId>>8) - 1;
+ 
+        if (siz > N_TMDBCHANS) {
+          ATH_MSG_VERBOSE( "ONLY " << N_TMDBCHANS << " decisions saved to ntuple instead of " << siz);
+          siz = N_TMDBCHANS;
+        }
+
+        for (int n = 0; n < siz; ++n) {
+          m_decisionTMDB[ros][drawer][n] = (unsigned char) decision[n];
+        }
+
+        if (msgLvl(MSG::VERBOSE)) {
+          std::stringstream ss;
+          for (int n = 0; n < siz; ++n) {
+            ss<<std::setw(5)<<(int)m_decisionTMDB[ros][drawer][n];
+          }
+          msg(MSG::VERBOSE) << "   0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros] 
+                            << std::setfill('0') << std::setw(2)
+                            << drawer+1 << std::setfill(' ') 
+                            << "      decision: " <<ss.str() << endmsg;
+        }
+      }
+    }
+  }
+
+  return StatusCode::SUCCESS;
+}
+ 
+StatusCode TileAANtuple::storeTMDBDigits() {
+
+  const char * part[4] = {"LBA","LBC","EBA","EBC"};
+
+  // Read Digits from TES
+  //
+  if (m_tileMuRcvDigitsContainer.size()>0){
+
+    ATH_MSG_VERBOSE( "reading TMDB digits from " << m_tileMuRcvDigitsContainer ); 
+
+    const TileDigitsContainer* digitsCnt;
+    CHECK( evtStore()->retrieve(digitsCnt, m_tileMuRcvDigitsContainer) );
+  
+    TileDigitsContainer::const_iterator itColl1 = (*digitsCnt).begin();
+    TileDigitsContainer::const_iterator itCollEnd1 = (*digitsCnt).end();
+  
+    // Go through all TileDigitsCollections
+    for(; itColl1 != itCollEnd1; ++itColl1) {
+
+      TileDigitsCollection::const_iterator it1 = (*itColl1)->begin();
+      TileDigitsCollection::const_iterator itEnd1 = (*itColl1)->end();
+
+      if (it1!=itEnd1) {
+
+        int fragId = (*itColl1)->identify();
+        int drawer = fragId & 0x3F;
+        int ros    = (fragId>>8) - 1;
+        int ichannel = 0;
+ 
+        ATH_MSG_VERBOSE( "   0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros]
+                         << std::setfill('0') << std::setw(2)
+                          << drawer+1 << std::setfill(' ') ); 
+
+        for (; it1 != itEnd1; ++it1) {
+
+          if (ichannel>=N_TMDBCHANS) {
+            ATH_MSG_WARNING("Too many channels in TMDB Digi container for frag 0x" <<MSG::hex<< fragId <<MSG::dec <<" keeping only first " << N_TMDBCHANS << " channels in ntuple ");
+            break;
+          }
+
+          const TileDigits* digit = (*it1);
+        
+          // get digits
+          const std::vector<float> & sampleVec = digit->samples();
+          int siz = sampleVec.size();
+
+          if (siz > N_SAMPLES) {
+            ATH_MSG_VERBOSE( "ONLY " << N_SAMPLES << " digits saved to ntuple instead of " << siz);
+            siz = N_SAMPLES;
+          }
+
+          for (int n = 0; n < siz; ++n) {
+            m_sampleTMDB[ros][drawer][ichannel][n] = (unsigned char) sampleVec[n];
+          }
+
+          if (msgLvl(MSG::VERBOSE)) {
+            std::stringstream ss;
+            for (int n = 0; n < siz; ++n) {
+              ss<<std::setw(5)<<(int)m_sampleTMDB[ros][drawer][ichannel][n];
+            }
+            msg(MSG::VERBOSE) << "      dig: " <<ros+1<<"/"<<drawer<<"/"<<m_tileHWID->channel(digit->adc_HWID())<<": "<<ss.str() << endmsg;;
+          }
+      
+          ++ichannel;
+        }
+      }
+    }
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode TileAANtuple::storeTMDBRawChannel() {
+
+  const char * part[4] = {"LBA","LBC","EBA","EBC"};
+
+  // Read Raw Channels from TDS
+  //
+  if (m_tileMuRcvRawChannelContainer.size()>0){
+
+    ATH_MSG_VERBOSE( "reading TMDB energies from " << m_tileMuRcvRawChannelContainer ); 
+
+    const TileRawChannelContainer* rcCnt;
+    CHECK( evtStore()->retrieve(rcCnt, m_tileMuRcvRawChannelContainer) );
+
+    TileRawChannelContainer::const_iterator itColl2 = (*rcCnt).begin();
+    TileRawChannelContainer::const_iterator itCollEnd2 = (*rcCnt).end();
+  
+    // Go through all TileDigitsCollections
+    for(; itColl2 != itCollEnd2; ++itColl2) {
+
+      TileRawChannelCollection::const_iterator it2 = (*itColl2)->begin();
+      TileRawChannelCollection::const_iterator itEnd2 = (*itColl2)->end();
+
+      if (it2!=itEnd2) {
+
+        int fragId = (*itColl2)->identify();
+        int drawer = fragId & 0x3F;
+        int ros    = (fragId>>8) - 1;
+        int ichannel = 0;
+  
+        ATH_MSG_VERBOSE( "   0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros]
+                         << std::setfill('0') << std::setw(2)
+                         << drawer+1 << std::setfill(' ') ); 
+
+        for (; it2 != itEnd2; ++it2) {
+
+          if (ichannel>=N_TMDBCHANS) {
+            ATH_MSG_WARNING("Too many channels in TMDB RCh container for frag 0x" <<MSG::hex<< fragId <<MSG::dec <<" keeping only first " << N_TMDBCHANS << " channels in ntuple ");
+            break;
+          }
+
+          const TileRawChannel* rc = (*it2);
+        
+          m_eTMDB[ros][drawer][ichannel] =  rc -> amplitude();
+
+          ATH_MSG_VERBOSE( "      rc: " <<ros+1<<"/"<<drawer<<"/"<<m_tileHWID->channel(rc->adc_HWID())<< ": " << m_eTMDB[ros][drawer][ichannel] );
+
+          ++ichannel;
+        }
+      }
+    }
+  }
+
+  return StatusCode::SUCCESS;
+}
+
 StatusCode
 TileAANtuple::finalize() {
   ATH_MSG_INFO( "finalize() successfully" );
@@ -1312,7 +1512,8 @@ TileAANtuple::ntuple_clear() {
   CISPAR_clearBranch();
   LASER_clearBranch();
   DIGI_clearBranch();
-  
+  TMDB_clearBranch();
+
   return StatusCode::SUCCESS;
 }
 
@@ -1347,7 +1548,7 @@ TileAANtuple::initNTuple(void) {
       LASER_addBranch();
     }
     DIGI_addBranch();
-    
+    TMDB_addBranch();
   }
   
   //DCS Ntuple creation
@@ -1582,7 +1783,7 @@ void TileAANtuple::LASER_addBranch(void) {
       
       ATH_MSG_DEBUG("LASERII BRANCHING..");
       
-      m_ntuplePtr->Branch(Form("LASER_DAQTYPE"),&(m_daqtype),Form("LASER_DAQTYPE"));
+      m_ntuplePtr->Branch(Form("LASER_DAQTYPE"),&(m_daqtype),Form("LASER_DAQTYPE/I"));
       for(int chan=0;chan<32;++chan){
         m_ntuplePtr->Branch(Form("LASER_%s_%s_ADC",gainnames[chan%2],channames[chan/2]),&(m_chan[chan]),Form("LASER_%s_%s_ADC/I",gainnames[chan%2],channames[chan/2]));
         m_ntuplePtr->Branch(Form("LASER_%s_%s_Ped",gainnames[chan%2],channames[chan/2]),&(m_chan_Ped[chan]),Form("LASER_%s_%s_Ped/F",gainnames[chan%2],channames[chan/2]));
@@ -2162,6 +2363,40 @@ void TileAANtuple::DIGI_clearBranch(void) {
   
 }
 
+/*//////////////////////////////////////////////////////////////////////////////
+ // TMDB variables
+ //////////////////////////////////////////////////////////////////////////////
+ */
+
+void TileAANtuple::TMDB_addBranch(void)
+{
+  
+  if (m_tileMuRcvRawChannelContainer.size()>0) {
+    m_ntuplePtr->Branch("eTMDB", m_eTMDB, "eTMDB[4][64][4]/F");
+  }
+
+  if (m_tileMuRcvDigitsContainer.size()>0) {
+    m_ntuplePtr->Branch("sampleTMDB", m_sampleTMDB, "sampleTMDB[4][64][4][7]/b");
+  }
+
+  if (m_tileMuRcvContainer.size()>0) {
+    m_ntuplePtr->Branch("decisionTMDB", m_decisionTMDB, "decisionTMDB[4][64][4]/b");
+  }
+
+}
+
+void TileAANtuple::TMDB_clearBranch(void)
+{
+  if (m_tileMuRcvRawChannelContainer.size()>0) CLEAR(m_eTMDB);
+  if (m_tileMuRcvDigitsContainer.size()>0) CLEAR(m_sampleTMDB);
+  if (m_tileMuRcvContainer.size()>0) CLEAR(m_decisionTMDB);
+}
+
+/*/////////////////////////////////////////////////////////////////////////////
+ // DCS variables
+ /////////////////////////////////////////////////////////////////////////////
+ */
+
 void TileAANtuple::DCS_addBranch() {
   bool br[9];
   int mask = m_DCSBranches;
diff --git a/TileCalorimeter/TileRec/src/TileCellIDCToNtuple.cxx b/TileCalorimeter/TileRec/src/TileCellIDCToNtuple.cxx
index 627f66daa20436d275e8cc81b90d46483d605230..990c70473ac67254ffde90024113fedaced6a092 100755
--- a/TileCalorimeter/TileRec/src/TileCellIDCToNtuple.cxx
+++ b/TileCalorimeter/TileRec/src/TileCellIDCToNtuple.cxx
@@ -97,9 +97,7 @@ StatusCode TileCellIDCToNtuple::initialize()
 
 StatusCode TileCellIDCToNtuple::execute()
 {
-  StatusCode sc;
-
-  // step1: read RCs from TDS
+  // step1: read Cells from TDS
   const TileCellIDC* CellCnt;
   CHECK( evtStore()->retrieve(CellCnt, m_cellContainer) );
 
diff --git a/TileCalorimeter/TileRec/src/TileCellToNtuple.cxx b/TileCalorimeter/TileRec/src/TileCellToNtuple.cxx
index 6d490f805187ff6515eb5cfff0e6476cff8ee9a1..e64de0204326713507b15e65e2128bd9f4f9181e 100755
--- a/TileCalorimeter/TileRec/src/TileCellToNtuple.cxx
+++ b/TileCalorimeter/TileRec/src/TileCellToNtuple.cxx
@@ -111,14 +111,12 @@ StatusCode TileCellToNtuple::initialize()
 
 StatusCode TileCellToNtuple::execute()
 {
-  StatusCode sc;
-
   m_nchan=0;
   m_tolE=0.0;
 
   if (m_scinCells) {
 
-    // step1: read RCs from TDS
+    // step1: read Cells from TDS
     const TileCellContainer* CellCnt;
     CHECK( evtStore()->retrieve(CellCnt, m_cellContainer) );
 
@@ -147,7 +145,7 @@ StatusCode TileCellToNtuple::execute()
 
 
 
-    // step1: read RCs from TDS
+    // step1: read Cells from TDS
     const CaloCellContainer* CellCnt;
     CHECK( evtStore()->retrieve(CellCnt, m_cellContainer) );
 
diff --git a/TileCalorimeter/TileRec/src/TileDigitsToNtuple.cxx b/TileCalorimeter/TileRec/src/TileDigitsToNtuple.cxx
new file mode 100755
index 0000000000000000000000000000000000000000..9d1f0383497c8e41d4749f71d673a178668a470b
--- /dev/null
+++ b/TileCalorimeter/TileRec/src/TileDigitsToNtuple.cxx
@@ -0,0 +1,227 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+//*****************************************************************************
+//  Filename : TileDigitsToNtuple.cxx
+//  Author   : 
+//  Created  : 
+//
+//  DESCRIPTION:
+//     Implement the algorithm
+//
+//  HISTORY:
+//
+//  BUGS:
+//
+//*****************************************************************************
+
+//Gaudi includes
+#include "GaudiKernel/INTupleSvc.h"
+#include "GaudiKernel/IDataProviderSvc.h"
+#include "GaudiKernel/SmartDataPtr.h"
+
+//Atlas include
+#include "AthenaKernel/errorcheck.h"
+#include "EventContainers/SelectAllObject.h"
+
+// Calo include
+#include "CaloIdentifier/TileID.h"
+#include "CaloIdentifier/TileTBID.h"
+
+//TileCalo include
+#include "TileConditions/TileInfo.h"
+#include "TileEvent/TileDigitsContainer.h"  
+#include "TileRec/TileDigitsToNtuple.h"
+#include "TileIdentifier/TileHWID.h"
+
+
+TileDigitsToNtuple::TileDigitsToNtuple(const std::string name, ISvcLocator* pSvcLocator)
+  : AthAlgorithm(name, pSvcLocator)
+  , m_tileID(0)
+  , m_tileHWID(0)
+  , m_tileTBID(0)
+  , m_ntuplePtr(0)
+  , m_nSamples(7)
+{
+  declareProperty("TileDigitsContainer", m_digitsContainer = "TileDigitsFlt");    
+  declareProperty("NTupleLoc", m_ntupleLoc = "/TILE/TileRec");
+  declareProperty("NTupleID", m_ntupleID = "h40");
+  declareProperty("CommitNtuple", m_commitNtuple = true);
+  declareProperty("TileInfoName", m_infoName = "TileInfo");
+  declareProperty("SaveMaxChannels", m_saveMaxChannels = 12288);
+  declareProperty("SaveAll", m_saveAll = true);
+  declareProperty("SaveE4prAndMBTS", m_saveE4prAndMBTS = true);
+}
+
+TileDigitsToNtuple::~TileDigitsToNtuple()
+{
+}
+
+//****************************************************************************
+//* Initialization
+//****************************************************************************
+
+StatusCode TileDigitsToNtuple::initialize() {
+   
+  ATH_MSG_INFO( "Initialization started" );
+
+  // retrieve TileID helper from det store
+  CHECK( detStore()->retrieve(m_tileID) );
+  CHECK( detStore()->retrieve(m_tileHWID) );
+  CHECK( detStore()->retrieve(m_tileTBID) );
+
+  const TileInfo* tileInfo;
+  CHECK( detStore()->retrieve(tileInfo, m_infoName) );
+  m_nSamples = tileInfo->NdigitSamples(); // number of time slices for each chan
+
+  m_ntupleLoc = "/NTUPLES" + m_ntupleLoc;
+  std::string ntupleCompleteID = m_ntupleLoc + "/" + m_ntupleID;
+  NTuplePtr nt(ntupleSvc(), ntupleCompleteID);
+
+  if ( nt ) { // Check if already booked
+    m_ntuplePtr = nt;
+    ATH_MSG_INFO( "Reaccessing ntuple " << ntupleCompleteID );
+  } else {
+    m_ntuplePtr = ntupleSvc()->book(ntupleCompleteID, CLID_ColumnWiseTuple, "TileDigits-Ntuple");
+    if (m_ntuplePtr) {
+      
+      CHECK( m_ntuplePtr->addItem("TileDigits/n_channels", m_nChannel, 0, m_saveMaxChannels) );
+
+      CHECK( m_ntuplePtr->addItem("TileDigits/ros", m_nChannel, m_ros, 0, 4) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/drawer", m_nChannel, m_drawer, 0, 63) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/channel", m_nChannel, m_channel, 0, 47) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/gain", m_nChannel, m_gain, 0, 1) );
+
+      CHECK( m_ntuplePtr->addItem("TileDigits/side", m_nChannel, m_side, -1, 1) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/section", m_nChannel, m_section, 0, 15) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/phi", m_nChannel, m_phi, 0, 63) );
+      CHECK( m_ntuplePtr->addItem("TileDigits/eta", m_nChannel, m_eta, 0, 15) );
+
+      CHECK( m_ntuplePtr->addItem("TileDigits/samples", m_nChannel, m_samples, m_nSamples) );
+
+      if (!m_saveAll && !m_saveE4prAndMBTS) {
+        CHECK( m_ntuplePtr->addItem("TileDigits/sample", m_nChannel, m_sample, 0, 15) );
+        CHECK( m_ntuplePtr->addItem("TileDigits/pmt", m_nChannel, m_pmt, 0, 1) );
+        CHECK( m_ntuplePtr->addItem("TileDigits/adc", m_nChannel, m_adc, 0, 1) );
+      }
+      
+    } else {
+      ATH_MSG_ERROR( "Failed to book or to retrieve ntuple " << ntupleCompleteID );
+      return StatusCode::FAILURE;
+    }
+    ATH_MSG_INFO( "Finished booking ntuple " << ntupleCompleteID );
+  }
+
+  ATH_MSG_INFO( "Initialization completed" );
+  return StatusCode::SUCCESS;
+}
+
+//****************************************************************************
+//* Execution
+//****************************************************************************
+
+StatusCode TileDigitsToNtuple::execute() {
+
+  // step1: read TileDigitss from TDS
+  const TileDigitsContainer* digitsContainer; 
+  CHECK( evtStore()->retrieve(digitsContainer, m_digitsContainer) );
+
+  m_nChannel = 0;
+
+  SelectAllObject<TileDigitsContainer> allTileDigits(digitsContainer);
+
+  for (const TileDigits* tile_digits : allTileDigits) {
+
+    HWIdentifier adc_hwid = tile_digits->adc_HWID();
+    Identifier adc_id = tile_digits->adc_ID();
+
+    std::vector<float> samples = tile_digits->samples();
+    int n_samples = samples.size();
+    
+    if (m_saveAll) {
+      m_ros[m_nChannel] = m_tileHWID->ros(adc_hwid);
+      m_drawer[m_nChannel] = m_tileHWID->drawer(adc_hwid);
+      m_channel[m_nChannel] = m_tileHWID->channel(adc_hwid);
+      m_gain[m_nChannel] = m_tileHWID->adc(adc_hwid);
+
+      if (m_tileTBID->is_tiletb(adc_id)) {
+        m_section[m_nChannel] = m_tileTBID->section(adc_id);
+        m_side[m_nChannel] = m_tileTBID->side(adc_id);
+        m_phi[m_nChannel] = m_tileTBID->phi(adc_id);
+        m_eta[m_nChannel] = m_tileTBID->eta(adc_id);
+      } else {
+        m_section[m_nChannel] = m_tileID->section(adc_id);
+        m_side[m_nChannel] = m_tileID->side(adc_id);
+        m_phi[m_nChannel] = m_tileID->module(adc_id);
+        m_eta[m_nChannel] = m_tileID->tower(adc_id);
+      }
+
+      for (int i = 0; i < n_samples && i < m_nSamples; ++i) m_samples[m_nChannel][i] = samples[i];
+
+      ++m_nChannel;
+
+    } else if (m_saveE4prAndMBTS) {
+      if (m_tileTBID->is_tiletb(adc_id)) {
+        m_ros[m_nChannel] = m_tileHWID->ros(adc_hwid);
+        m_drawer[m_nChannel] = m_tileHWID->drawer(adc_hwid);
+        m_channel[m_nChannel] = m_tileHWID->channel(adc_hwid);
+        m_gain[m_nChannel] = m_tileHWID->adc(adc_hwid);
+
+        m_section[m_nChannel] = m_tileTBID->section(adc_id);
+        m_side[m_nChannel] = m_tileTBID->side(adc_id);
+        m_phi[m_nChannel] = m_tileTBID->phi(adc_id);
+        m_eta[m_nChannel] = m_tileTBID->eta(adc_id);
+
+        for (int i = 0; i < n_samples && i < m_nSamples; ++i) m_samples[m_nChannel][i] = samples[i];
+
+        ++m_nChannel;
+      }
+    } else {
+      if (!m_tileTBID->is_tiletb(adc_id)) {
+        m_ros[m_nChannel] = m_tileHWID->ros(adc_hwid);
+        m_drawer[m_nChannel] = m_tileHWID->drawer(adc_hwid);
+        m_channel[m_nChannel] = m_tileHWID->channel(adc_hwid);
+        m_gain[m_nChannel] = m_tileHWID->adc(adc_hwid);
+
+        m_section[m_nChannel] = m_tileID->section(adc_id);
+        m_side[m_nChannel] = m_tileID->side(adc_id);
+        m_phi[m_nChannel] = m_tileID->module(adc_id);
+        m_eta[m_nChannel] = m_tileID->tower(adc_id);
+
+        m_sample[m_nChannel] = m_tileID->sample(adc_id);
+        m_pmt[m_nChannel] = m_tileID->pmt(adc_id);
+        m_adc[m_nChannel] = m_tileID->adc(adc_id);
+
+        for (int i = 0; i < n_samples && i < m_nSamples; ++i) m_samples[m_nChannel][i] = samples[i];
+
+        ++m_nChannel;
+      }
+    }
+
+    if (m_nChannel >= m_saveMaxChannels) {
+      ATH_MSG_DEBUG( "Number of channels exceeds maximum (" << m_saveMaxChannels << "), ignore all the rest" );
+      break;
+    }
+  }
+
+
+  if ( m_commitNtuple ) {
+    ATH_MSG_DEBUG( "Committing Ntuple" );
+    CHECK( ntupleSvc()->writeRecord(m_ntuplePtr) );
+  }
+
+  // Execution completed.
+  ATH_MSG_DEBUG( "execute() completed successfully" );
+  return StatusCode::SUCCESS;
+}
+
+//****************************************************************************
+//* Finalize
+//****************************************************************************
+
+StatusCode TileDigitsToNtuple::finalize() {
+  ATH_MSG_INFO( "finalize() completed successfully" );
+  return StatusCode::SUCCESS;
+}
+
diff --git a/TileCalorimeter/TileRec/src/components/TileRec_entries.cxx b/TileCalorimeter/TileRec/src/components/TileRec_entries.cxx
index 35b7252fce320bd82f78427b8f02fa46f5ef7bdd..f791ada85053ac3f0f3f4361a02ebdaba87cf7ba 100755
--- a/TileCalorimeter/TileRec/src/components/TileRec_entries.cxx
+++ b/TileCalorimeter/TileRec/src/components/TileRec_entries.cxx
@@ -5,6 +5,7 @@
 #include "TileRec/TileHitToNtuple.h"
 #include "TileRec/TileTBHitToNtuple.h"
 #include "TileRec/TileHitVecToNtuple.h"
+#include "TileRec/TileDigitsToNtuple.h"
 #include "TileRec/TileTTL1ToNtuple.h"
 #include "GaudiKernel/DeclareFactoryEntries.h"
 #include "TileRec/TileMuonReceiverDecisionToNtuple.h"
@@ -16,6 +17,7 @@ DECLARE_ALGORITHM_FACTORY( TileCellToNtuple )
 DECLARE_ALGORITHM_FACTORY( TileHitToNtuple )
 DECLARE_ALGORITHM_FACTORY( TileTBHitToNtuple )
 DECLARE_ALGORITHM_FACTORY( TileHitVecToNtuple )
+DECLARE_ALGORITHM_FACTORY( TileDigitsToNtuple )
 DECLARE_ALGORITHM_FACTORY( TileTTL1ToNtuple )
 DECLARE_ALGORITHM_FACTORY( TileMuonReceiverDecisionToNtuple )
 
@@ -27,6 +29,7 @@ DECLARE_FACTORY_ENTRIES(TileRec) {
   DECLARE_ALGORITHM( TileHitToNtuple )
   DECLARE_ALGORITHM( TileTBHitToNtuple )
   DECLARE_ALGORITHM( TileHitVecToNtuple )
+  DECLARE_ALGORITHM( TileDigitsToNtuple )
   DECLARE_ALGORITHM( TileTTL1ToNtuple )
   DECLARE_ALGORITHM( TileMuonReceiverDecisionToNtuple )
 }