50     '''Function to configure Tile TMDB raw channel monitoring algorithm.''' 
   51     from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
   54     from TileConditions.TileCablingSvcConfig 
import TileCablingSvcCfg
 
   57     from AthenaConfiguration.Enums 
import Format
 
   58     if flags.Input.Format == Format.BS:
 
   59         from TileByteStream.TileByteStreamConfig 
import TileRawDataReadingCfg
 
   61                                            readMuRcv=
True, readMuRcvDigits=
True, readMuRcvRawCh=
True))
 
   63     isDSP = (MuRcvRawChCnt == 
"MuRcvRawChCnt")
 
   67     name = kwargs.get(
'name', 
'TileTMDBRawChanDspMonAlg' if isDSP 
else 'TileTMDBRawChanMonAlg')
 
   69     from AthenaMonitoring 
import AthMonitorCfgHelper
 
   70     helper = AthMonitorCfgHelper(flags, 
'TileTMDBRawChannelDspMonitoring' if isDSP 
else 'TileTMDBRawChannelMonitoring')
 
   72     from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   73     tileTMDBRawChanMonAlg = helper.addAlgorithm(CompFactory.TileTMDBRawChannelMonitorAlgorithm, name)
 
   74     tileTMDBRawChanMonAlg.TriggerChain = 
'' 
   75     tileTMDBRawChanMonAlg.MuRcvRawChCnt = MuRcvRawChCnt
 
   76     tileTMDBRawChanMonAlg.DSP = isDSP
 
   77     tileTMDBRawChanMonAlg.FillEfficiencyHistograms = FillEfficiencyHistograms
 
   78     tileTMDBRawChanMonAlg.FillRawChannelHistograms = FillRawChannelHistograms
 
   80     topPath = 
'Tile/TMDBRawChannel/DSP' if isDSP 
else 'Tile/TMDBRawChannel' 
   81     run = 
str(flags.Input.RunNumbers[0])
 
   83     if FillRawChannelHistograms:
 
   92         from TileMonitoring.TileMonitoringCfgHelper 
import addTileTMDB_1DHistogramsArray, addTileTMDB_2DHistogramsArray
 
   95                                       value = 
'amplitude', title = 
'Amplitude Map',
 
   96                                       path = topPath, type=
'TProfile2D', run = run)
 
   99                                       value = 
'time', title = 
'Time Map',
 
  100                                       path = topPath, type=
'TProfile2D', run = run)
 
  103                                       xvalue = 
'time', title = 
'Time;[ns]',
 
  104                                       path = topPath, type=
'TH1D', run = run,
 
  105                                       xbins = 120, xmin = -60, xmax = 60)
 
  108                                       xvalue = 
'amplitude', title = 
'Amplitude;[ADC]',
 
  109                                       path = topPath, type=
'TH1D', run = run,
 
  110                                       xbins = 276, xmin = minAmplitude, xmax = maxAmplitude)
 
  113     if FillEfficiencyHistograms:
 
  115         from TileConditions.TileTMDBConfig 
import TileTMDBCondAlgCfg
 
  118         from TileCalibBlobObjs.Classes 
import TileCalibUtils 
as Tile
 
  119         from TileMonitoring.TileMonitoringCfgHelper 
import getLabels, getPartitionName
 
  121         arrayTGC = helper.addArray([2], tileTMDBRawChanMonAlg, 
'TGC_TrSec_number_Good_Muons')
 
  122         for postfix, tool 
in arrayTGC.Tools.items():
 
  123             ros = 
int(postfix.split(
'_').pop()) + 3
 
  126             fullName = 
'sector;TGC_TrSec_number_Good_Muons_{}'.
format(partition)
 
  127             fullTitle = 
'Number of Good Muons in TGC trigger sectors {}'.
format(partition)
 
  129             tool.defineHistogram(fullName, path = topPath, type = 
'TH1D', title = fullTitle,
 
  130                                 xbins = 48, xmin = -0.5, xmax = 47.5)
 
  133         cells = [
'D6', 
'D5+D6']
 
  134         thresholds = [
'500MeV',
'600MeV']
 
  135         tileTMDBRawChanMonAlg.NumberOfThresholds = len(thresholds)
 
  136         arrayThreshD = helper.addArray([2, len(thresholds), len(cells)], tileTMDBRawChanMonAlg, 
'TMDB_coincidence_threshold')
 
  137         for postfix, tool 
in arrayThreshD.Tools.items():
 
  138             elements = postfix.split(
'_')
 
  139             cell = 
int(elements.pop())
 
  140             threshold = 
int(elements.pop())
 
  141             ros = 
int(elements.pop()) + 3
 
  144             labels = 
getLabels((
'modules'), partition)
 
  146             fullName = 
'module;TMDB_{}_{}_coincidence_{}'.
format(partition, cells[cell], thresholds[threshold])
 
  147             fullTitle = 
'Number coincidence from all Good Muons in TMDB {} {}  over {} threshold'.
format(partition, cells[cell], thresholds[threshold])
 
  149             tool.defineHistogram(fullName, path = topPath, type = 
'TH1D', title = fullTitle, xlabels = labels,
 
  150                                  xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5)
 
  153     accumalator = helper.result()
 
  154     result.merge(accumalator)