3 """Define method to construct configured Tile DQ status tool and algorithm""" 
    5 from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
    6 from AthenaConfiguration.ComponentFactory 
import CompFactory
 
    7 from AthenaConfiguration.Enums 
import Format
 
    8 from TileConfiguration.TileConfigFlags 
import TileRunType
 
   11     """Return component accumulator with configured private Tile DQ status tool 
   14         flags  -- Athena configuration flags 
   15         SimulateTrips - flag to simulate drawer trips. Defaults to False. 
   20     kwargs.setdefault(
'SimulateTrips', 
False)
 
   22     from TileConditions.TileBadChannelsConfig 
import TileBadChannelsCondAlgCfg
 
   25     TileDQstatusTool=CompFactory.TileDQstatusTool
 
   32     """Return component accumulator with configured Tile DQ status algorithm 
   35         flags  -- Athena configuration flags 
   36         TileDQstatus - name of Tile DQ status produced 
   37         TileDigitsContainer - name of Tile digits container, provided it will be used, 
   38                               otherwise it will be determined automatically depending on flags. 
   39         TileRawChannelContainer - name of Tile raw channel container, provided it will be used, 
   40                                   otherwise it will be determined automatically depending on flags. 
   41         TileBeamElemContainer - name of Tile beam elements container, provided it will be used, 
   42                                 otherwise it will be determined automatically depending on flags. 
   47     kwargs.setdefault(
'TileDQstatus', 
'TileDQstatus')
 
   49     name = kwargs[
'TileDQstatus'] + 
'Alg' 
   50     kwargs.setdefault(
'name', name)
 
   52     if not (flags.Input.isMC 
or flags.Overlay.DataOverlay 
or flags.Input.Format 
is Format.POOL):
 
   53         if flags.Tile.RunType 
in [TileRunType.PHY, TileRunType.GAPLAS, TileRunType.GAPCIS]:
 
   54             beamElemContainer = 
"" 
   56             beamElemContainer = 
'TileBeamElemCnt' 
   58         if flags.Tile.readDigits:
 
   59             digitsContainer = 
'TileDigitsCnt' 
   63         rawChannelContainer = 
'TileRawChannelCnt' 
   65     elif flags.Common.isOverlay 
and flags.Overlay.DataOverlay:
 
   66         beamElemContainer = 
'' 
   67         digitsContainer = flags.Overlay.BkgPrefix + 
'TileDigitsCnt' 
   68         rawChannelContainer = flags.Overlay.BkgPrefix + 
'TileRawChannelCnt' 
   70         if not flags.Overlay.ByteStream:
 
   71             from SGComps.SGInputLoaderConfig 
import SGInputLoaderCfg
 
   72             acc.merge(
SGInputLoaderCfg(flags, [f
'TileDigitsContainer#{digitsContainer}']))
 
   73             acc.merge(
SGInputLoaderCfg(flags, [f
'TileRawChannelContainer#{rawChannelContainer}']))
 
   75         beamElemContainer = 
"" 
   77         rawChannelContainer = 
"" 
   79     kwargs.setdefault(
'TileBeamElemContainer', beamElemContainer)
 
   80     kwargs.setdefault(
'TileDigitsContainer', digitsContainer)
 
   81     kwargs.setdefault(
'TileRawChannelContainer', rawChannelContainer)
 
   83     if 'TileDQstatusTool' not in kwargs:
 
   85         kwargs[
'TileDQstatusTool'] = tileDQstatusTool
 
   87     TileDQstatusAlg=CompFactory.TileDQstatusAlg
 
   94 if __name__ == 
"__main__":
 
   96     from AthenaConfiguration.AllConfigFlags 
import initConfigFlags
 
   97     from AthenaConfiguration.TestDefaults 
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
 
   98     from AthenaCommon.Logging 
import log
 
  105     flags.Input.Files = defaultTestFiles.RAW_RUN2
 
  106     flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
 
  107     flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
 
  108     flags.Tile.RunType = TileRunType.PHY
 
  111     from AthenaConfiguration.MainServicesConfig 
import MainServicesCfg
 
  114     from TileByteStream.TileByteStreamConfig 
import TileRawDataReadingCfg
 
  120     acc.printConfig(withDetails = 
True, summariseProps = 
True)
 
  121     acc.store( 
open(
'TileDQstatus.pkl',
'wb') )
 
  123     sc = acc.run(maxEvents = 3)
 
  127     sys.exit(
not sc.isSuccess())