Skip to content
Snippets Groups Projects
Commit 3ea2dac2 authored by Siarhei Harkusha's avatar Siarhei Harkusha
Browse files

TileRecUtils: Add Tile raw channel maker configuration for Run3

Configuration of Tile raw channel builder using Fit  method has been added for Run3.

Configurations of Tile raw channel builders using Optimal Filtering methods
(OF1, Opt2, OptATLAS) have been added for Run3.

Configuration of Tile raw channel maker has been added for Run3.

Tests for Tile raw channel builders (Fit, OF1, Opt2, OptATLAS) and
raw channel maker have been added.
parent fcfbbad5
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,22 @@ atlas_add_test( flake8
SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py
POST_EXEC_SCRIPT nopost.sh )
atlas_add_test( TileRawChannelBuilderFitConfig_test
SCRIPT python -m TileRecUtils.TileRawChannelBuilderFitConfig
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( TileRawChannelBuilderOptConfig_test
SCRIPT python -m TileRecUtils.TileRawChannelBuilderOptConfig
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( TileRawChannelCorrectionConfig_test
SCRIPT python -m TileRecUtils.TileRawChannelCorrectionConfig
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( TileRawChannelMakerConfig_test
SCRIPT python -m TileRecUtils.TileRawChannelMakerConfig
PROPERTIES TIMEOUT 300
POST_EXEC_SCRIPT nopost.sh)
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""Define method to construct configured Tile Fit raw channel builder tool"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
_runTypes = {'PHY' : 1, 'LAS' : 2, 'BILAS' : 2, 'PED' : 4, 'CIS' : 8, 'MONOCIS' : 8}
def TileRawChannelBuilderFitFilterCfg(flags, **kwargs):
"""Return component accumulator with configured private Tile Fit raw channel builder tool
Arguments:
flags -- Athena configuration flags (ConfigFlags)
"""
acc = ComponentAccumulator()
runType = flags.Tile.RunType
runType = runType.upper()
if runType not in _runTypes.keys():
raise(Exception("Invalid Tile run type: %s" % runType))
from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
acc.merge( TileDQstatusAlgCfg(flags) )
from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
acc.merge( TileInfoLoaderCfg(flags) )
from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFitFilter
tileRawChannelBuilderFit = TileRawChannelBuilderFitFilter()
from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
sampleNoiseTool = acc.popToolsAndMerge( TileCondToolNoiseSampleCfg(flags) )
tileRawChannelBuilderFit.TileCondToolNoiseSample = sampleNoiseTool
tileRawChannelBuilderFit.RunType = _runTypes[runType]
tileRawChannelBuilderFit.calibrateEnergy = flags.Tile.calibrateEnergy
tileRawChannelBuilderFit.correctTime = flags.Tile.correctTime
tileRawChannelBuilderFit.FrameLength = 7
tileRawChannelBuilderFit.TileRawChannelContainer = 'TileRawChannelFit'
if flags.Tile.correctTime:
from TileConditions.TileTimingConfig import TileCondToolTimingCfg
timingTool = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
tileRawChannelBuilderFit.TileCondToolTiming = timingTool
tileRawChannelContainerDSP = ""
if flags.Tile.NoiseFilter == 1:
from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionToolsCfg
correctionTools = acc.popToolsAndMerge( TileRawChannelCorrectionToolsCfg(flags) )
tileRawChannelBuilderFit.NoiseFilterTools = correctionTools
if not (flags.Input.isMC or flags.Overlay.DataOverlay):
tileRawChannelContainerDSP = 'TileRawChannelCntCorrected'
from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
acc.merge( TileRawChannelCorrectionAlgCfg(flags) )
tileRawChannelBuilderFit.DSPContainer = tileRawChannelContainerDSP
acc.setPrivateTools( tileRawChannelBuilderFit )
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = 1
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaCommon.Logging import log
from AthenaCommon.Constants import DEBUG
# Test setup
log.setLevel(DEBUG)
ConfigFlags.Input.Files = defaultTestFiles.RAW
ConfigFlags.Tile.RunType = 'PHY'
ConfigFlags.Tile.NoiseFilter = 1
ConfigFlags.lock()
ConfigFlags.dump()
acc = ComponentAccumulator()
print( acc.popToolsAndMerge( TileRawChannelBuilderFitFilterCfg(ConfigFlags) ) )
acc.printConfig(withDetails = True, summariseProps = True)
acc.store( open('TileRawChannelBuilderFit.pkl','w') )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""Define methods to construct configured Tile raw channel builder tools using Optimal Filtering methods"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
_runTypes = {'PHY' : 1, 'LAS' : 2, 'BILAS' : 2, 'PED' : 4, 'CIS' : 8, 'MONOCIS' : 8}
def TileRawChannelBuilderOpt2FilterCfg(flags, **kwargs):
"""Return component accumulator with configured private Tile raw channel builder tool (Opt2)
Arguments:
flags -- Athena configuration flags (ConfigFlags)
Method -- flavour of Tile Optimal Filtering method. Defaults to Opt2. Possible values: Opt2, OptATLAS, OF1
"""
acc = ComponentAccumulator()
method = kwargs.get('Method', 'Opt2')
if method not in ['Opt2', 'OptATLAS', 'OF1']:
raise(Exception("Invalid Tile Optimal Filtering method: %s" % method))
name = 'TileRawChannelBuilder' + method
runType = flags.Tile.RunType
runType = runType.upper()
if runType not in _runTypes.keys():
raise(Exception("Invalid Tile run type: %s" % runType))
from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
acc.merge( TileDQstatusAlgCfg(flags) )
from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
acc.merge( TileInfoLoaderCfg(flags) )
from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
tileRawChannelBuilderOpt = TileRawChannelBuilderOpt2Filter(name)
if flags.Tile.OfcFromCOOL:
ofcType = 'OF2' if method != 'OF1' else 'OF1'
from TileConditions.TileOFCConfig import TileCondToolOfcCoolCfg
ofcTool = acc.popToolsAndMerge( TileCondToolOfcCoolCfg(flags, OfcType = ofcType) )
else:
from TileConditions.TileOFCConfig import TileCondToolOfcCfg
ofcTool = acc.popToolsAndMerge( TileCondToolOfcCfg(flags) )
tileRawChannelBuilderOpt.TileCondToolOfc = ofcTool
outputContainer = 'TileRawChannel' + {'OptATLAS':flags.Tile.RawChannelContainer}.get(method, method)
tileRawChannelBuilderOpt.TileRawChannelContainer = outputContainer
tileRawChannelBuilderOpt.RunType = _runTypes[runType]
tileRawChannelBuilderOpt.calibrateEnergy = False
tileRawChannelBuilderOpt.BestPhase = False if method == 'Opt2' else flags.Tile.BestPhaseFromCOOL
tileRawChannelBuilderOpt.OF2 = True if method != 'OF1' else False
tileRawChannelBuilderOpt.MaxIterations = 5 if method == 'Opt2' else 1
tileRawChannelBuilderOpt.Minus1Iteration = True if method == 'Opt2' else False
tileRawChannelBuilderOpt.AmplitudeCorrection = False if method == 'Opt2' else flags.Tile.correctAmplitude
tileRawChannelBuilderOpt.TimeCorrection = False if method != 'OptATLAS' else flags.Tile.correctTimeNI
tileRawChannelBuilderOpt.AmpMinForAmpCorrection = flags.Tile.AmpMinForAmpCorrection
tileRawChannelBuilderOpt.TimeMinForAmpCorrection = flags.Tile.TimeMinForAmpCorrection
tileRawChannelBuilderOpt.TimeMaxForAmpCorrection = flags.Tile.TimeMaxForAmpCorrection
if (flags.Tile.BestPhaseFromCOOL and method != 'Opt2') or flags.Tile.correctTime:
from TileConditions.TileTimingConfig import TileCondToolTimingCfg
timingTool = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
tileRawChannelBuilderOpt.TileCondToolTiming = timingTool
if flags.Tile.BestPhaseFromCOOL and method != 'Opt2':
# Can't correct time and use best phase at the same time without iteration
tileRawChannelBuilderOpt.correctTime = False
else:
tileRawChannelBuilderOpt.correctTime = flags.Tile.correctTime
if method == 'OF1':
tileRawChannelBuilderOpt.PedestalMode = -1
tileRawChannelContainerDSP = ""
if flags.Tile.NoiseFilter == 1:
from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionToolsCfg
correctionTools = acc.popToolsAndMerge( TileRawChannelCorrectionToolsCfg(flags) )
tileRawChannelBuilderOpt.NoiseFilterTools = correctionTools
if not (flags.Input.isMC or flags.Overlay.DataOverlay):
tileRawChannelContainerDSP = 'TileRawChannelCntCorrected'
from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
acc.merge( TileRawChannelCorrectionAlgCfg(flags) )
tileRawChannelBuilderOpt.DSPContainer = tileRawChannelContainerDSP
acc.setPrivateTools( tileRawChannelBuilderOpt )
return acc
def TileRawChannelBuilderOF1Cfg(flags):
return TileRawChannelBuilderOpt2FilterCfg(flags, Method = 'OF1')
def TileRawChannelBuilderOpt2Cfg(flags):
return TileRawChannelBuilderOpt2FilterCfg(flags, Method = 'Opt2')
def TileRawChannelBuilderOptATLASCfg(flags):
return TileRawChannelBuilderOpt2FilterCfg(flags, Method = 'OptATLAS')
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = 1
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaCommon.Logging import log
from AthenaCommon.Constants import DEBUG
# Test setup
log.setLevel(DEBUG)
ConfigFlags.Input.Files = defaultTestFiles.RAW
ConfigFlags.Tile.RunType = 'PHY'
ConfigFlags.Tile.NoiseFilter = 1
ConfigFlags.lock()
ConfigFlags.dump()
acc = ComponentAccumulator()
print( acc.popToolsAndMerge( TileRawChannelBuilderOpt2Cfg(ConfigFlags) ) )
print( acc.popToolsAndMerge( TileRawChannelBuilderOptATLASCfg(ConfigFlags) ) )
print( acc.popToolsAndMerge( TileRawChannelBuilderOF1Cfg(ConfigFlags) ) )
acc.printConfig(withDetails = True, summariseProps = True)
acc.store( open('TileRawChannelBuilder.pkl','w') )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""Define method to construct configured Tile raw channel maker algorithm"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
def TileRawChannelMakerCfg(flags, **kwargs):
"""Return component accumulator with configured Tile raw channel maker algorithm
Arguments:
flags -- Athena configuration flags (ConfigFlags)
"""
acc = ComponentAccumulator()
from AthenaCommon.Logging import logging
mlog = logging.getLogger( 'TileRawChannelMakerCfg' )
from TileRecUtils.TileRecUtilsConf import TileRawChannelMaker
tileRawChannelMaker = TileRawChannelMaker("TileRChMaker")
if flags.Tile.doOverflowFit or flags.Tile.doFit:
from TileRecUtils.TileRawChannelBuilderFitConfig import TileRawChannelBuilderFitFilterCfg
tileRawChannelBuilderFitFilter = acc.popToolsAndMerge( TileRawChannelBuilderFitFilterCfg(flags) )
if flags.Tile.doOverflowFit:
tileRawChannelMaker.FitOverflow = True
tileRawChannelMaker.TileRawChannelBuilderFitOverflow = tileRawChannelBuilderFitFilter
else:
tileRawChannelMaker.FitOverflow = False
if flags.Tile.doFit:
tileRawChannelMaker.TileRawChannelBuilder += [tileRawChannelBuilderFitFilter]
mlog.info(" adding now TileRawChannelBuilderFitFilter with name %s to the algorithm: %s",
tileRawChannelBuilderFitFilter.name(), tileRawChannelMaker.name())
if flags.Tile.doOF1:
from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOF1Cfg
tileRawChannelBuilderOF1 = acc.popToolsAndMerge( TileRawChannelBuilderOF1Cfg(flags) )
tileRawChannelMaker.TileRawChannelBuilder += [tileRawChannelBuilderOF1]
mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
tileRawChannelBuilderOF1.name(), tileRawChannelMaker.name())
if flags.Tile.doOpt2:
from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOpt2Cfg
tileRawChannelBuilderOpt2 = acc.popToolsAndMerge( TileRawChannelBuilderOpt2Cfg(flags) )
tileRawChannelMaker.TileRawChannelBuilder += [tileRawChannelBuilderOpt2]
mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
tileRawChannelBuilderOpt2.name(), tileRawChannelMaker.name())
if flags.Tile.doOptATLAS:
from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOptATLASCfg
tileRawChannelBuilderOptATLAS = acc.popToolsAndMerge( TileRawChannelBuilderOptATLASCfg(flags) )
tileRawChannelMaker.TileRawChannelBuilder += [tileRawChannelBuilderOptATLAS]
mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
tileRawChannelBuilderOptATLAS.name(), tileRawChannelMaker.name())
acc.addEventAlgo(tileRawChannelMaker, primary = True)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = 1
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaCommon.Logging import log
from AthenaCommon.Constants import DEBUG
# Test setup
log.setLevel(DEBUG)
ConfigFlags.Input.Files = defaultTestFiles.RAW
ConfigFlags.Tile.RunType = 'PHY'
ConfigFlags.Tile.doFit = True
ConfigFlags.Tile.doOF1 = True
ConfigFlags.Tile.doOpt2 = True
ConfigFlags.Tile.doOptATLAS = True
ConfigFlags.Tile.NoiseFilter = 1
ConfigFlags.lock()
from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg
acc = MainServicesSerialCfg()
from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg
acc.merge( TrigBSReadCfg(ConfigFlags) )
acc.getService('ByteStreamAddressProviderSvc').TypeNames += ['TileDigitsContainer/TileDigitsCnt']
acc.merge( TileRawChannelMakerCfg(ConfigFlags) )
ConfigFlags.dump()
acc.printConfig(withDetails = True, summariseProps = True)
acc.store( open('TileRawChannelMaker.pkl','w') )
sc = acc.run(maxEvents = 3)
import sys
# Success should be 0
sys.exit(not sc.isSuccess())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment