Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion MC/bin/o2dpg_sim_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,14 @@ def get_dpl_options_for_executable(executable, envfile):
def option_if_available(executable, option, envfile = None):
"""Checks if an option is available for a given executable and returns it as a string. Otherwise empty string"""
_, inverse_lookup = get_dpl_options_for_executable(executable, envfile)
return ' ' + option if option in inverse_lookup else ''
return ' ' + option if option in inverse_lookup else ''


# helper function to overwrite some values; prints out stuff that it changes
def overwrite_config(config, mainkey, subkey, value):
oldvalue = config.get(mainkey,{}).get(subkey, None)
print (f"Overwriting {mainkey}.{subkey}: {'None' if oldvalue is None else oldvalue} -> {value}")
if mainkey not in config:
# Initialize the main key in the dictionary if it does not already exist
config[mainkey] = {}
config[mainkey][subkey] = value
18 changes: 15 additions & 3 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

from o2dpg_workflow_utils import createTask, createGlobalInitTask, dump_workflow, adjust_RECO_environment, isActive, activate_detector, deactivate_detector, compute_n_workers, merge_dicts
from o2dpg_qc_finalization_workflow import include_all_QC_finalization
from o2dpg_sim_config import create_sim_config, create_geant_config, constructConfigKeyArg, option_if_available
from o2dpg_sim_config import create_sim_config, create_geant_config, constructConfigKeyArg, option_if_available, overwrite_config
from o2dpg_dpl_config_tools import parse_command_string, modify_dpl_command, dpl_option_from_config, TaskFinalizer

parser = argparse.ArgumentParser(description='Create an ALICE (Run3) MC simulation workflow')
Expand Down Expand Up @@ -219,6 +219,19 @@ def load_external_config(configfile):
# merge the dictionaries into anchorConfig, the latter takes precedence
merge_dicts(anchorConfig, config_overwrite)

# We still may need adjust configurations manually for consistency:
#
# * Force simpler TPC digitization of if TPC reco does not have the mc-time-gain option:
tpc_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
tpcreco_mctimegain = option_if_available('o2-tpc-reco-workflow', '--tpc-mc-time-gain', envfile=tpc_envfile)
if tpcreco_mctimegain == '':
# this was communicated by Jens Wiechula@TPC; avoids dEdX issue https://its.cern.ch/jira/browse/O2-5486 for the 2tag mechanism
print ("TPC reco does not support --tpc-mc-time-gain. Adjusting some config for TPC digitization")
overwrite_config(anchorConfig['ConfigParams'],'TPCGasParam','OxygenCont',5e-5)
overwrite_config(anchorConfig['ConfigParams'],'TPCGEMParam','TotalGainStack',2000)
overwrite_config(anchorConfig['ConfigParams'],'GPU_global','dEdxDisableResidualGain',1)
# TODO: put into it's own function for better modularity

# with the config, we'll create a task_finalizer functor
# this object takes care of customizing/finishing task command with externally given (anchor) config
task_finalizer = TaskFinalizer(anchorConfig, logger="o2dpg_config_replacements.log")
Expand Down Expand Up @@ -1169,7 +1182,6 @@ def getDigiTaskName(det):
# tpc_corr_scaling_options = ('--lumi-type 1', '')[tpcDistortionType != 0]

#<--------- TPC reco task
tpc_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
TPCRECOtask=createTask(name='tpcreco_'+str(tf), needs=tpcreconeeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], relative_cpu=3/8, mem='16000')
TPCRECOtask['cmd'] = task_finalizer([
'${O2_ROOT}/bin/o2-tpc-reco-workflow',
Expand All @@ -1185,7 +1197,7 @@ def getDigiTaskName(det):
('',' --disable-mc')[args.no_mc_labels],
tpc_corr_scaling_options,
tpc_corr_options_mc,
option_if_available('o2-tpc-reco-workflow', '--tpc-mc-time-gain', envfile=tpc_envfile)])
tpcreco_mctimegain])
workflow['stages'].append(TPCRECOtask)

#<--------- ITS reco task
Expand Down