Skip to content
Merged
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
32 changes: 22 additions & 10 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
parser.add_argument('-trigger',help='event selection: particle, external', default='')
parser.add_argument('-ini',help='generator init parameters file (full paths required), for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='')
parser.add_argument('-confKey',help='o2sim, generator or trigger configuration key values, for example: "GeneratorPythia8.config=pythia8.cfg;A.x=y"', default='')
parser.add_argument('--detectorList',help='pick which version of ALICE should be simulated', default='ALICE2')
parser.add_argument('--readoutDets',help='comma separated string of detectors readout (does not modify material budget - only hit creation)', default='all')
parser.add_argument('--make-evtpool', help='Generate workflow for event pool creation.', action='store_true')

Expand Down Expand Up @@ -515,7 +516,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
orbitsPerTF=int(args.orbitsPerTF)
GRP_TASK = createTask(name='grpcreate', cpu='0')
GRP_TASK['cmd'] = 'o2-grp-simgrp-tool createGRPs --timestamp ' + str(args.timestamp) + ' --run ' + str(args.run) + ' --publishto ${ALICEO2_CCDB_LOCALCACHE:-.ccdb} -o grp --hbfpertf ' + str(orbitsPerTF) + ' --field ' + args.field
GRP_TASK['cmd'] += ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
GRP_TASK['cmd'] += ' --detectorList ' + args.detectorList + ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
if (not args.run_anchored == True) and len(args.bcPatternFile) > 0:
GRP_TASK['cmd'] += ' --bcPatternFile ' + str(args.bcPatternFile)
if len(CONFKEYMV) > 0:
Expand Down Expand Up @@ -664,7 +665,8 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
+ ' --field ccdb ' + str(CONFKEYBKG) \
+ ('',' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run) \
+ ' --vertexMode kCCDB' \
+ ' --fromCollContext collisioncontext.root:bkg'
+ ' --fromCollContext collisioncontext.root:bkg ' \
+ ' --detectorList ' + args.detectorList

if not isActive('all'):
BKGtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors)
Expand Down Expand Up @@ -698,6 +700,9 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):

# a list of smaller sensors (used to construct digitization tasks in a parametrized way)
smallsensorlist = [ "ITS", "TOF", "FDD", "MCH", "MID", "MFT", "HMP", "PHS", "CPV", "ZDC" ]
if args.detectorList == 'ALICE2.1':
smallsensorlist = ['IT3' if sensor == 'ITS' else sensor for sensor in smallsensorlist]

# a list of detectors that serve as input for the trigger processor CTP --> these need to be processed together for now
ctp_trigger_inputlist = [ "FT0", "FV0", "EMC" ]

Expand Down Expand Up @@ -755,12 +760,15 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
# determine final conf key for QED simulation
QEDBaseConfig = "GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-7;QEDGenParam.yMax=7;QEDGenParam.ptMin=0.001;QEDGenParam.ptMax=1.;QEDGenParam.xSectionHad="+str(XSecSys[COLTYPE])+";QEDGenParam.Z="+str(Zsys[COLTYPE])+";QEDGenParam.cmEnergy="+str(ECMS)+";Diamond.width[2]=6.;"
QEDCONFKEY = constructConfigKeyArg(create_geant_config(args, QEDBaseConfig + args.confKeyQED))

