ATLAS Offline Software
Functions | Variables
TriggerMenuRW Namespace Reference

Functions

def main ()
 

Variables

 log
 

Function Documentation

◆ main()

def TriggerMenuRW.main ( )

Definition at line 10 of file TriggerMenuRW.py.

10 def main():
11  import argparse
12  parser = argparse.ArgumentParser()
13  parser.add_argument("-v", help="increase output verbosity", action="count", default=0)
14  parser.add_argument("-f", "--file", dest="filename", help="json file (menu, prescale set, or bunch group set)")
15  parser.add_argument("--db", dest="dbalias", help="TriggerDB connection alias")
16  parser.add_argument("--smk", type = int, help="SuperMaster key (when accessing menu or job options")
17  parser.add_argument("--l1psk", type = int, help="L1 PrescalesSet key (when accessing L1 prescales")
18  parser.add_argument("--hltpsk", type = int, help="HLT PrescalesSet key (when accessing L1 prescales")
19  parser.add_argument("--bgsk", type = int, help="BunchGroupSet key (when accessing bunch groups")
20  parser.add_argument("--monk", type = int, help="Monitoring Groups key (when accessing monitoring groups)")
21  parser.add_argument("--print", dest="doPrint", help="Prints the loaded information", action="store_true", default = False)
22  parser.add_argument("-w", "--write", dest="doWrite", help="Writes the loaded information to a file", action="store_true", default = False)
23  parser.add_argument("-l", "--loglevel", dest="loglevel", help="Log level [DEBUG, INFO, WARNING] (default INFO)", default = "INFO")
24  parser.add_argument("--use-crest", dest="useCrest", action="store_true",
25  help="Uses CREST to access the TriggerDB")
26  parser.add_argument("--crest-server", dest="crestServer", type=str, default="http://crest-04.cern.ch/api-v5.0",
27  help="CREST server (default: http://crest-04.cern.ch/api-v5.0)")
28 
29  args = parser.parse_args()
30 
31  logging.getLogger('TriggerConfigAccessBase.py').setLevel(args.loglevel)
32  logging.getLogger('L1TriggerConfigAccess.py').setLevel(args.loglevel)
33  logging.getLogger('HLTTriggerConfigAccess.py').setLevel(args.loglevel)
34  log.setLevel(args.loglevel)
35 
36 
37  if args.filename:
38  filetype = getFileType(args.filename)
39  if filetype == ConfigType.L1MENU.filetype:
40  cfg = L1MenuAccess( filename = args.filename )
41  elif filetype == ConfigType.L1PS.filetype:
42  cfg = L1PrescalesSetAccess( filename = args.filename )
43  elif filetype == ConfigType.BGS.filetype:
44  cfg = BunchGroupSetAccess( filename = args.filename )
45  elif filetype == ConfigType.HLTMENU.filetype:
46  cfg = HLTMenuAccess( filename = args.filename )
47  elif filetype == ConfigType.HLTPS.filetype:
48  cfg = HLTPrescalesSetAccess( filename = args.filename )
49  elif filetype == ConfigType.HLTJO.filetype:
50  cfg = HLTJobOptionsAccess( filename = args.filename )
51  elif filetype == ConfigType.HLTMON.filetype:
52  cfg = HLTMonitoringAccess( filename = args.filename )
53  else:
54  log.error("Can't read file %s of unknown filetype '%s'", args.filename, filetype)
55  return 1
56  elif args.dbalias:
57  cfg = []
58  if args.smk:
59  cfg += [ L1MenuAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
60  cfg += [ HLTMenuAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
61  cfg += [ HLTJobOptionsAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
62  cfg += [ HLTMonitoringAccess( dbalias = args.dbalias, smkey = args.smk, useCrest = args.useCrest, crestServer = args.crestServer) ]
63  if args.l1psk:
64  cfg += [ L1PrescalesSetAccess( dbalias = args.dbalias, l1pskey = args.l1psk, useCrest = args.useCrest, crestServer = args.crestServer) ]
65  if args.hltpsk:
66  cfg += [ HLTPrescalesSetAccess( dbalias = args.dbalias, hltpskey = args.hltpsk, useCrest = args.useCrest, crestServer = args.crestServer) ]
67  if args.bgsk:
68  cfg += [ BunchGroupSetAccess( dbalias = args.dbalias, bgskey = args.bgsk, useCrest = args.useCrest, crestServer = args.crestServer) ]
69  if args.monk:
70  cfg += [ HLTMonitoringAccess( dbalias = args.dbalias, monikey = args.monk, useCrest = args.useCrest, crestServer = args.crestServer) ]
71  else:
72  print("Either a file or dbalias and key need to be specified")
73  return 1
74 
75  if args.doPrint:
76  if type(cfg) is list:
77  for c in cfg:
78  c.printSummary()
79  else:
80  cfg.printSummary()
81 
82  if args.doWrite:
83  if type(cfg) is list:
84  for c in cfg:
85  c.writeFile()
86  else:
87  cfg.writeFile()
88 
89 
90 
91 
92  return 0
93 

Variable Documentation

◆ log

TriggerMenuRW.log

Definition at line 8 of file TriggerMenuRW.py.

python.TriggerConfigAccessBase.getFileType
def getFileType(filename)
Definition: TriggerConfigAccessBase.py:15
TriggerMenuRW.main
def main()
Definition: TriggerMenuRW.py:10
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78