ATLAS Offline Software
test_hltConditions.py
Go to the documentation of this file.
1 #!/usr/bin/env athena
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
14 
15 # Update these values to your need:
16 sqlite = 'noise.db' # sqlite file with new conditions
17 onldb = 'ATLAS_COOLONL_CALO'
18 folder = '/CALO/Noise/CellNoise'
19 
20 
21 def createSqlite(flags):
22  """Create local sqlite file"""
23  import os
24  try:
25  os.remove(flags.IOVDb.SqliteInput) # Delete temporary file
26  except Exception:
27  pass
28 
29  # Copy last IOV from online DB
30  rc = os.system(f"AtlCoolCopy 'oracle://ATLAS_COOLPROD;schema={onldb};dbname=CONDBR2' 'sqlite://;schema={flags.IOVDb.SqliteInput};dbname=CONDBR2' -create -tag {flags.IOVDb.GlobalTag} -hitag -prunetags -folder {folder} -r 9999999")
31  if rc!=0:
32  raise RuntimeError("Cannot copy folder from COOL")
33 
34  # Merge with user given sqlite file (in case only some channels have been updated)
35  rc = os.system(f"AtlCoolCopy 'sqlite://;schema={sqlite};dbname=CONDBR2' 'sqlite://;schema={flags.IOVDb.SqliteInput};dbname=CONDBR2' -folder {folder} -r 9999999")
36  if rc!=0:
37  raise RuntimeError("Cannot merge sqlite file")
38 
39 
40 # Set flags
41 from AthenaConfiguration.AllConfigFlags import initConfigFlags
42 flags = initConfigFlags()
43 
44 flags.Concurrency.NumThreads = 1
45 #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data22_13p6TeV.00428770.express_express.merge.RAW._lb0221._SFO-ALL._0001.1']
46 flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data22_cos.00433897.express_express.merge.RAW._lb0134._SFO-ALL._0001.1']
47 flags.IOVDb.SqliteInput = 'cool_tmp.db' # created by createSqlite
48 flags.IOVDb.SqliteFolders = (folder,)
49 
50 flags.Trigger.L1.errorOnMissingTOB=False
51 
52 from TriggerJobOpts.TriggerConfigFlags import trigGlobalTag
53 flags.IOVDb.GlobalTag=trigGlobalTag(flags)
54 
55 # Create sqlite file
56 createSqlite(flags)
57 
58 # Configure HLT
59 from TriggerJobOpts.runHLT import athenaCfg
60 acc = athenaCfg(flags)
61 
62 # Force IOV for folder
63 iovDbSvc = acc.getService('IOVDbSvc')
64 for i,f in enumerate(iovDbSvc.Folders):
65  if folder in f:
66  iovDbSvc.Folders[i] += '<forceRunNumber>9999999</forceRunNumber>'
67 # allow missing ROB in the input file
68 l1bsdec = acc.getEventAlgo("L1TriggerByteStreamDecoder")
69 l1bsdec.MaybeMissingROBs += [0x941000]
70 
71 # Run
72 import sys
73 sys.exit(acc.run().isFailure())
python.TriggerConfigFlags.trigGlobalTag
def trigGlobalTag(flags)
Definition: TriggerConfigFlags.py:21
python.runHLT.athenaCfg
def athenaCfg(flags, parser=None)
Definition: runHLT.py:135
python.test_hltConditions.createSqlite
def createSqlite(flags)
Definition: test_hltConditions.py:21
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19