ATLAS Offline Software
EventDisplaysOnlineConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 def EventDisplaysOnlineCfg(flags, **kwargs):
4  from EventDisplaysOnline.EventDisplaysOnlineHelpers import GetBFields, WaitForPartition, GetUniqueJobID, GetRunNumber
5 
6  if not flags.OnlineEventDisplays.OfflineTest:
7  from AthenaConfiguration.AutoConfigOnlineRecoFlags import autoConfigOnlineRecoFlags
8  autoConfigOnlineRecoFlags(flags, flags.OnlineEventDisplays.PartitionName)
9 
10  # An explicit list for nominal data taking to exclude some high rate streams
11  # Empty list to read all
12  flags.OnlineEventDisplays.TriggerStreams = ['MinBias','express','ZeroBias','CosmicCalo','IDCosmic','CosmicMuons','Background','Standby','L1Calo','Main']
13  if flags.OnlineEventDisplays.BeamSplashMode:
14  flags.OnlineEventDisplays.TriggerStreams = ['MinBias'] #if trigger fails it will go to debug_HltError
15 
16  # If testing at p1, create dir /tmp/your_user_name and write out to /tmp/your_user_name to see output
17  flags.OnlineEventDisplays.OutputDirectory = "/atlas/EventDisplayEvents/"
18 
19  if flags.OnlineEventDisplays.OfflineTest:
20  flags.OnlineEventDisplays.OutputDirectory = "."
21 
22 
33  flags.OnlineEventDisplays.PartitionName='ATLAS' # 'ATLAS', 'GMTestPartition' or 'GMTestPartitionT9'
34 
35  if flags.OnlineEventDisplays.HIMode:
36  flags.OnlineEventDisplays.MaxEvents=200
37  flags.OnlineEventDisplays.ProjectTag='data24_hi'
38  flags.OnlineEventDisplays.PublicStreams=['HardProbes']
39  if flags.OnlineEventDisplays.CosmicMode:
40  flags.OnlineEventDisplays.MaxEvents=200
41  flags.OnlineEventDisplays.ProjectTag='data24_cos'
42  flags.OnlineEventDisplays.PublicStreams=['']
43  if flags.OnlineEventDisplays.BeamSplashMode:
44  flags.OnlineEventDisplays.MaxEvents=-1 # keep all the events
45  flags.OnlineEventDisplays.ProjectTag='data24_13p6TeV'
46  flags.OnlineEventDisplays.PublicStreams=['']
47  else:
48  flags.OnlineEventDisplays.MaxEvents=50
49  flags.OnlineEventDisplays.ProjectTag='data24_13p6TeV'
50  flags.OnlineEventDisplays.PublicStreams=['Main']
51 
52  # Pause this thread until the partition is up
53  if not flags.OnlineEventDisplays.OfflineTest:
54  WaitForPartition(flags.OnlineEventDisplays.PartitionName)
55 
56  if not flags.OnlineEventDisplays.OfflineTest:
57  import os
58  IPC_timeout = int(os.environ['TDAQ_IPC_TIMEOUT'])
59  print(" IPC_timeout Envrionment Variable = %d" %IPC_timeout)
60 
61  # Conditions tag
62  flags.IOVDb.DatabaseInstance = "CONDBR2"
63  if flags.OnlineEventDisplays.OfflineTest:
64  flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2024-03'
65  else:
66  flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2024-02' # Online conditions tag
67 
68  # Geometry tag
69  flags.GeoModel.AtlasVersion = 'ATLAS-R3S-2021-03-02-00'
70 
71  if flags.OnlineEventDisplays.HIMode:
72  flags.Beam.BunchSpacing = 100 # ns
73 
74  flags.Trigger.triggerConfig='DB'
75 
76  jobId = GetUniqueJobID()
77 
78  # Test wth a small amount of events and write out to e.g. a tmp dir
79  if flags.OnlineEventDisplays.PartitionName != 'ATLAS' or flags.OnlineEventDisplays.OfflineTest:
80  flags.Exec.MaxEvents = 5
81  flags.Output.ESDFileName = flags.OnlineEventDisplays.OutputDirectory + "ESD-%s-%s.pool.root" % (jobId[3], jobId[4])
82  else:
83  flags.Exec.MaxEvents = 20000 # hack until we find a way to fix the memory fragmentation ATEAM-896, this resets the memory after 20k events
84  flags.Output.ESDFileName = "ESD-%s-%s.pool.root" % (jobId[3], jobId[4])
85 
86  flags.Output.doWriteESD = True
87  flags.Output.doJiveXML = False #we call the AlgoJive later on
88 
89  if flags.OnlineEventDisplays.OfflineTest:
90  flags.Input.Files = ['/eos/home-m/myexley/sharedWithATLASauthors/data24_13p6TeV.00482485.physics_Main.daq.RAW._lb0111._SFO-13._0002.data']
91  else:
92  flags.Input.Files = [] # Files are read from the ATLAS (or GM test) partition
93 
94  flags.Reco.EnableTrigger = False # TODO test True
95  flags.Detector.GeometryForward = False
96  flags.Detector.EnableFwdRegion = False
97  flags.LAr.doHVCorr = False # ATLASRECTS-6823
98 
99  if flags.OnlineEventDisplays.BeamSplashMode:
100  flags.Reco.EnableJet=False
101  flags.Reco.EnableMet=False
102  flags.Reco.EnableTau=False
103  flags.Reco.EnablePFlow=False
104  flags.Reco.EnableBTagging=False
105  flags.Reco.EnableEgamma=False
106  flags.Reco.EnableCombinedMuon=False
107 
108  from AthenaCommon.Constants import INFO
109  flags.Exec.OutputLevel = INFO
110  flags.Concurrency.NumThreads = 0
111 
112  flags.Common.isOnline = not flags.OnlineEventDisplays.OfflineTest
113 
114  if flags.OnlineEventDisplays.PartitionName == 'ATLAS' and not flags.OnlineEventDisplays.OfflineTest:
115  # For beam plashes when LAr running in a different samples mode, the current run number to LAr config is needed
116  run_number = GetRunNumber(flags.OnlineEventDisplays.PartitionName)
117  flags.Input.OverrideRunNumber = True
118  flags.Input.RunNumbers = [run_number]
119 
120  # Get the B field
121  (solenoidOn,toroidOn)=GetBFields()
122  flags.BField.override = True
123  flags.BField.solenoidOn = solenoidOn
124  flags.BField.barrelToroidOn = toroidOn
125  flags.BField.endcapToroidOn = toroidOn
126 
127  # GM test partition needs to be given the below info
128  if (flags.OnlineEventDisplays.PartitionName == 'GMTestPartition' or flags.OnlineEventDisplays.PartitionName == 'GMTestPartitionT9'):
129  flags.Input.OverrideRunNumber = True
130  flags.Input.RunNumbers = [454188] # keep this number the same as (or close to) the run number of the file you are testing on
131  flags.Input.LumiBlockNumbers = [1]
132  flags.Input.ProjectName = flags.OnlineEventDisplays.ProjectTag
133 
134  from AthenaConfiguration.Enums import BeamType
135  if not flags.OnlineEventDisplays.OfflineTest:
136  if flags.OnlineEventDisplays.CosmicMode:
137  flags.Beam.Type = BeamType.Cosmics
138  else:
139  flags.Beam.Type = BeamType.Collisions
140  flags.lock()
141  flags.dump()
142 
144  from RecJobTransforms.RecoSteering import RecoSteering
145  cfg = RecoSteering(flags)
146 
147  from IOVDbSvc.IOVDbSvcConfig import addOverride
148  if not flags.OnlineEventDisplays.OfflineTest:
149  cfg.merge(addOverride(flags, "/TRT/Onl/Calib/PID_NN", "TRTCalibPID_NN_v2", db=""))
150 
151  # Get the input files from the partition
152  if not flags.OnlineEventDisplays.OfflineTest:
153  from EventDisplaysOnline.ByteStreamConfig import ByteStreamCfg
154  cfg.merge(ByteStreamCfg(flags, **kwargs))
155 
156  from EventDisplaysOnline.OnlineEventDisplaysSvcConfig import OnlineEventDisplaysSvcCfg
157  cfg.merge(OnlineEventDisplaysSvcCfg(flags, **kwargs))
158 
159  from JiveXML.OnlineStreamToFileConfig import OnlineStreamToFileCfg
160  streamToFileTool = cfg.popToolsAndMerge(OnlineStreamToFileCfg(flags, **kwargs))
161 
162  streamToServerTool = None
163  if not flags.OnlineEventDisplays.OfflineTest:
164  from JiveXML.OnlineStreamToServerConfig import OnlineStreamToServerCfg
165  streamToServerTool = cfg.popToolsAndMerge(OnlineStreamToServerCfg(flags, **kwargs))
166 
167  from JiveXML.JiveXMLConfig import AlgoJiveXMLCfg
168  cfg.merge(AlgoJiveXMLCfg(flags,
169  StreamToFileTool = streamToFileTool,
170  StreamToServerTool = streamToServerTool,
171  OnlineMode = not flags.OnlineEventDisplays.OfflineTest))
172 
173  # This creates an ESD file per event which is renamed and moved to the desired output
174  # dir in the VP1 Event Prod alg
175  from AthenaServices.OutputStreamSequencerSvcConfig import OutputStreamSequencerSvcCfg
176  cfg.merge(OutputStreamSequencerSvcCfg(flags,incidentName="EndEvent"))
177  from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
178  streamESD = cfg.getEventAlgo(outputStreamName("ESD"))
179 
180  from VP1AlgsEventProd.VP1AlgsEventProdConfig import VP1AlgsEventProdCfg
181  cfg.merge(VP1AlgsEventProdCfg(flags, streamESD, **kwargs))
182 
183  # switch of the NSW segment making as it takes too much CPU in beamsplashes
184  if flags.OnlineEventDisplays.BeamSplashMode:
185  cfg.getEventAlgo("MuonSegmentMaker").doStgcSegments=False
186  cfg.getEventAlgo("MuonSegmentMaker").doMMSegments=False
187  cfg.getEventAlgo("MuonSegmentMaker_NCB").doStgcSegments=False
188  cfg.getEventAlgo("MuonSegmentMaker_NCB").doMMSegments=False
189  cfg.dropEventAlgo("QuadNSW_MuonSegmentCnvAlg")
190 
191  cfg.getService("PoolSvc").WriteCatalog = "xmlcatalog_file:PoolFileCatalog_%s_%s.xml" % (jobId[3], jobId[4])
192 
193 
197  cfg.getService("PoolSvc").ReadCatalog += ["xmlcatalog_file:/det/dqm/GlobalMonitoring/PoolFileCatalog_M7/PoolFileCatalog.xml"]
198 
199  # Dump the pickle file
200  with open("OnlineEventDisplays.pkl", "wb") as f:
201  cfg.store(f)
202 
203  return cfg
204 
205 if __name__ == "__main__":
206  from AthenaConfiguration.AllConfigFlags import initConfigFlags
207  flags = initConfigFlags()
208 
209  flags.OnlineEventDisplays.CosmicMode = False
210  flags.OnlineEventDisplays.HIMode = False
211  flags.OnlineEventDisplays.BeamSplashMode = False
212  flags.OnlineEventDisplays.OfflineTest = False
213 
215  # Execute
216  sc = cfg.run()
217  import sys
218  sys.exit(0 if sc.isSuccess() else 1)
python.OutputStreamSequencerSvcConfig.OutputStreamSequencerSvcCfg
def OutputStreamSequencerSvcCfg(flags, incidentName='', reportingOn=False)
Definition: OutputStreamSequencerSvcConfig.py:6
AthenaPoolExample_WriteCond.outputStreamName
string outputStreamName
Definition: AthenaPoolExample_WriteCond.py:21
python.RecoSteering.RecoSteering
def RecoSteering(flags)
Definition: RecoSteering.py:6
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
JiveXMLConfig.AlgoJiveXMLCfg
def AlgoJiveXMLCfg(flags, name="AlgoJiveXML", **kwargs)
Definition: JiveXMLConfig.py:18
EventDisplaysOnlineHelpers.WaitForPartition
def WaitForPartition(partitionName=None)
Definition: EventDisplaysOnlineHelpers.py:46
VP1AlgsEventProdConfig.VP1AlgsEventProdCfg
def VP1AlgsEventProdCfg(flags, StreamESD, **kwargs)
Definition: VP1AlgsEventProdConfig.py:6
EventDisplaysOnlineConfig.EventDisplaysOnlineCfg
def EventDisplaysOnlineCfg(flags, **kwargs)
Definition: EventDisplaysOnlineConfig.py:3
OnlineStreamToServerConfig.OnlineStreamToServerCfg
def OnlineStreamToServerCfg(flags, name='OnlineStreamToFileTool', **kwargs)
Definition: OnlineStreamToServerConfig.py:6
python.IOVDbSvcConfig.addOverride
def addOverride(flags, folder, tag, db=None)
Definition: IOVDbSvcConfig.py:224
EventDisplaysOnlineHelpers.GetUniqueJobID
def GetUniqueJobID()
Definition: EventDisplaysOnlineHelpers.py:87
Constants
some useful constants -------------------------------------------------—
python.AutoConfigOnlineRecoFlags.autoConfigOnlineRecoFlags
def autoConfigOnlineRecoFlags(flags, partition=None)
Definition: AutoConfigOnlineRecoFlags.py:134
ByteStreamConfig.ByteStreamCfg
def ByteStreamCfg(flags, **kwargs)
Definition: graphics/EventDisplaysOnline/python/ByteStreamConfig.py:5
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
OnlineEventDisplaysSvcConfig.OnlineEventDisplaysSvcCfg
def OnlineEventDisplaysSvcCfg(flags, name="OnlineEventDisplaysSvc", **kwargs)
Definition: OnlineEventDisplaysSvcConfig.py:6
EventDisplaysOnlineHelpers.GetRunNumber
def GetRunNumber(partitionName)
Definition: EventDisplaysOnlineHelpers.py:97
EventDisplaysOnlineHelpers.GetBFields
def GetBFields()
Definition: EventDisplaysOnlineHelpers.py:7
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
OnlineStreamToFileConfig.OnlineStreamToFileCfg
def OnlineStreamToFileCfg(flags, name='OnlineStreamToFileTool', **kwargs)
Definition: OnlineStreamToFileConfig.py:7