62 parser =
argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description=
"apply normalization factor to inst lumi")
63 parser.add_argument(
'-c',dest=
'connectstr',action=
'store',required=
True,help=
'connectstr')
64 parser.add_argument(
'-norm',dest=
'normfactor',action=
'store',required=
True,help=
'normalization factor to apply')
65 parser.add_argument(
'-P',dest=
'authpath',action=
'store',required=
True,help=
'path to authentication file')
66 parser.add_argument(
'-r',dest=
'runnumber',action=
'store',required=
False,help=
'run number')
67 parser.add_argument(
'-startrun',dest=
'startrun',action=
'store',required=
False,help=
'start run for range action')
68 parser.add_argument(
'-endrun',dest=
'endrun',action=
'store',required=
False,help=
'end run for range action')
69 parser.add_argument(
'action',choices=[
'run',
'range'],help=
'calibrate run')
71 parser.add_argument(
'--debug',dest=
'debug',action=
'store_true',help=
'debug')
72 args=parser.parse_args()
73 connectstr=args.connectstr
74 normfactor=args.normfactor
75 if len(args.authpath)!=0:
76 os.environ[
'CORAL_AUTH_PATH']=args.authpath
78 raise '-P authpath argument is required'
79 svc=coral.ConnectionService()
80 session=svc.connect(connectstr,accessMode=coral.access_Update)
82 msg=coral.MessageStream(
'')
83 msg.setMsgVerbosity(coral.message_Level_Debug)
85 if args.action ==
'run':
88 runnumber=args.runnumber
90 raise 'argument -r is required for action run'
92 print 'connectstr : ',connectstr
93 print 'normfactor : ',normfactor
94 print 'authpath : ',os.environ[
'CORAL_AUTH_PATH']
95 print 'runnumber : ',runnumber
97 if args.action ==
'range':
101 startrun=args.startrun
103 raise 'argument -startrun is required for action range'
107 raise 'argument -endrun is required for action range'
109 print 'connectstr : ',connectstr
110 print 'normfactor : ',normfactor
111 print 'authpath : ',os.environ[
'CORAL_AUTH_PATH']
112 print 'startrun : ',startrun
113 print 'endrun : ',endrun
115 print 'number of rows changed: ',n