ATLAS Offline Software
Loading...
Searching...
No Matches
LArConditionsTestConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentFactory import CompFactory
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.MainServicesConfig import MainServicesCfg
5from Campaigns.Utils import Campaign
6import sys
7from pathlib import Path
8
10 #Get basic services and cond-algos
11 result=ComponentAccumulator()
12 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
13 result.merge(LArGMCfg(flags))
14
15 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg, LArCalibIdMappingCfg
16 result.merge(LArOnOffIdMappingCfg(flags))
17 result.merge(LArCalibIdMappingCfg(flags))
18
19
20 LArConditionsTestAlg=CompFactory.LArConditionsTestAlg()
21 LArConditionsTestAlg.OutputLevel = 2
22 LArConditionsTestAlg.TestCondObjs = True
23 LArConditionsTestAlg.ApplyCorrections = True
24 if (flags.LArCondTest.Step==2):
25 #Reading case:
26 LArConditionsTestAlg.ReadCondObjs = True
27 LArConditionsTestAlg.WriteCondObjs = False
28 LArConditionsTestAlg.WriteCorrections = False
29 else:
30 #Writing case:
31 LArConditionsTestAlg.ReadCondObjs = False
32 LArConditionsTestAlg.WriteCondObjs = True
33 LArConditionsTestAlg.WriteCorrections = True
34 result.addEventAlgo(LArConditionsTestAlg)
35
36 if (flags.LArCondTest.Step==1):
37 #Write to pool.root file
38 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
39 result.merge(OutputConditionsAlgCfg(flags,
40 outputFile="LarCondTestNoReg.root",
41 ObjectList=["LArRampMC#/LArCalorimeter/LArTests/LArRampsSingleGroup",
42 "LArRampMC#/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping",
43 "LArRampMC#/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping" ],
44 IOVTagList=["mytag"],
45 Run1=3,
46 Run2=9999,
47 WriteIOV=False
48 ))
49 elif (flags.LArCondTest.Step==2):
50 #Read the pool-root file
51 from EventSelectorAthenaPool.CondProxyProviderConfig import CondProxyProviderCfg
52 result.merge(CondProxyProviderCfg(flags,"LarCondTestNoReg.root"))
53
54
55
56 return result
57
58if __name__ == "__main__":
59 from AthenaConfiguration.AllConfigFlags import initConfigFlags
60 from AthenaConfiguration.TestDefaults import defaultGeometryTags
61 flags=initConfigFlags()
62 flags.addFlag("LArCondTest.Step",1)
63 #Set a few flags to avoid input-file peeking (there is no input)
64 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
65 flags.Input.isMC=True
66 flags.IOVDb.GlobalTag="OFLCOND-CSC-00-01-00"
67 flags.Input.Files=[]
68 flags.Input.TypedCollections=[]
69 flags.Input.MCCampaign=Campaign.Unknown
70 flags.fillFromArgs()
71 flags.lock()
72 cfg=MainServicesCfg(flags)
73 cfg.merge(LArConditionsTestCfg(flags))
74
75 msgsvc=cfg.getService("MessageSvc")
76 msgsvc.debugLimit=100000
77 #Force old msg format so that output comparison succeeds
78 msgsvc.Format='% F%18W%S%7W%R%T %0W%M'
79
80 poolSvc=cfg.getService("PoolSvc")
81 poolSvc.WriteCatalog=f"file:Catalog{flags.LArCondTest.Step}.xml"
82
83 # remove catalog on re-run to help with incremental testing
84 catalogFile = Path(f"Catalog{flags.LArCondTest.Step}.xml")
85 if catalogFile.exists():
86 catalogFile.unlink()
87
88 sys.exit(cfg.run(1).isFailure())