Skip to content

Commit

Permalink
[SimWF,WIP] Enable MaterialManager input from CCDB
Browse files Browse the repository at this point in the history
* first demonstrator
  • Loading branch information
Benedikt Volkel committed May 24, 2024
1 parent d66f838 commit 98686bd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
7 changes: 3 additions & 4 deletions MC/bin/o2dpg_sim_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) + '"'
29 changes: 28 additions & 1 deletion MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 98686bd

Please sign in to comment.