ATLAS Offline Software
LArConditionsTestConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentFactory import CompFactory
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
5 from Campaigns.Utils import Campaign
6 import sys
7 from 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 
58 if __name__ == "__main__":
59  from AthenaConfiguration.AllConfigFlags import initConfigFlags
60  from AthenaConfiguration.TestDefaults import defaultGeometryTags
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.TypedCollections=[]
68  flags.Input.MCCampaign=Campaign.Unknown
69  flags.fillFromArgs()
70  flags.lock()
71  cfg=MainServicesCfg(flags)
72  cfg.merge(LArConditionsTestCfg(flags))
73 
74  msgsvc=cfg.getService("MessageSvc")
75  msgsvc.debugLimit=100000
76  #Force old msg format so that output comparison succeeds
77  msgsvc.Format='% F%18W%S%7W%R%T %0W%M'
78 
79  poolSvc=cfg.getService("PoolSvc")
80  poolSvc.WriteCatalog=f"file:Catalog{flags.LArCondTest.Step}.xml"
81 
82  # remove catalog on re-run to help with incremental testing
83  catalogFile = Path(f"Catalog{flags.LArCondTest.Step}.xml")
84  if catalogFile.exists():
85  catalogFile.unlink()
86 
87  sys.exit(cfg.run(1).isFailure())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
LArConditionsTestConfig.LArConditionsTestCfg
def LArConditionsTestCfg(flags)
Definition: LArConditionsTestConfig.py:9
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.CondProxyProviderConfig.CondProxyProviderCfg
def CondProxyProviderCfg(flags, poolFiles)
Definition: CondProxyProviderConfig.py:11
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83