Skip to content
Snippets Groups Projects
Commit 0e597a29 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'main-tile-rch-builder-test-cfg' into 'main'

TileRecUtils: Migrate Tile raw channel builder test to CA-based configuration (ATLASRECTS-7898)

See merge request atlas/athena!68925
parents e257fba4 fbe041ca
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( TileRecUtils )
......@@ -49,9 +49,9 @@ atlas_add_test( TileCellBuilderFromHit_test
LOG_IGNORE_PATTERN "LArDetectorToolNV|is still valid|no data retrieved|Database being retired|Reading file|Unable to locate catalog|Resolved path|DigitizationFlags|^Domain|created CondCont|no dictionary for class|^ +[+]|Reading LArPedestalMC|IOV callback|^DetectorStore|TileDetectorTool|Creating TileCondProxyFile|Cache alignment|IncrementalExecutor::executeFunction|You are probably missing the definition|Maybe you need to load|No RecFlags available|MetaReader|AutoConfiguration|IOVDbSvc +INFO" )
atlas_add_test( TileRawChannelBuilder_test
SCRIPT test/TileRawChannelBuilder_test.sh
PROPERTIES TIMEOUT 600
LOG_IGNORE_PATTERN ${extra_patterns} )
SCRIPT test/TileRawChannelBuilder_test.sh
PROPERTIES TIMEOUT 600
POST_EXEC_SCRIPT noerror.sh)
atlas_add_test( TileDQstatusAlg_test
SCRIPT test/TileDQstatusAlg_test.sh
......
#
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
#
# File: TileRecUtils/share/TileRawChannelBuilder_test.py
# File: TileRecUtils/python/TileRawChannelBuilderTestConfig.py
# Author: sss
# Date: Aug, 2018
# Brief: Test for TileRawChannelBuilder.
......@@ -11,41 +11,9 @@
import ROOT
ROOT.TH1F
from AthenaCommon.DetFlags import DetFlags
DetFlags.detdescr.Tile_setOn()
DetFlags.detdescr.LAr_setOn()
RunNumber = 284500
import sys
import string
import ROOT
import math
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
from AtlasGeoModel import SetupRecoGeometry
include('TileConditions/TileConditions_jobOptions.py')
# Disable Geant version checking.
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
condSeq.TileSamplingFractionCondAlg.G4Version = -1
from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
ServiceMgr += GeoModelSvc()
theApp.CreateSvc += [ "GeoModelSvc"]
from AtlasGeoModel import TileGM
from AtlasGeoModel import LArGM #LAr needed to get MBTS DD.
from IOVDbSvc.IOVDbSvcConf import IOVDbSvc
IOVDbSvc().GlobalTag = 'OFLCOND-RUN12-SDR-35'
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
theApp.EvtMax=4
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from TileConfiguration.TileConfigFlags import TileRunType
def reldiff (a, b):
den = abs(a)+abs(b)
......@@ -166,7 +134,7 @@ exp_chans_2 = exp_merge (exp_chans_0, {
(1, 1, 0, 2, 0, 1) : [ 41.0, 0.1, 2.5, 46.5],
(1, 1, 0, 2, 1, 1) : [ 0.6, 12.9, 4.7, 43.9],
})
# Noise filter+dsp
exp_chans_3 = exp_merge (exp_chans_0, {
......@@ -177,7 +145,7 @@ exp_chans_3 = exp_merge (exp_chans_0, {
(1, 1, 0, 2, 0, 0) : [ 30.525, -0.4, 2.0, 120033.180],
(1, 1, 0, 2, 1, 1) : [ 1.325, 12.9, 4.7, 43.175],
})
# TileFragHash::TYPE
......@@ -225,7 +193,7 @@ class PrepareDataAlg (Alg):
return StatusCode.Success
def make_rc (self, digits):
idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
......@@ -249,7 +217,7 @@ class PrepareDataAlg (Alg):
coll = ROOT.TileRawChannelCollection (hashFunc.identifier(icoll))
for addr, data in colldata:
if type(addr) == type(()):
if isinstance(addr, tuple):
adc_id = idHelper.adc_id (*addr)
chan = ROOT.TileRawChannel (adc_id, *data)
else:
......@@ -311,8 +279,6 @@ class TestAlg (Alg):
if iev == 3:
return StatusCode.Success
dspcolls = set()
tool = self.tool1
exp_chans = exp_chans_0
......@@ -381,7 +347,7 @@ class TestAlg (Alg):
coll = ROOT.TileDigitsCollection (hashFunc.identifier(icoll))
for addr, data in colldata:
if type(addr) == type(()):
if isinstance(addr, tuple):
adc_id = idHelper.adc_id (*addr)
chan = ROOT.TileDigits (adc_id, TestAlg.make_vec (data))
else:
......@@ -440,25 +406,70 @@ class TestAlg (Alg):
#########################################################################
def TileRawChannelBuilderTestCfg(flags):
acc = ComponentAccumulator()
from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
acc.merge( TileInfoLoaderCfg(flags) )
from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
acc.merge( TileEMScaleCondAlgCfg(flags) )
from TileConditions.TileSampleNoiseConfig import TileSampleNoiseCondAlgCfg
acc.merge( TileSampleNoiseCondAlgCfg(flags) )
TileRawChannelBuilderTest = CompFactory.TileRawChannelBuilderTest
acc.addPublicTool( TileRawChannelBuilderTest('tool1') )
TileRawChannelNoiseFilter = CompFactory.TileRawChannelNoiseFilter
noisefilter = TileRawChannelNoiseFilter('noisefilter')
acc.addPublicTool( TileRawChannelBuilderTest('tool2', NoiseFilterTools=[noisefilter]) )
acc.addEventAlgo( PrepareDataAlg('prepalg1') )
from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
acc.merge(TileDQstatusAlgCfg(flags, name='dqstat1',
TileRawChannelContainer='TRCDQ'))
acc.addEventAlgo( TestAlg('testalg1') )
return acc
if __name__ == "__main__":
from AthenaConfiguration.AllConfigFlags import initConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaCommon.Logging import log
from AthenaCommon.Constants import INFO
# Test setup
log.setLevel(INFO)
from TileRecUtils.TileRecUtilsConf import \
TileRawChannelBuilderTest, TileRawChannelNoiseFilter, \
TileDQstatusAlg
noisefilter = TileRawChannelNoiseFilter ('noisefilter')
flags = initConfigFlags()
flags.Input.Files = defaultTestFiles.ESD
flags.Tile.RunType = TileRunType.PHY
flags.Exec.MaxEvents = 4
flags.fillFromArgs()
ToolSvc += TileRawChannelBuilderTest ('tool1')
ToolSvc += TileRawChannelBuilderTest ('tool2', NoiseFilterTools = [noisefilter])
flags.lock()
from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg
topSequence += xAODMaker__EventInfoCnvAlg ()
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
cfg = MainServicesCfg(flags)
prepalg1 = PrepareDataAlg ('prepalg1')
topSequence += prepalg1
# Configure reading POOL files
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
cfg.merge(PoolReadCfg(flags))
dqstat1 = TileDQstatusAlg ('dqstat1', TileRawChannelContainer = 'TRCDQ')
topSequence += dqstat1
cfg.merge( TileRawChannelBuilderTestCfg(flags) )
testalg1 = TestAlg ('testalg1')
topSequence += testalg1
flags.dump()
cfg.printConfig(withDetails=True)
cfg.store( open('TileRawChannelBuilderTest.pkl', 'wb') )
sc = cfg.run()
import sys
# Success should be 0
sys.exit(not sc.isSuccess())
This diff is collapsed.
#!/bin/bash
#
# Script running the TileRawChannelBuilder_test.py test with CTest.
# Script running the TileRawChannelBuilderTestConfig.py test with CTest.
#
# Run the job:
athena.py TileRecUtils/TileRawChannelBuilder_test.py
python -m TileRecUtils.TileRawChannelBuilderTestConfig
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