qed_detectorlist = ' ITS MFT FT0 FV0 FDD '
if args.detectorList == 'ALICE2.1':
qed_detectorlist = qed_detectorlist.replace('ITS', 'IT3')
QED_task['cmd'] = 'o2-sim -e TGeant3 --field ccdb -j ' + str('1') + ' -o qed' \
+ ' -n ' + str(NEventsQED) + ' -m PIPE ITS MFT FT0 FV0 FDD ' \
+ ' -n ' + str(NEventsQED) + ' -m ' + qed_detectorlist \
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run) \
+ ' --seed ' + str(TFSEED) \
+ ' -g extgen ' \
+ ' --detectorList ' + args.detectorList \
+ QEDCONFKEY
QED_task['cmd'] += '; RC=$?; QEDXSecCheck=`grep xSectionQED qedgenparam.ini | sed \'s/xSectionQED=//\'`'
QED_task['cmd'] += '; echo "CheckXSection ' + str(QEDXSecExpected[COLTYPE]) + ' = $QEDXSecCheck"; [[ ${RC} == 0 ]]'
Expand Down Expand Up @@ -864,6 +872,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
+ ' -g ' + str(GENERATOR) + ' ' + str(INIFILE) + ' -o genevents ' + embeddinto \
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] \
+ ' --seed ' + str(TFSEED) + ' -n ' + str(NSIGEVENTS) \
+ ' --detectorList ' + args.detectorList \
+ ' --fromCollContext collisioncontext.root:' + signalprefix
if GENERATOR=="hepmc":
SGNGENtask['cmd'] += "; RC=$?; ${O2DPG_ROOT}/UTILS/UpdateHepMCEventSkip.sh ../HepMCEventSkip.json " + str(tf) + '; [[ ${RC} == 0 ]]'
Expand All @@ -885,6 +894,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
relative_cpu=7/8, n_workers=NWORKERS_TF, mem=str(sgnmem))
sgncmdbase = '${O2_ROOT}/bin/o2-sim -e ' + str(SIMENGINE) + ' ' + str(MODULES) + ' -n ' + str(NSIGEVENTS) + ' --seed ' + str(TFSEED) \
+ ' --field ccdb -j ' + str(NWORKERS_TF) + ' ' + str(CONFKEY) + ' ' + str(INIFILE) + ' -o ' + signalprefix + ' ' + embeddinto \
+ ' --detectorList ' + args.detectorList \
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run)
if sep_event_mode:
SGNtask['cmd'] = sgncmdbase + ' -g extkinO2 --extKinFile genevents_Kine.root ' + ' --vertexMode kNoVertex'
Expand Down Expand Up @@ -1071,7 +1081,7 @@ def createRestDigiTask(name, det='ALLSMALLER'):
tneeds += [QED_task['name']]
commondigicmd = '${O2_ROOT}/bin/o2-sim-digitizer-workflow ' + getDPL_global_options() + ' -n ' + str(args.ns) + simsoption \
+ ' --interactionRate ' + str(INTRATE) + ' --incontext ' + str(CONTEXTFILE) + ' --disable-write-ini' \
+ putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "ITSDigitizerParam"],
+ putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "ITSDigitizerParam" if args.detectorList == 'ALICE2' else "IT3DigitizerParam"],
localCF={"DigiParams.seed" : str(TFSEED), "MCHDigitizer.seed" : str(TFSEED)}) + QEDdigiargs

if det=='ALLSMALLER': # here we combine all smaller digits in one DPL workflow
Expand Down Expand Up @@ -1244,12 +1254,12 @@ def getDigiTaskName(det):

#<--------- ITS reco task
ITSMemEstimate = 12000 if havePbPb else 2000 # PbPb has much large mem requirement for now (in worst case)
ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("ITS")],
tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem=str(ITSMemEstimate))
ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("ITS" if args.detectorList == 'ALICE2' else "IT3")],
tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem=str(ITSMemEstimate))
ITSRECOtask['cmd'] = task_finalizer([
"${O2_ROOT}/bin/o2-its-reco-workflow",
"${O2_ROOT}/bin/o2-its-reco-workflow" if args.detectorList == 'ALICE2' else "${O2_ROOT}/bin/o2-its3-reco-workflow",
getDPL_global_options(bigshm=havePbPb),
'--trackerCA',
'--trackerCA' if args.detectorList == 'ALICE2' else '',
'--tracking-mode async',
putConfigValues(["ITSVertexerParam",
"ITSAlpideParam",
Expand Down Expand Up @@ -1287,6 +1297,7 @@ def getDigiTaskName(det):
'ITSClustererParam',
'GPU_rec_tpc',
'trackTuneParams',
'GlobalParams',
'ft0tag'],
{"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
tpc_corr_scaling_options,
Expand Down Expand Up @@ -1315,6 +1326,7 @@ def getDigiTaskName(det):
'trackTuneParams',
'GPU_rec_tpc',
'TPCGasParam',
'GlobalParams',
'TPCCorrMap'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
'--track-sources ' + trd_track_sources,
tpc_corr_scaling_options,
Expand Down Expand Up @@ -1599,7 +1611,7 @@ def getDigiTaskName(det):
[ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow',
getDPL_global_options(bigshm=True),
svfinder_threads,
putConfigValues(['svertexer', 'TPCCorrMap'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
putConfigValues(['svertexer', 'TPCCorrMap', 'GlobalParams'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
tpc_corr_scaling_options,
tpc_corr_options_mc,
'--vertexing-sources ' + svfinder_sources,
Expand Down