Skip to content

Commit 98686bd

Browse files
author
Benedikt Volkel
committed
[SimWF,WIP] Enable MaterialManager input from CCDB
* first demonstrator
1 parent d66f838 commit 98686bd

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

MC/bin/o2dpg_sim_config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ def constructConfigKeyArg(config):
125125
# and constructs the --configKeyValues options for simulation
126126
if len(config) == 0:
127127
return ''
128-
arg = '--configKeyValues "'
128+
arg_tokens = []
129129
for mainkey in config:
130130
for subkey in config[mainkey]:
131-
arg = arg + mainkey + '.' + subkey + '=' + config[mainkey][subkey] + ';'
132-
arg = arg + '"'
133-
return arg
131+
arg_tokens.append(mainkey + '.' + subkey + '=' + config[mainkey][subkey])
132+
return '--configKeyValues "' + ';'.join(arg_tokens) + '"'

MC/bin/o2dpg_sim_workflow.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,36 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
362362
if (includeLocalQC or includeFullQC) and not isdir(qcdir):
363363
mkdir(qcdir)
364364

365+
# prepare fetching and configuration for MaterialManagerParam
366+
# MaterialManagerParam only has an effect when given to signal confKey
367+
mat_mgr_params = create_geant_config(args, args.confKey).get('MaterialManagerParam', {}).get('inputFile', None)
368+
# the target file name
369+
mat_mgr_file_name = 'material_manager_params.json'
370+
# the path on CCDB
371+
ccdb_path = 'SIM_TEST/ALIBI/SIM_CUTS'
372+
# this is the full path of where the parameter file will be copied to
373+
mat_mgr_file_path = f'${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path}/{mat_mgr_file_name}'
374+
375+
if mat_mgr_params is None:
376+
mat_mgr_cmd = 'echo "placeholder / dummy task"'
377+
mat_mgr_file_path = None
378+
elif mat_mgr_params == 'ccdb':
379+
mat_mgr_cmd = f'${{O2_ROOT}}/bin/o2-ccdb-downloadccdbfile --host http://ccdb-test.cern.ch:8080 -p {ccdb_path} --timestamp -1 -d ${{ALICEO2_CCDB_LOCALCACHE}} -o {mat_mgr_file_name}'
380+
else:
381+
mat_mgr_cmd = f'[[ ! -d ${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path} ]] && {{mkdir ${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path} ; cp {mat_mgr_params} ${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path} ; }}'
382+
383+
if mat_mgr_params:
384+
# we can simply append, the last one takes precedence
385+
args.confKey += f';MaterialManagerParam.inputFile={mat_mgr_file_path}'
386+
args.confKeyBkg += f';MaterialManagerParam.inputFile={mat_mgr_file_path}'
387+
388+
MATMGR_TASK = createTask(name='download_mat_mgr_params', cpu=0)
389+
MATMGR_TASK['cmd'] = mat_mgr_cmd
390+
workflow['stages'].append(MATMGR_TASK)
391+
365392
# create/publish the GRPs and other GLO objects for consistent use further down the pipeline
366393
orbitsPerTF=int(args.orbitsPerTF)
367-
GRP_TASK = createTask(name='grpcreate', cpu='0')
394+
GRP_TASK = createTask(name='grpcreate', cpu='0', needs=[MATMGR_TASK['name']])
368395
GRP_TASK['cmd'] = 'o2-grp-simgrp-tool createGRPs --timestamp ' + str(args.timestamp) + ' --run ' + str(args.run) + ' --publishto ${ALICEO2_CCDB_LOCALCACHE:-.ccdb} -o grp --hbfpertf ' + str(orbitsPerTF) + ' --field ' + args.field
369396
GRP_TASK['cmd'] += ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
370397
if (not args.run_anchored == True) and len(args.bcPatternFile) > 0:

0 commit comments

Comments
 (0)