ATLAS Offline Software
dumpBeamSpot.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 # Dump beam spot in a COOL SQLite file (using AtlCoolTool).
5 
6 from __future__ import print_function
7 
8 __author__ = 'Juerg Beringer'
9 __version__ = '$Id: dumpBeamSpot.py 217369 2009-10-05 18:43:35Z atlidbs $'
10 __usage__ = '%prog [options] beamspotfile.db|connectionstring'
11 
12 from CoolConvUtilities import AtlCoolTool
13 
14 from optparse import OptionParser
15 parser = OptionParser(usage=__usage__, version=__version__)
16 parser.add_option('-d', '--dbname', dest='dbname', default='CONDBR2', help='database instance name (default: CONDBR2)')
17 parser.add_option('-c', '--connstring', dest='connstring', action='store_true', help='use beamspotfile as connectionstring (e.g. COOLOFL_INDET/OFLP200)')
18 parser.add_option('-f', '--folder', dest='folder', default='/Indet/Beampos', help='COOL folder (default: /Indet/Beampos)')
19 parser.add_option('-t', '--tag', dest='tag', default='nominal', help='folder tag')
20 parser.add_option('-i', '--info', dest='folderinfo', action='store_true', help='show folder and tag information')
21 (options,args) = parser.parse_args()
22 if len(args) != 1:
23  parser.error('wrong number of command line arguments')
24 folder = options.folder
25 
26 if options.connstring:
27  dbconn = args[0]
28 else:
29  dbconn = "sqlite://;schema="+args[0]+";dbname="+options.dbname
30 print ("\nUsing database connection:",dbconn)
31 
32 tool = AtlCoolTool.AtlCoolTool(dbconn)
33 tool.usetag(options.tag) # Must always set tag
34 
35 if options.folderinfo:
36  print()
37  print (tool.listinfo(folder))
38  print()
39  print (tool.lstags(folder))
40  print()
41  exit()
42 
43 print ("\nUsing folder:",folder)
44 print (tool.more(folder))
45 print()
calibdata.exit
exit
Definition: calibdata.py:236
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70