Skip to content

Commit cc66dac

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

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
parser.add_argument('-ini',help='generator init parameters file (full paths required), for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='')
6262
parser.add_argument('-confKey',help='generator or trigger configuration key values, for example: "GeneratorPythia8.config=pythia8.cfg;A.x=y"', default='')
6363
parser.add_argument('--readoutDets',help='comma separated string of detectors readout (does not modify material budget - only hit creation)', default='all')
64+
parser.add_argument('--material-params-ccdb', dest='material_params_ccdb', action='store_true', help='to fetch the material parameters used during transport from CCDB')
6465

6566
parser.add_argument('-interactionRate',help='Interaction rate, used in digitization', default=-1)
6667
parser.add_argument('-bcPatternFile',help='Bunch crossing pattern file, used in digitization (a file name or "ccdb")', default='')
@@ -362,6 +363,24 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
362363
if (includeLocalQC or includeFullQC) and not isdir(qcdir):
363364
mkdir(qcdir)
364365

366+
# prepare fetching and configuration for MaterialManagerParam
367+
transport_needs = []
368+
if args.material_params_ccdb:
369+
# the target file name
370+
mat_mgr_file_name = 'material_manager_params.json'
371+
# the path on CCDB
372+
ccdb_path = 'SIM_TEST/ALIBI/SIM_CUTS'
373+
# this is the full local path of where the parameter file will be copied to
374+
mat_mgr_file_path = f'${{ALICEO2_CCDB_LOCALCACHE}}/{ccdb_path}/{mat_mgr_file_name}'
375+
# simply append, the last one takes precedence
376+
args.confKey += f';MaterialManagerParam.inputFile={mat_mgr_file_path}'
377+
args.confKeyBkg += f';MaterialManagerParam.inputFile={mat_mgr_file_path}'
378+
379+
MAT_PARAMS_DOWNLOADER_TASK = createTask(name='download_mat_mgr_params', cpu=0)
380+
MAT_PARAMS_DOWNLOADER_TASK['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}'
381+
workflow['stages'].append(MAT_PARAMS_DOWNLOADER_TASK)
382+
transport_needs.append(MAT_PARAMS_DOWNLOADER_TASK['name'])
383+
365384
# create/publish the GRPs and other GLO objects for consistent use further down the pipeline
366385
orbitsPerTF=int(args.orbitsPerTF)
367386
GRP_TASK = createTask(name='grpcreate', cpu='0')
@@ -455,7 +474,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
455474
# determine final configKey values for background transport
456475
CONFKEYBKG = constructConfigKeyArg(create_geant_config(args, args.confKeyBkg))
457476

458-
BKGtask=createTask(name='bkgsim', lab=["GEANT"], needs=[BKG_CONFIG_task['name'], GRP_TASK['name']], cpu=NWORKERS )
477+
BKGtask=createTask(name='bkgsim', lab=["GEANT"], needs=[BKG_CONFIG_task['name'], GRP_TASK['name']] + transport_needs, cpu=NWORKERS )
459478
BKGtask['cmd']='${O2_ROOT}/bin/o2-sim -e ' + SIMENGINE + ' -j ' + str(NWORKERS) + ' -n ' + str(NBKGEVENTS) \
460479
+ ' -g ' + str(GENBKG) + ' ' + str(MODULES) + ' -o bkg ' + str(INIBKG) \
461480
+ ' --field ccdb ' + str(CONFKEYBKG) \
@@ -700,7 +719,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
700719
# -----------------
701720
# transport signals
702721
# -----------------
703-
signalneeds=[ SGN_CONFIG_task['name'], GRP_TASK['name'] ]
722+
signalneeds=[ SGN_CONFIG_task['name'], GRP_TASK['name'] ] + transport_needs
704723
if (args.pregenCollContext == True):
705724
signalneeds.append(PreCollContextTask['name'])
706725

0 commit comments

Comments
 (0)