|
27 | 27 | import itertools |
28 | 28 | import time |
29 | 29 | import requests, re |
| 30 | +import pandas as pd |
30 | 31 |
|
31 | 32 | sys.path.append(join(dirname(__file__), '.', 'o2dpg_workflow_utils')) |
32 | 33 |
|
|
54 | 55 |
|
55 | 56 | parser.add_argument('-interactionRate',help='Interaction rate, used in digitization', default=-1) |
56 | 57 | parser.add_argument('-bcPatternFile',help='Bunch crossing pattern file, used in digitization (a file name or "ccdb")', default='') |
| 58 | +parser.add_argument('-meanVertexPerRunTxtFile',help='Txt file with mean vertex settings per run', default='') |
57 | 59 | parser.add_argument('-eCM',help='CMS energy', default=-1) |
58 | 60 | parser.add_argument('-eA',help='Beam A energy', default=-1) #6369 PbPb, 2.510 pp 5 TeV, 4 pPb |
59 | 61 | parser.add_argument('-eB',help='Beam B energy', default=-1) |
@@ -205,6 +207,30 @@ def retrieve_sor(run_number): |
205 | 207 |
|
206 | 208 | return int(SOR) |
207 | 209 |
|
| 210 | +CONFKEY='' |
| 211 | +if args.confKey!= '': |
| 212 | + CONFKEY=' --configKeyValues "' + args.confKey + '"' |
| 213 | + |
| 214 | +# Recover mean vertex settings from external txt file |
| 215 | + |
| 216 | +if len(args.meanVertexPerRunTxtFile) > 0: |
| 217 | + if "Diamond" in CONFKEY: |
| 218 | + print("confKey already sets diamond, stop!") |
| 219 | + sys.exit() |
| 220 | + #df = pd.read_csv(args.vertexPerRunFile, sep=" ", header=None) # for single space |
| 221 | + df = pd.read_csv(args.meanVertexPerRunTxtFile, delimiter="\t", header=None) # for tabular |
| 222 | + df.columns = ["runNumber", "vx", "vy", "vz", "sx", "sy", "sz"] |
| 223 | + #print(df) # print full table |
| 224 | + MV_SX = float(df.loc[df['runNumber'].eq(args.run), 'sx']) |
| 225 | + MV_SY = float(df.loc[df['runNumber'].eq(args.run), 'sy']) |
| 226 | + MV_SZ = float(df.loc[df['runNumber'].eq(args.run), 'sz']) |
| 227 | + MV_VX = float(df.loc[df['runNumber'].eq(args.run), 'vx']) |
| 228 | + MV_VY = float(df.loc[df['runNumber'].eq(args.run), 'vy']) |
| 229 | + MV_VZ = float(df.loc[df['runNumber'].eq(args.run), 'vz']) |
| 230 | + print("** Using mean vertex parameters from file",args.meanVertexPerRunTxtFile,"for run =",args.run, |
| 231 | + ": \n \t vx =",MV_VX,", vy =",MV_VY,", vz =",MV_VZ,",\n \t sx =",MV_SX,", sy =",MV_SY,", sz =",MV_SZ) |
| 232 | + CONFKEY = CONFKEY + ' "Diamond.width[2]='+str(MV_SZ)+';Diamond.width[1]='+str(MV_SY)+';Diamond.width[0]='+str(MV_SX)+';Diamond.position[2]='+str(MV_VZ)+';Diamond.position[1]='+str(MV_VY)+';Diamond.position[0]='+str(MV_VX)+'"' |
| 233 | + print("** New confKey:",CONFKEY) |
208 | 234 |
|
209 | 235 | # ----------- START WORKFLOW CONSTRUCTION ----------------------------- |
210 | 236 |
|
@@ -422,9 +448,6 @@ def getDPL_global_options(bigshm=False): |
422 | 448 | INIFILE='' |
423 | 449 | if args.ini!= '': |
424 | 450 | INIFILE=' --configFile ' + args.ini |
425 | | - CONFKEY='' |
426 | | - if args.confKey!= '': |
427 | | - CONFKEY=' --configKeyValues "' + args.confKey + '"' |
428 | 451 | PROCESS=args.proc |
429 | 452 | TRIGGER='' |
430 | 453 | if args.trigger != '': |
|
0 commit comments