4def EventDisplaysOnlineCfg(flags, **kwargs):
5 from EventDisplaysOnline.EventDisplaysOnlineHelpers import GetBFields, WaitForPartition, GetUniqueJobID, GetRunNumber, Ready4Physics
6
7 from AthenaCommon.Logging import logging
8 mlog = logging.getLogger( 'EventDisplaysOnlineCfg' )
9
10 if not flags.OnlineEventDisplays.OfflineTest:
11 from AthenaConfiguration.AutoConfigOnlineRecoFlags import autoConfigOnlineRecoFlags
12 autoConfigOnlineRecoFlags(flags, flags.OnlineEventDisplays.PartitionName)
13 flags.OnlineEventDisplays.Ready4PhysicsAtStart=Ready4Physics()
14
15
16
17 flags.OnlineEventDisplays.TriggerStreams = ['MinBias','express','ZeroBias','CosmicCalo','IDCosmic','CosmicMuons','Background','Standby','L1Calo','Main']
18 if flags.OnlineEventDisplays.BeamSplashMode:
19 flags.OnlineEventDisplays.TriggerStreams = ['MinBias']
20
21
22 flags.OnlineEventDisplays.OutputDirectory = "/atlas/EventDisplayEvents/"
23
24 if flags.OnlineEventDisplays.OfflineTest:
25 flags.OnlineEventDisplays.OutputDirectory = "."
26
27
38 flags.OnlineEventDisplays.PartitionName='ATLAS'
39
40 flags.OnlineEventDisplays.MaxEvents=50
41 flags.OnlineEventDisplays.ProjectTag='data25_13p6TeV'
42 flags.OnlineEventDisplays.PublicStreams=['Main']
43 if flags.OnlineEventDisplays.HIMode:
44 flags.OnlineEventDisplays.MaxEvents=200
45 flags.OnlineEventDisplays.ProjectTag='data25_hi'
46 flags.OnlineEventDisplays.PublicStreams=['HardProbes']
47 if flags.OnlineEventDisplays.HIPMode:
48 flags.OnlineEventDisplays.MaxEvents=200
49 flags.OnlineEventDisplays.ProjectTag='data25_hip'
50 flags.OnlineEventDisplays.PublicStreams=['Main']
51 if flags.OnlineEventDisplays.CosmicMode:
52 flags.OnlineEventDisplays.MaxEvents=200
53 flags.OnlineEventDisplays.ProjectTag='data25_cos'
54 flags.OnlineEventDisplays.PublicStreams=['']
55 if flags.OnlineEventDisplays.BeamSplashMode:
56 flags.OnlineEventDisplays.MaxEvents=-1
57 flags.OnlineEventDisplays.ProjectTag='data25_comm'
58 flags.OnlineEventDisplays.PublicStreams=['']
59
60
61 if not flags.OnlineEventDisplays.OfflineTest:
62 WaitForPartition(flags.OnlineEventDisplays.PartitionName)
63
64 if not flags.OnlineEventDisplays.OfflineTest:
65 import os
66 IPC_timeout = int(os.environ['TDAQ_IPC_TIMEOUT'])
67 print(
" IPC_timeout Envrionment Variable = %d" %IPC_timeout)
68
69
70 if flags.OnlineEventDisplays.OfflineTest:
71 flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2025-02'
72 else:
73 flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2025-01'
74
75
76 flags.GeoModel.AtlasVersion = 'ATLAS-R3S-2021-03-02-00'
77
78 flags.Trigger.triggerConfig='DB'
79
80 jobId = GetUniqueJobID()
81
82
83 if flags.OnlineEventDisplays.PartitionName != 'ATLAS' or flags.OnlineEventDisplays.OfflineTest:
84 flags.Exec.MaxEvents = 5
85 flags.Output.ESDFileName = flags.OnlineEventDisplays.OutputDirectory + "ESD-%s-%s.pool.root" % (jobId[3], jobId[4])
86 else:
87 flags.Exec.MaxEvents = 20000
88 flags.Output.ESDFileName = "ESD-%s-%s.pool.root" % (jobId[3], jobId[4])
89
90 if flags.OnlineEventDisplays.MakeVP1File:
91 flags.Output.doWriteESD = True
92 else:
93 flags.Output.doWriteESD = False
94
95 flags.Output.doJiveXML = False
96
97 if flags.OnlineEventDisplays.OfflineTest:
98 flags.Input.Files = ['/eos/home-m/myexley/sharedWithATLASauthors/data25_13p6TeV.00499912.physics_Main.daq.RAW._lb0600._SFO-11._0001.data']
99 else:
100 flags.Input.Files = []
101
102 flags.Reco.EnableTrigger = False
103 flags.Detector.GeometryForward = False
104 flags.Detector.EnableFwdRegion = False
105 flags.Reco.EnableZDC = False
106 flags.LAr.doHVCorr = False
107 flags.DQ.doMonitoring = False
108 flags.DQ.doPostProcessing = False
109 flags.Concurrency.NumThreads = 1
110
111 if flags.OnlineEventDisplays.MakeVP1File:
112 flags.Concurrency.NumThreads = 0
113 if flags.OnlineEventDisplays.HIMode or flags.OnlineEventDisplays.HIPMode:
114 mlog.warning("You have said you want to create a vp1 file 'flags.OnlineEventDisplays.MakeVP1File=True' but you have also said you want to run reconstruction in an heavy ion mode, this will not work as heavy ion mode needs to run in multithreading mode, and in this mode we cannot write out one ESD file (i.e. vp1 file) per event.")
115
116 if flags.OnlineEventDisplays.HIMode:
117 from AthenaConfiguration.Enums import HIMode
118 flags.Reco.HIMode = HIMode.HI
119 flags.Concurrency.NumThreads = 1
120 flags.OnlineEventDisplays.MakeVP1File = False
121 flags.Beam.BunchSpacing = 50
122
123 if flags.OnlineEventDisplays.HIPMode:
124 from AthenaConfiguration.Enums import HIMode
125 flags.Reco.HIMode = HIMode.HIP
126 flags.Concurrency.NumThreads = 1
127 flags.OnlineEventDisplays.MakeVP1File = False
128
129 if flags.OnlineEventDisplays.BeamSplashMode:
130 flags.Reco.EnableJet=False
131 flags.Reco.EnableMet=False
132 flags.Reco.EnableTau=False
133 flags.Reco.EnablePFlow=False
134 flags.Reco.EnableBTagging=False
135 flags.Reco.EnableEgamma=False
136 flags.Reco.EnableCombinedMuon=False
137
139 flags.Exec.OutputLevel = INFO
140
141 flags.Common.isOnline = not flags.OnlineEventDisplays.OfflineTest
142
143 if flags.OnlineEventDisplays.PartitionName == 'ATLAS' and not flags.OnlineEventDisplays.OfflineTest:
144
145 run_number = GetRunNumber(flags.OnlineEventDisplays.PartitionName)
146 flags.Input.OverrideRunNumber = True
147 flags.Input.RunNumbers = [run_number]
148
149
150 (solenoidOn,toroidOn)=GetBFields()
151 flags.BField.solenoidOn = solenoidOn
152 flags.BField.barrelToroidOn = toroidOn
153 flags.BField.endcapToroidOn = toroidOn
154
155
156 if (flags.OnlineEventDisplays.PartitionName == 'GMTestPartition' or flags.OnlineEventDisplays.PartitionName == 'GMTestPartitionT9'):
157 flags.Input.RunNumbers = [482485]
158 flags.Input.LumiBlockNumbers = [111]
159
160 from AthenaConfiguration.Enums import BeamType
161 if not flags.OnlineEventDisplays.OfflineTest:
162 if flags.OnlineEventDisplays.CosmicMode:
163 flags.Beam.Type = BeamType.Cosmics
164 else:
165 flags.Beam.Type = BeamType.Collisions
166 flags.lock()
167 flags.dump()
168
170 from RecJobTransforms.RecoSteering import RecoSteering
171 cfg = RecoSteering(flags)
172
173 from IOVDbSvc.IOVDbSvcConfig import addOverride
174 if not flags.OnlineEventDisplays.OfflineTest:
175 cfg.merge(addOverride(flags, "/TRT/Onl/Calib/PID_NN", "TRTCalibPID_NN_v2", db=""))
176
177
178 if not flags.OnlineEventDisplays.OfflineTest:
179 from EventDisplaysOnline.ByteStreamConfig import ByteStreamCfg
180 cfg.merge(ByteStreamCfg(flags, **kwargs))
181
182 from EventDisplaysOnline.OnlineEventDisplaysSvcConfig import OnlineEventDisplaysSvcCfg
183 cfg.merge(OnlineEventDisplaysSvcCfg(flags, **kwargs))
184
185 from JiveXML.OnlineStreamToFileConfig import OnlineStreamToFileCfg
186 streamToFileTool = cfg.popToolsAndMerge(OnlineStreamToFileCfg(flags, **kwargs))
187
188 streamToServerTool = None
189 if not flags.OnlineEventDisplays.OfflineTest:
190 from JiveXML.OnlineStreamToServerConfig import OnlineStreamToServerCfg
191 streamToServerTool = cfg.popToolsAndMerge(OnlineStreamToServerCfg(flags, **kwargs))
192
193 from JiveXML.JiveXMLConfig import AlgoJiveXMLCfg
194 cfg.merge(AlgoJiveXMLCfg(flags,
195 StreamToFileTool = streamToFileTool,
196 StreamToServerTool = streamToServerTool,
197 OnlineMode = not flags.OnlineEventDisplays.OfflineTest))
198
199 if flags.OnlineEventDisplays.HIMode:
200 from EventDisplaysOnline.ContainerKeysCfg import getHIContainterKeys
201 getHIContainterKeys(cfg)
202
203 if flags.OnlineEventDisplays.HIPMode:
204 from EventDisplaysOnline.ContainerKeysCfg import getHIPContainterKeys
205 getHIPContainterKeys(cfg)
206
207 if flags.OnlineEventDisplays.MakeVP1File:
208
209
210 from AthenaServices.OutputStreamSequencerSvcConfig import OutputStreamSequencerSvcCfg
211 cfg.merge(OutputStreamSequencerSvcCfg(flags,incidentName="EndEvent"))
212 from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
213 streamESD = cfg.getEventAlgo(outputStreamName("ESD"))
214 streamESD.OutputFile=flags.Output.ESDFileName
215
216 from VP1AlgsEventProd.VP1AlgsEventProdConfig import VP1AlgsEventProdCfg
217 cfg.merge(VP1AlgsEventProdCfg(flags, streamESD, **kwargs))
218
219
220 if flags.OnlineEventDisplays.BeamSplashMode:
221 cfg.getEventAlgo("MuonSegmentMaker").doStgcSegments=False
222 cfg.getEventAlgo("MuonSegmentMaker").doMMSegments=False
223 cfg.getEventAlgo("MuonSegmentMaker_NCB").doStgcSegments=False
224 cfg.getEventAlgo("MuonSegmentMaker_NCB").doMMSegments=False
225 cfg.dropEventAlgo("QuadNSW_MuonSegmentCnvAlg")
226
227 if flags.OnlineEventDisplays.HorizontalMuonsMode:
228 from MuonConfig.MuonReconstructionConfig import MuonNCBTrackCfg
229 cfg.merge(MuonNCBTrackCfg(flags))
230
231 cfg.getService("PoolSvc").WriteCatalog = "xmlcatalog_file:PoolFileCatalog_%s_%s.xml" % (jobId[3], jobId[4])
232
233
237 cfg.getService("PoolSvc").ReadCatalog += ["xmlcatalog_file:/det/dqm/GlobalMonitoring/PoolFileCatalog_M7/PoolFileCatalog.xml"]
238
239
240 with open("OnlineEventDisplays.pkl", "wb") as f:
241 cfg.store(f)
242
243 return cfg
244
void print(char *figname, TCanvas *c1)