ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
python
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.Files = []
121
flags.Input.RunNumbers = [284500]
122
flags.Input.TimeStamps = [1]
# dummy value
123
flags.Input.TypedCollections = []
# workaround for building xAOD::EventInfo without input files
124
flags.Exec.MaxEvents = 20
125
flags.Scheduler.ShowControlFlow =
True
126
flags.Scheduler.ShowDataDeps =
True
127
flags.fillFromArgs()
128
flags.lock()
129
130
# Setup logging
131
from
AthenaCommon.Logging
import
log
132
log.setLevel(flags.Exec.OutputLevel)
133
134
# This example should run only in the multithreaded mode
135
if
flags.Concurrency.NumThreads < 1:
136
log.fatal(
'The number of threads must be >0. Did you set the --threads=N option?'
)
137
sys.exit(1)
138
139
# The example runs with no input file. We configure it with the McEventSelector
140
cfg = MainEvgenServicesCfg(flags,withSequences=
True
)
141
142
# Configure all algorithms used by the example
143
cfg.merge(
HiveAlgAConf
(flags))
144
cfg.merge(
HiveAlgBConf
(flags))
145
cfg.merge(
HiveAlgCConf
(flags))
146
cfg.merge(
HiveAlgDConf
(flags))
147
cfg.merge(
HiveAlgEConf
(flags))
148
cfg.merge(
HiveAlgFConf
(flags))
149
cfg.merge(
HiveAlgGConf
(flags))
150
cfg.merge(
HiveAlgVConf
(flags))
151
152
# Configure ThreadPoolSvc
153
cfg.merge(
ThreadPoolSvcCfg
(flags))
154
155
# Run the example
156
sys.exit(cfg.run().isFailure())
AthExHiveConfig.HiveAlgGConf
HiveAlgGConf(flags)
Definition
AthExHiveConfig.py:78
AthExHiveConfig.HiveAlgEConf
HiveAlgEConf(flags)
Definition
AthExHiveConfig.py:57
AthExHiveConfig.HiveAlgCConf
HiveAlgCConf(flags)
Definition
AthExHiveConfig.py:36
AthExHiveConfig.HiveAlgDConf
HiveAlgDConf(flags)
Definition
AthExHiveConfig.py:47
AthExHiveConfig.HiveAlgVConf
HiveAlgVConf(flags)
Definition
AthExHiveConfig.py:88
AthExHiveConfig.HiveAlgFConf
HiveAlgFConf(flags)
Definition
AthExHiveConfig.py:68
AthExHiveConfig.HiveAlgAConf
HiveAlgAConf(flags)
Definition
AthExHiveConfig.py:11
AthExHiveConfig.ThreadPoolSvcCfg
ThreadPoolSvcCfg(flags)
Definition
AthExHiveConfig.py:102
AthExHiveConfig.HiveAlgBConf
HiveAlgBConf(flags)
Definition
AthExHiveConfig.py:26
Constants
Generated on
for ATLAS Offline Software by
1.17.0