Skip to content

Commit ed05538

Browse files
committed
Special TPC settings for digitizer when TPC reco does not have mc-time-gain
Adapt TPC digi setting to a situation when TPC reco does not have mc-time-gain. This can be the case in 2tag scenarios: The digitizer comes from a more recent software release than the reconstruction. Should address dEdx issue described in https://its.cern.ch/jira/browse/O2-5486
1 parent 7e3511e commit ed05538

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

MC/bin/o2dpg_sim_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,14 @@ def get_dpl_options_for_executable(executable, envfile):
212212
def option_if_available(executable, option, envfile = None):
213213
"""Checks if an option is available for a given executable and returns it as a string. Otherwise empty string"""
214214
_, inverse_lookup = get_dpl_options_for_executable(executable, envfile)
215-
return ' ' + option if option in inverse_lookup else ''
215+
return ' ' + option if option in inverse_lookup else ''
216+
217+
218+
# helper function to overwrite some values; prints out stuff that it changes
219+
def overwrite_config(config, mainkey, subkey, value):
220+
oldvalue = config.get(mainkey,{}).get(subkey, None)
221+
print (f"Overwriting {mainkey}.{subkey}: {'None' if oldvalue is None else oldvalue} -> {value}")
222+
if mainkey not in config:
223+
# Initialize the main key in the dictionary if it does not already exist
224+
config[mainkey] = {}
225+
config[mainkey][subkey] = value

MC/bin/o2dpg_sim_workflow.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
from o2dpg_workflow_utils import createTask, createGlobalInitTask, dump_workflow, adjust_RECO_environment, isActive, activate_detector, deactivate_detector, compute_n_workers, merge_dicts
4444
from o2dpg_qc_finalization_workflow import include_all_QC_finalization
45-
from o2dpg_sim_config import create_sim_config, create_geant_config, constructConfigKeyArg, option_if_available
45+
from o2dpg_sim_config import create_sim_config, create_geant_config, constructConfigKeyArg, option_if_available, overwrite_config
4646
from o2dpg_dpl_config_tools import parse_command_string, modify_dpl_command, dpl_option_from_config, TaskFinalizer
4747

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

222+
# We still may need adjust configurations manually for consistency:
223+
#
224+
# * Force simpler TPC digitization of if TPC reco does not have the mc-time-gain option:
225+
tpc_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
226+
tpcreco_mctimegain = option_if_available('o2-tpc-reco-workflow', '--tpc-mc-time-gain', envfile=tpc_envfile)
227+
if tpcreco_mctimegain == '':
228+
# this was communicated by Jens Wiechula@TPC; avoids dEdX issue https://its.cern.ch/jira/browse/O2-5486 for the 2tag mechanism
229+
print ("TPC reco does not support --tpc-mc-time-gain. Adjusting some config for TPC digitization")
230+
overwrite_config(anchorConfig['ConfigParams'],'TPCGasParam','OxygenCont',5e-5)
231+
overwrite_config(anchorConfig['ConfigParams'],'TPCGEMParam','TotalGainStack',2000)
232+
overwrite_config(anchorConfig['ConfigParams'],'GPU_global','dEdxDisableResidualGain',1)
233+
# TODO: put into it's own function for better modularity
234+
222235
# with the config, we'll create a task_finalizer functor
223236
# this object takes care of customizing/finishing task command with externally given (anchor) config
224237
task_finalizer = TaskFinalizer(anchorConfig, logger="o2dpg_config_replacements.log")
@@ -1169,7 +1182,6 @@ def getDigiTaskName(det):
11691182
# tpc_corr_scaling_options = ('--lumi-type 1', '')[tpcDistortionType != 0]
11701183

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

11911203
#<--------- ITS reco task

0 commit comments

Comments
 (0)