diff --git a/MC/bin/o2dpg_sim_config.py b/MC/bin/o2dpg_sim_config.py index 22017086d..24efa3935 100755 --- a/MC/bin/o2dpg_sim_config.py +++ b/MC/bin/o2dpg_sim_config.py @@ -125,9 +125,8 @@ def constructConfigKeyArg(config): # and constructs the --configKeyValues options for simulation if len(config) == 0: return '' - arg = '--configKeyValues "' + arg_tokens = [] for mainkey in config: for subkey in config[mainkey]: - arg = arg + mainkey + '.' + subkey + '=' + config[mainkey][subkey] + ';' - arg = arg + '"' - return arg + arg_tokens.append(mainkey + '.' + subkey + '=' + config[mainkey][subkey]) + return '--configKeyValues "' + ';'.join(arg_tokens) + '"' diff --git a/MC/bin/o2dpg_sim_workflow.py b/MC/bin/o2dpg_sim_workflow.py index 0cec2d02f..2f180805b 100755 --- a/MC/bin/o2dpg_sim_workflow.py +++ b/MC/bin/o2dpg_sim_workflow.py @@ -362,9 +362,36 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True): if (includeLocalQC or includeFullQC) and not isdir(qcdir): mkdir(qcdir) +# prepare fetching and configuration for MaterialManagerParam +# MaterialManagerParam only has an effect when given to signal confKey +mat_mgr_params = create_geant_config(args, args.confKey).get('MaterialManagerParam', {}).get('inputFile', None) +# the target file name +mat_mgr_file_name = 'material_manager_params.json' +# the path on CCDB +ccdb_path = 'SIM_TEST/ALIBI/SIM_CUTS' +# this is the full path of where the parameter file will be copied to +mat_mgr_file_path = f'${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path}/{mat_mgr_file_name}' + +if mat_mgr_params is None: + mat_mgr_cmd = 'echo "placeholder / dummy task"' + mat_mgr_file_path = None +elif mat_mgr_params == 'ccdb': + 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}' +else: + 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} ; }}' + +if mat_mgr_params: + # we can simply append, the last one takes precedence + args.confKey += f';MaterialManagerParam.inputFile={mat_mgr_file_path}' + args.confKeyBkg += f';MaterialManagerParam.inputFile={mat_mgr_file_path}' + +MATMGR_TASK = createTask(name='download_mat_mgr_params', cpu=0) +MATMGR_TASK['cmd'] = mat_mgr_cmd +workflow['stages'].append(MATMGR_TASK) + # create/publish the GRPs and other GLO objects for consistent use further down the pipeline orbitsPerTF=int(args.orbitsPerTF) -GRP_TASK = createTask(name='grpcreate', cpu='0') +GRP_TASK = createTask(name='grpcreate', cpu='0', needs=[MATMGR_TASK['name']]) 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 GRP_TASK['cmd'] += ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored] if (not args.run_anchored == True) and len(args.bcPatternFile) > 0: