61 parser =
argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description=
"apply normalization factor to inst lumi")
62 parser.add_argument(
'-c',dest=
'connectstr',action=
'store',required=
True,help=
'connectstr')
63 parser.add_argument(
'-norm',dest=
'normfactor',action=
'store',required=
True,help=
'normalization factor to apply')
64 parser.add_argument(
'-P',dest=
'authpath',action=
'store',required=
True,help=
'path to authentication file')
65 parser.add_argument(
'-r',dest=
'runnumber',action=
'store',required=
False,help=
'run number')
66 parser.add_argument(
'-startrun',dest=
'startrun',action=
'store',required=
False,help=
'start run for range action')
67 parser.add_argument(
'-endrun',dest=
'endrun',action=
'store',required=
False,help=
'end run for range action')
68 parser.add_argument(
'action',choices=[
'run',
'range'],help=
'calibrate run')
70 parser.add_argument(
'--debug',dest=
'debug',action=
'store_true',help=
'debug')
71 args=parser.parse_args()
72 connectstr=args.connectstr
73 normfactor=args.normfactor
74 if len(args.authpath)!=0:
75 os.environ[
'CORAL_AUTH_PATH']=args.authpath
77 raise '-P authpath argument is required' 78 svc=coral.ConnectionService()
79 session=svc.connect(connectstr,accessMode=coral.access_Update)
81 msg=coral.MessageStream(
'')
82 msg.setMsgVerbosity(coral.message_Level_Debug)
84 if args.action ==
'run':
87 runnumber=args.runnumber
89 raise 'argument -r is required for action run' 91 print 'connectstr : ',connectstr
92 print 'normfactor : ',normfactor
93 print 'authpath : ',os.environ[
'CORAL_AUTH_PATH']
94 print 'runnumber : ',runnumber
96 if args.action ==
'range':
100 startrun=args.startrun
102 raise 'argument -startrun is required for action range' 106 raise 'argument -endrun is required for action range' 108 print 'connectstr : ',connectstr
109 print 'normfactor : ',normfactor
110 print 'authpath : ',os.environ[
'CORAL_AUTH_PATH']
111 print 'startrun : ',startrun
112 print 'endrun : ',endrun
114 print 'number of rows changed: ',n
def calibrateRun(dbsession, normfactor, runnum)
def calibrateRange(dbsession, normfactor, startrun, endrun)