Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CondAlgsConfig.py
Go to the documentation of this file.
1 #!/usr/bin/env athena.py
2 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaCommon.Constants import DEBUG
7 
8 import sys
9 
10 # --------------------------------------------------------------------
11 # Configure ASCIICondDbSvc
12 
13 def ASCIICondDbSvcConf(flags,name="ASCIICondDbSvc",**kwargs):
14  import os
15  from AthenaCommon.Logging import log
16  log.setLevel(flags.Exec.OutputLevel)
17 
18  condDbFile = "condDb.txt"
19  found = 0
20  for dir in (".:"+os.environ.get('DATAPATH')).split (':'):
21  cdb = os.path.join(dir,condDbFile)
22  if (os.path.isfile( cdb ) ) :
23  found = 1
24  break
25 
26  if (found == 0):
27  log.fatal('ASCII condDb file \"' + condDbFile + '\" not found')
28  sys.exit(1)
29  else:
30  log.info('using ASCIICondDb file from ' + cdb)
31 
32  kwargs.setdefault("CondFile",cdb)
33  result = ComponentAccumulator()
34  svc = CompFactory.ASCIICondDbSvc(name,**kwargs)
35  result.addService(svc)
36  return result
37 
38 if __name__ == "__main__":
39  # Setup configuration flags
40  from AthenaConfiguration.AllConfigFlags import initConfigFlags
41  flags = initConfigFlags()
42  flags.Input.RunNumbers = [1]
43  flags.Input.TypedCollections = [] # workaround for building xAOD::EventInfo without input files
44  flags.Exec.MaxEvents = 20
45  flags.Scheduler.ShowControlFlow = True
46  flags.Scheduler.ShowDataDeps = True
47  flags.fillFromArgs()
48  flags.lock()
49 
50  # Setup logging
51  from AthenaCommon.Logging import log
52  log.setLevel(flags.Exec.OutputLevel)
53 
54  # This example should run only in the multithreaded mode
55  if flags.Concurrency.NumThreads < 1:
56  log.fatal('The number of threads must be >0. Did you set the --threads=N option?')
57  sys.exit(1)
58 
59  # The example runs with no input file. We configure it with the McEventSelector
60  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
61  cfg = MainServicesCfg(flags)
62  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
63  cfg.merge(McEventSelectorCfg(flags,
64  RunNumber=1,
65  FirstEvent=1,
66  InitialTimeStamp=0,
67  TimeStampInterval=1,
68  FirstLB=1))
69 
70  # Configure all algorithms used by the example
71  # xAOD::EventInfo converter (because it is required by some algorithms in this example)
72  from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
73  cfg.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True), sequenceName="AthAlgSeq")
74  # Event algorithms
75  cfg.addEventAlgo(CompFactory.AlgA(name="AlgA",OutputLevel=DEBUG))
76  cfg.addEventAlgo(CompFactory.AlgB(name="AlgB",OutputLevel=DEBUG,Key_R1="a1",Key_W1="a3"))
77  cfg.addEventAlgo(CompFactory.AlgC(name="AlgC1",OutputLevel=DEBUG,Key_R1="a2",Key_CH="X1"))
78  cfg.addEventAlgo(CompFactory.AlgC(name="AlgC2",OutputLevel=DEBUG,Key_R1="a1",Key_CH="X2"))
79  cfg.addEventAlgo(CompFactory.AlgD(name="AlgD1",OutputLevel=DEBUG,Key_R1="a3", Key_CH1="X1", Key_CH2="X2"))
80  # Condition algorithms
81  cfg.addCondAlgo(CompFactory.CondAlgX(name="CondAlgX1",OutputLevel=DEBUG,Key_CH="X1",Key_DB="X1"))
82  cfg.addCondAlgo(CompFactory.CondAlgX(name="CondAlgX2",OutputLevel=DEBUG,Key_CH="X2",Key_DB="X2"))
83  cfg.addCondAlgo(CompFactory.CondAlgY(name="CondAlgY1",OutputLevel=DEBUG,Key_CH1="Y1",Key_CH2="Y2",Key_DB1="Y1",Key_DB2="Y2"))
84 
85  # Configure ASCIICondDbSvc
86  cfg.merge(ASCIICondDbSvcConf(flags,OutputLevel=DEBUG))
87 
88  # Run the example
89  sys.exit(cfg.run().isFailure())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CondAlgsConfig.ASCIICondDbSvcConf
def ASCIICondDbSvcConf(flags, name="ASCIICondDbSvc", **kwargs)
Definition: CondAlgsConfig.py:13
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:262
Constants
some useful constants -------------------------------------------------—
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11