6 if __name__==
'__main__':
9 if len(sys.argv)>1
and (sys.argv[1]==
"-h" or sys.argv[1]==
"--help"):
12 print(
"StateLessPT_NewConfig.py {--config XXX} {--stream YYY} {--run Z}")
13 print(
" default XXX: LArMon")
14 print(
" default YYY: ''")
15 print(
" default Z: '435946'")
26 for ii
in range(1,len(sys.argv)):
27 print(ii,
" ",sys.argv[ii])
29 opts,args=getopt.getopt(sys.argv[1:],
"t:",[
"config=",
"stream=",
"run="])
30 except getopt.GetoptError
as e:
31 print(
"Failed to interpret arguments")
38 print(
"Got option --config: ",a)
40 if o==
"--stream": STREAM=a
41 if o==
"--run": RUNN=
int(a)
43 from AthenaConfiguration.Enums
import Format
49 partition = os.environ.get(
"TDAQ_PARTITION")
51 from ispy
import IPCPartition, ISObject
56 p = IPCPartition(partition)
58 print(
"Partition:",p.name(),
"is not valid")
62 from AthenaConfiguration.Enums
import BeamType
64 if partition ==
"ATLAS" or partition[0:3] ==
"LAr":
66 y = ISObject(p,
'RunParams.SOR_RunParams',
'RunParams')
68 print(
"Could not find Run Parameters in IS - Set default beam type to 'cosmics'")
69 beamType=BeamType.Cosmics
72 beamtype = y.beam_type
73 beamenergy = y.beam_energy
74 runnumber = y.run_number
75 project = y.T0_project_tag
76 print(
"RUN CONFIGURATION: beam type %i, beam energy %i, run number %i, project tag %s"%(beamtype,beamenergy,runnumber,project))
78 if project[7:10]==
"cos":
79 beamType=BeamType.Cosmics
81 beamType=BeamType.Collisions
85 beamType=BeamType.Collisions
89 x = ISObject(p,
'LArParams.LAr.RunLogger.GlobalParams',
'GlobalParamsInfo')
91 print(
"Could not find IS Parameters - Set default flag")
108 print(
"Couldn not find IS Parameters - Set default flag")
124 FirstSample = x.firstSample
125 NSamples = x.nbOfSamples
127 LATOME_FW = x.ttype_mask_A
128 print(
"RUN CONFIGURATION: format %i,run type %i"%(RunType,LArFormat))
135 print(
"RUN CONFIGURATION: ReadDigits =", ReadDigits)
138 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
140 from AthenaMonitoring.DQConfigFlags
import allSteeringFlagsOff
144 flags.Beam.Type=beamType
145 flags.Beam.BunchSpacing=25
146 print(
"RUN CONFIGURATION: Beamtype =",flags.Beam.Type)
148 flags.Common.isOnline=
True
149 flags.Input.Format=Format.BS
150 flags.Input.isMC=
False
154 flags.Exec.MaxEvents=-1
156 from AthenaConfiguration.AutoConfigOnlineRecoFlags
import autoConfigOnlineRecoFlags
159 flags.IOVDb.DatabaseInstance=
"CONDBR2"
160 flags.IOVDb.GlobalTag=
"CONDBR2-ES1PA-2023-03"
162 flags.GeoModel.Layout=
"atlas"
163 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
164 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
167 flags.Input.RunNumbers=[runnumber]
169 flags.Input.LumiBlockNumbers=[0]
171 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
174 flags.Trigger.doID=
False
175 flags.Trigger.doMuon=
False
176 flags.Trigger.L1.doMuon=
False
177 flags.Trigger.L1.doTopo=
False
178 flags.Trigger.doHLT=
False
179 flags.Trigger.doLVL1=
False
180 flags.Trigger.Online.isPartition=
True
181 flags.Trigger.triggerConfig=
'DB'
182 flags.Trigger.DecisionMakerValidation.Execute=
False
183 flags.Trigger.enableL1CaloPhase1=
False
185 flags.DQ.doMonitoring=
True
186 flags.DQ.disableAtlasReadyFilter=
True
187 flags.DQ.useTrigger=
True
189 flags.DQ.Environment=
'online'
191 flags.LAr.doAlign=
False
192 flags.LAr.doHVCorr=
False
200 flags.LAr.ROD.forceIter=
True
202 flags.Calo.TopoCluster.doTopoClusterLocalCalib=
False
205 from LArMonitoring.LArMonConfigFlags
import createLArMonConfigFlags
208 flags.addFlagsCategory(
"LArMon", __monflags)
210 if STREAM==
"CosmicCalo" or STREAM==
"LArCellsEmpty":
211 flags.LArMon.doLArRawMonitorSignal=
True
213 if 'CaloMon' in CONFIG:
214 flags.DQ.enableLumiAccess=
False
216 flags.DQ.enableLumiAccess=
True
224 from AthenaConfiguration.ComponentFactory
import CompFactory
225 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
227 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
230 bytestream_conversion = CompFactory.ByteStreamCnvSvc()
231 acc.addService(bytestream_conversion, primary=
True)
233 from ByteStreamEmonSvc.EmonByteStreamConfig
import EmonByteStreamCfg
236 bytestream_input = acc.getService(
"ByteStreamInputSvc")
243 bytestream_input.Partition = partition
249 if partition ==
"ATLAS" or partition[:3] ==
"LAr":
250 bytestream_input.Key =
"dcm"
252 bytestream_input.Key =
"CompleteEvent"
254 bytestream_input.KeyCount = 15
255 bytestream_input.KeyCount = 150
256 bytestream_input.UpdatePeriod = 200
264 bytestream_input.ISServer =
'LArHistogramming'
272 bytestream_input.PublishName =
'%s-%s'%(CONFIG,STREAM)
274 bytestream_input.PublishName =
'%s-%s'%(CONFIG,
"NoTrigSel")
281 bytestream_input.ClearHistograms =
True
293 bytestream_input.Frequency = 5
300 bytestream_input.Timeout = 3600000
308 if bytestream_input.Partition[:3] ==
"LAr":
309 bytestream_input.StreamType =
""
311 bytestream_input.LVL1Logic =
"Or"
312 bytestream_input.LVL1Origin =
"TAV"
313 bytestream_input.StreamType =
"physics"
314 bytestream_input.StreamLogic =
"And"
316 if STREAM==
"LArCellsEmpty":
317 bytestream_input.StreamType =
"calibration"
318 bytestream_input.StreamNames = [
'LArCellsEmpty']
320 bytestream_input.StreamNames = [
'Main']
321 if STREAM==
"CosmicCalo":
322 bytestream_input.StreamNames = [
'CosmicCalo']
324 bytestream_input.StreamNames = [
'L1Topo']
326 bytestream_input.StreamNames = [
'L1Calo']
327 if STREAM==
"express":
328 bytestream_input.StreamNames = [
'express']
329 bytestream_input.StreamType =
"express"
330 if STREAM==
"LArNoiseBurst":
331 bytestream_input.StreamType =
"calibration"
332 bytestream_input.StreamNames = [
'LArNoiseBurst']
333 if STREAM==
"Standby":
334 bytestream_input.StreamNames = [
'Standby']
335 if STREAM==
"ZeroBias":
336 bytestream_input.StreamNames = [
'ZeroBias']
337 if STREAM==
"MinBias":
338 bytestream_input.StreamNames = [
'MinBias']
339 if STREAM==
"Background":
340 bytestream_input.StreamNames = [
'Background']
341 if STREAM==
"05_Jets":
342 bytestream_input.StreamType =
"calibration"
343 bytestream_input.StreamNames = [
'DataScouting_05_Jets']
345 bytestream_input.StreamNames = [
'monitoring_random']
346 bytestream_input.StreamType =
"monitoring"
347 if STREAM==
"calibration":
348 bytestream_input.StreamType =
"calibration"
351 print(
"DEBUG: bytestream_input.StreamNames:",bytestream_input.StreamNames)
354 bytestream_input.StreamType =
"physics"
355 bytestream_input.StreamLogic =
"Or"
357 bytestream_input.StreamNames = [
"Main",
"CosmicCalo",
"L1Topo",
"L1Calo",
"Standby",
"ZeroBias",
"Background",
"EnhancedBias",
"MinBias",
"LArCells",
"LArCellsEmpty",
"LArNoiseBurst",
"BphysDelayed",
"Late"]
365 bytestream_input.ExitOnPartitionShutdown =
False
373 bytestream_input.BufferSize = 10
380 event_selector = CompFactory.EventSelectorByteStream(
381 name=
'EventSelector',
382 ByteStreamInputSvc=bytestream_input.name,
384 acc.addService(event_selector)
385 acc.setAppProperty(
"EvtSel", event_selector.name)
387 event_persistency = CompFactory.EvtPersistencySvc(
388 name=
"EventPersistencySvc",
389 CnvServices=[bytestream_conversion.name])
390 acc.addService(event_persistency)
392 address_provider = CompFactory.ByteStreamAddressProviderSvc()
393 acc.addService(address_provider)
395 proxy = CompFactory.ProxyProviderSvc()
396 proxy.ProviderNames += [address_provider.name]
397 acc.addService(proxy)
402 from TriggerJobOpts.TriggerRecoConfig
import TriggerRecoCfg
406 l1bsdec = acc.getEventAlgo(
"L1TriggerByteStreamDecoder")
407 l1bsdec.ByteStreamMetadataRHKey=
""
408 print(
"MaybeMissingROBs: ",l1bsdec.MaybeMissingROBs)
409 l1bsdec.MaybeMissingROBs += [0x770001, 0x7500ac, 0x7500ad, 0x7300a8, 0x7300a9, 0x7300aa, 0x7300ab]
412 print(
"LATOME FW VERSION IS 6 - USING CUSTOM MAPPING")
415 from IOVDbSvc.IOVDbSvcConfig
import addOverride
416 acc.merge(
addOverride(flags,
"/LAR/Identifier/LatomeMapping",
"LARIdentifierLatomeMapping-fw6"))
418 print(
'CONFIG ',CONFIG)
419 print(
'STREAM ',STREAM)
421 if "LArSCvsRawChannel" in CONFIG:
422 from LArMonitoring.RecoPT_Phase1NewConfig
import LArSCvsRawChannelMonAlgCfg
425 elif CONFIG!=
"LArDTMon":
426 from LArMonitoring.RecoPT_NewConfig
import LArMonitoringConfig
430 from LArMonitoring.RecoPT_Phase1NewConfig
import LArDTMonitoringConfig
435 if RunType == 0
and CONFIG!=
"LArDTMon":
436 acc.getEventAlgo(
"LArRawDataReadingAlg").LArRawChannelKey=
""
439 cil=acc.getCondAlgo(
'CondInputLoader')
440 iovdbsvc=acc.getService(
'IOVDbSvc')
441 folder=
'/TRIGGER/LUMI/LBLB'
442 for i
in range(0,len(iovdbsvc.Folders)):
443 if (iovdbsvc.Folders[i].
find(folder)>=0):
444 del iovdbsvc.Folders[i]
447 remove_folder =
False
448 for cil_Loadval
in cil.Load:
449 if folder
in cil_Loadval:
450 print(f
"Removing {cil_Loadval} from cil/Load")
453 if remove_folder: cil.Load.remove(cil_Loadval)
455 if flags.DQ.enableLumiAccess:
456 lbd = acc.getCondAlgo(
'LBDurationCondAlg')
457 lbd.LBLBFolderInputKey=
""
461 from DataQualityUtils.DQPostProcessingAlg
import DQPostProcessingAlg
462 ppa = DQPostProcessingAlg(
"DQPostProcessingAlg")
463 ppa.ExtraInputs = {(
'xAOD::EventInfo' ,
'StoreGateSvc+EventInfo' )}
465 ppa.OutputLevel = WARNING
466 if flags.Common.isOnline:
467 ppa.FileKey = ((flags.DQ.FileKey +
'/')
if not flags.DQ.FileKey.endswith(
'/')
468 else flags.DQ.FileKey)
470 acc.addEventAlgo(ppa, sequenceName=
'AthEndSeq')