Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AthExHiveConfig.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 # --------------------------------------------------------------------
9 # Configure HiveAlgX-s. X in (A,B,C,D,E,F,G,V)
10 
11 def HiveAlgAConf(flags):
12  result = ComponentAccumulator()
13 
14  # HiveAlgA has input dependency on xAOD::EventInfo
15  # Hence we need to add the EventInfo converter algorithm
16  from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
17  result.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True), sequenceName="AthAlgSeq")
18 
19  alg = CompFactory.HiveAlgA("HiveAlgA",
20  OutputLevel=DEBUG,
21  Time=20,
22  Cardinality=flags.Concurrency.NumThreads)
23  result.addEventAlgo(alg)
24  return result
25 
26 def HiveAlgBConf(flags):
27  result = ComponentAccumulator()
28 
29  alg = CompFactory.HiveAlgB("HiveAlgB",
30  OutputLevel=DEBUG,
31  Time=10,
32  Cardinality=flags.Concurrency.NumThreads)
33  result.addEventAlgo(alg)
34  return result
35 
36 def HiveAlgCConf(flags):
37  result = ComponentAccumulator()
38 
39  alg = CompFactory.HiveAlgC("HiveAlgC",
40  OutputLevel=DEBUG,
41  Time=190,
42  Key_W1="C1",
43  Cardinality=flags.Concurrency.NumThreads)
44  result.addEventAlgo(alg)
45  return result
46 
47 def HiveAlgDConf(flags):
48  result = ComponentAccumulator()
49 
50  alg = CompFactory.HiveAlgD("HiveAlgD",
51  OutputLevel=DEBUG,
52  Time=10,
53  Cardinality=flags.Concurrency.NumThreads)
54  result.addEventAlgo(alg)
55  return result
56 
57 def HiveAlgEConf(flags):
58  result = ComponentAccumulator()
59 
60  alg = CompFactory.HiveAlgE("HiveAlgE",
61  OutputLevel=DEBUG,
62  Time=30,
63  Key_R1="C1",
64  Cardinality=flags.Concurrency.NumThreads)
65  result.addEventAlgo(alg)
66  return result
67 
68 def HiveAlgFConf(flags):
69  result = ComponentAccumulator()
70 
71  alg = CompFactory.HiveAlgF("HiveAlgF",
72  OutputLevel=DEBUG,
73  Time=30,
74  Cardinality=flags.Concurrency.NumThreads)
75  result.addEventAlgo(alg)
76  return result
77 
78 def HiveAlgGConf(flags):
79  result = ComponentAccumulator()
80 
81  alg = CompFactory.HiveAlgG("HiveAlgG",
82  OutputLevel=DEBUG,
83  Time=10,
84  Cardinality=flags.Concurrency.NumThreads)
85  result.addEventAlgo(alg)
86  return result
87 
88 def HiveAlgVConf(flags):
89  result = ComponentAccumulator()
90 
91  alg = CompFactory.HiveAlgV("HiveAlgV",
92  OutputLevel=DEBUG,
93  Time=30,
94  Key_RV = [ "a1", "a2", "d1", "e1", "C1" ],
95  Key_WV = [ "V1", "V2", "V3" ],
96  Cardinality=flags.Concurrency.NumThreads)
97  result.addEventAlgo(alg)
98  return result
99 # --------------------------------------------------------------------
100 
101 # Configure ThreadPoolSvc
102 def ThreadPoolSvcCfg(flags):
103  result = ComponentAccumulator()
104 
105  svc = CompFactory.ThreadPoolSvc(name="ThreadPoolSvc")
106  svc.ThreadInitTools += [CompFactory.ThreadInitTool()]
107 
108  result.addService(svc)
109  return result
110 
111 # _______________ main _______________
112 if __name__ == "__main__":
113  import sys
114 
115  from AthenaConfiguration.MainServicesConfig import MainEvgenServicesCfg
116 
117  # Setup configuration flags
118  from AthenaConfiguration.AllConfigFlags import initConfigFlags
119  flags = initConfigFlags()
120  flags.Input.RunNumbers = [284500]
121  flags.Input.TimeStamps = [1] # dummy value
122  flags.Input.TypedCollections = [] # workaround for building xAOD::EventInfo without input files
123  flags.Exec.MaxEvents = 20
124  flags.Scheduler.ShowControlFlow = True
125  flags.Scheduler.ShowDataDeps = True
126  flags.fillFromArgs()
127  flags.lock()
128 
129  # Setup logging
130  from AthenaCommon.Logging import log
131  log.setLevel(flags.Exec.OutputLevel)
132 
133  # This example should run only in the multithreaded mode
134  if flags.Concurrency.NumThreads < 1:
135  log.fatal('The number of threads must be >0. Did you set the --threads=N option?')
136  sys.exit(1)
137 
138  # The example runs with no input file. We configure it with the McEventSelector
139  cfg = MainEvgenServicesCfg(flags,withSequences=True)
140 
141  # Configure all algorithms used by the example
142  cfg.merge(HiveAlgAConf(flags))
143  cfg.merge(HiveAlgBConf(flags))
144  cfg.merge(HiveAlgCConf(flags))
145  cfg.merge(HiveAlgDConf(flags))
146  cfg.merge(HiveAlgEConf(flags))
147  cfg.merge(HiveAlgFConf(flags))
148  cfg.merge(HiveAlgGConf(flags))
149  cfg.merge(HiveAlgVConf(flags))
150 
151  # Configure ThreadPoolSvc
152  cfg.merge(ThreadPoolSvcCfg(flags))
153 
154  # Run the example
155  sys.exit(cfg.run().isFailure())
AthExHiveConfig.HiveAlgFConf
def HiveAlgFConf(flags)
Definition: AthExHiveConfig.py:68
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
AthExHiveConfig.HiveAlgDConf
def HiveAlgDConf(flags)
Definition: AthExHiveConfig.py:47
AthExHiveConfig.HiveAlgEConf
def HiveAlgEConf(flags)
Definition: AthExHiveConfig.py:57
python.MainServicesConfig.MainEvgenServicesCfg
def MainEvgenServicesCfg(flags, LoopMgr="AthenaEventLoopMgr", withSequences=True)
Definition: MainServicesConfig.py:353
Constants
some useful constants -------------------------------------------------—
AthExHiveConfig.HiveAlgVConf
def HiveAlgVConf(flags)
Definition: AthExHiveConfig.py:88
AthExHiveConfig.HiveAlgGConf
def HiveAlgGConf(flags)
Definition: AthExHiveConfig.py:78
AthExHiveConfig.HiveAlgBConf
def HiveAlgBConf(flags)
Definition: AthExHiveConfig.py:26
AthExHiveConfig.HiveAlgAConf
def HiveAlgAConf(flags)
Definition: AthExHiveConfig.py:11
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
AthExHiveConfig.ThreadPoolSvcCfg
def ThreadPoolSvcCfg(flags)
Definition: AthExHiveConfig.py:102
AthExHiveConfig.HiveAlgCConf
def HiveAlgCConf(flags)
Definition: AthExHiveConfig.py:36