Skip to content

Commit f5c83e8

Browse files
authored
add protections and exit in case of missing parameters, remove defaul… (#62)
* add protections and exit in case of missing parameters, remove default value of generator * add explicit setting of signal generator, since embedding test change energy to 5 TeV, add possiblity to change pythia process
1 parent d643155 commit f5c83e8

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
parser = argparse.ArgumentParser(description='Create an ALICE (Run3) MC simulation workflow')
2626

2727
parser.add_argument('-ns',help='number of signal events / timeframe', default=20)
28-
parser.add_argument('-gen',help='generator: pythia8, extgen', default='pythia8')
28+
parser.add_argument('-gen',help='generator: pythia8, extgen', default='')
2929
parser.add_argument('-proc',help='process type: dirgamma, jets, ccbar', default='')
3030
parser.add_argument('-trigger',help='event selection: particle, external', default='')
3131
parser.add_argument('-ini',help='generator init parameters file, for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='')
@@ -47,9 +47,9 @@
4747

4848
parser.add_argument('--embedding',action='store_true', help='With embedding into background')
4949
parser.add_argument('-nb',help='number of background events / timeframe', default=20)
50-
parser.add_argument('-genBkg',help='generator', default='pythia8hi')
51-
parser.add_argument('-iniBkg',help='generator init parameters file', default='${O2DPG_ROOT}/MC/config/common/ini/basic.ini')
52-
parser.add_argument('-colBkg',help='collision system: collision type of bkg in case of embedding', default='PbPb')
50+
parser.add_argument('-genBkg',help='embedding background generator', default='pythia8hi')
51+
parser.add_argument('-iniBkg',help='embedding background generator init parameters file', default='${O2DPG_ROOT}/MC/config/common/ini/basic.ini')
52+
parser.add_argument('-colBkg',help='embedding background collision system', default='PbPb')
5353

5454
parser.add_argument('-e',help='simengine', default='TGeant4')
5555
parser.add_argument('-tf',help='number of timeframes', default=2)
@@ -115,6 +115,10 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
115115
# ---- do background transport task -------
116116
NBKGEVENTS=args.nb
117117
GENBKG=args.genBkg
118+
if GENBKG =='':
119+
print('o2dpg_sim_workflow: Error! embedding background generator name not provided')
120+
exit(1)
121+
118122
INIBKG=args.iniBkg
119123
BKGtask=createTask(name='bkgsim', lab=["GEANT"], cpu='8')
120124
BKGtask['cmd']='o2-sim -e ' + SIMENGINE + ' -j ' + str(NWORKERS) + ' -n ' + str(NBKGEVENTS) + ' -g ' + str(GENBKG) + ' ' + str(MODULES) + ' -o bkg --configFile ' + str(INIBKG)
@@ -175,6 +179,10 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
175179
EBEAMB=float(args.eB)
176180
NSIGEVENTS=args.ns
177181
GENERATOR=args.gen
182+
if GENERATOR =='':
183+
print('o2dpg_sim_workflow: Error! generator name not provided')
184+
exit(1)
185+
178186
INIFILE=''
179187
if args.ini!= '':
180188
INIFILE=' --configFile ' + args.ini
@@ -272,7 +280,7 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
272280
# produce the signal configuration
273281
SGN_CONFIG_task=createTask(name='gensgnconf_'+str(tf), tf=tf, cwd=timeframeworkdir)
274282
SGN_CONFIG_task['cmd'] = 'echo "placeholder / dummy task"'
275-
if GENERATOR == 'pythia8':
283+
if GENERATOR == 'pythia8' and PROCESS!='':
276284
SGN_CONFIG_task['cmd'] = '${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \
277285
--output=pythia8.cfg \
278286
--seed='+str(RNDSEED)+' \
@@ -292,6 +300,10 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
292300
# NOTE: Generator setup might be handled in a different file or different files (one per
293301
# possible generator)
294302

303+
if CONFKEY=='':
304+
print('o2dpg_sim_workflow: Error! configuration file not provided')
305+
exit(1)
306+
295307
workflow['stages'].append(SGN_CONFIG_task)
296308

297309
# -----------------

MC/run/PWGHF/embedding_benchmark.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ NWORKERS=${NWORKERS:-8}
2121
NBKGEVENTS=${NBKGEVENTS:-20}
2222
MODULES="--skipModules ZDC"
2323
SIMENGINE=${SIMENGINE:-TGeant4}
24+
PYPROCESS=${PYPROCESS:-ccbar} #ccbar, bbar, ...
2425

2526
# create workflow
26-
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM 13000 -col pp -proc ccbar -tf ${NTIMEFRAMES} -nb ${NBKGEVENTS} \
27+
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM 5020 -col pp -gen pythia8 -proc ${PYPROCESS} -tf ${NTIMEFRAMES} -nb ${NBKGEVENTS} \
2728
-ns ${NSIGEVENTS} -e ${SIMENGINE} \
2829
-j ${NWORKERS} --embedding -interactionRate 50000
2930

0 commit comments

Comments
 (0)