Skip to content

Commit 4cff388

Browse files
committed
Generalized embedding
We allow to specify some generalized embedding pattern (in case embedding is used)
1 parent 5f60b60 commit 4cff388

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
parser.add_argument('-weightPow',help='Flatten pT hard spectrum with power', default=-1)
5151

5252
parser.add_argument('--embedding',action='store_true', help='With embedding into background')
53+
parser.add_argument('--embeddPattern',help='How signal is to be injected into background', default='@0:e1')
5354
parser.add_argument('-nb',help='number of background events / timeframe', default=20)
5455
parser.add_argument('-genBkg',help='embedding background generator', default='') #pythia8, not recomended: pythia8hi, pythia8pp
5556
parser.add_argument('-procBkg',help='process type: inel, ..., do not set it for Pythia8 PbPb', default='heavy_ion')
@@ -457,10 +458,19 @@ def getDPL_global_options(bigshm=False):
457458
simsoption=' --sims ' + ('bkg,'+signalprefix if doembedding else signalprefix)
458459

459460
# This task creates the basic setup for all digitizers! all digitization configKeyValues need to be given here
460-
ContextTask=createTask(name='digicontext_'+str(tf), needs=[SGNtask['name'], LinkGRPFileTask['name']], tf=tf,
461-
cwd=timeframeworkdir, lab=["DIGI"], cpu='1')
461+
# ContextTask=createTask(name='digicontext_'+str(tf), needs=[SGNtask['name'], LinkGRPFileTask['name']], tf=tf,
462+
# cwd=timeframeworkdir, lab=["DIGI"], cpu='1')
463+
# ContextTask['cmd'] = 'o2-sim-digitizer-workflow --only-context --interactionRate ' + str(INTRATE) + ' ' + getDPL_global_options() + ' -n ' + str(args.ns) + simsoption
464+
# workflow['stages'].append(ContextTask)
465+
ContextTask = createTask(name='digicontext_'+str(tf), needs=[SGNtask['name'], LinkGRPFileTask['name']], tf=tf, cwd=timeframeworkdir, lab=["DIGI"], cpu='1')
466+
# this is just to have the digitizer ini file
462467
ContextTask['cmd'] = 'o2-sim-digitizer-workflow --only-context --interactionRate ' + str(INTRATE) + ' ' + getDPL_global_options() + ' -n ' + str(args.ns) + simsoption
463-
workflow['stages'].append(ContextTask)
468+
469+
# in case of embedding we engineer the context directly and allow the user to provide an embedding pattern
470+
# The :r flag means to shuffle the background events randomly
471+
if doembedding:
472+
ContextTask['cmd'] += ';o2-steer-colcontexttool -i bkg,' + str(INTRATE) + ',' + str(args.nb) + ':r' + str(args.nb) + ' ' + signalprefix + ',' + args.embeddPattern + ' --show-context'
473+
workflow['stages'].append(ContextTask)
464474

465475
tpcdigineeds=[ContextTask['name'], LinkGRPFileTask['name']]
466476
if usebkgcache:

0 commit comments

Comments
 (0)