6 from __future__
import print_function
8 __author__ =
'Juerg Beringer'
9 __version__ =
'$Id: dumpBeamSpot.py 217369 2009-10-05 18:43:35Z atlidbs $'
10 __usage__ =
'%prog [options] beamspotfile.db|connectionstring'
12 from CoolConvUtilities
import AtlCoolTool
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()
23 parser.error(
'wrong number of command line arguments')
24 folder = options.folder
26 if options.connstring:
29 dbconn =
"sqlite://;schema="+args[0]+
";dbname="+options.dbname
30 print (
"\nUsing database connection:",dbconn)
32 tool = AtlCoolTool.AtlCoolTool(dbconn)
33 tool.usetag(options.tag)
35 if options.folderinfo:
37 print (tool.listinfo(folder))
39 print (tool.lstags(folder))
43 print (
"\nUsing folder:",folder)
44 print (tool.more(folder))