Skip to content
Open
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
42 changes: 32 additions & 10 deletions MC/bin/o2dpg_sim_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,14 @@ def load_external_config(configfile):
# merge the dictionaries into anchorConfig, the latter takes precedence
merge_dicts(anchorConfig, config_overwrite)

async_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
# Check if either ITS or MFT are in the staggered mode (either from the async reco workflow or imposed externally)
staggITS = ' --enable-its-staggering ' if environ.get('ALIEN_JDL_ITS_STAGGERED') == '1' and option_if_available('o2-its-reco-workflow', '--enable-its-staggering', envfile=async_envfile) != '' else ''
staggMFT = ' --enable-mft-staggering ' if environ.get('ALIEN_JDL_MFT_STAGGERED') == '1' and option_if_available('o2-mft-reco-workflow', '--enable-mft-staggering', envfile=async_envfile) != '' else ''

# 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 or remap to a different CCDB object if we are anchored to 2023:
async_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=async_envfile)
if tpcreco_mctimegain == '':
# TODO: Upload all MC time gain objects to TestReco and remove year dependence
Expand Down Expand Up @@ -1203,6 +1207,10 @@ def createRestDigiTask(name, det='ALLSMALLER'):
detlist = ','.join(smallsensorlist)
detlist = cleanDetectorInputList(detlist)
t['cmd'] += commondigicmd + ' --onlyDet ' + detlist
if 'ITS' in detlist:
t['cmd'] += staggITS
if 'MFT' in detlist:
t['cmd'] += staggMFT
t['cmd'] += ' --ccdb-tof-sa --forceSelectedDets '
t['cmd'] += (' --combine-devices ','')[args.no_combine_dpl_devices]
t['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
Expand All @@ -1215,6 +1223,10 @@ def createRestDigiTask(name, det='ALLSMALLER'):
t = createTask(name=name, needs=tneeds, tf=tf, cwd=timeframeworkdir, lab=["DIGI","SMALLDIGI"], cpu='1')
t['cmd'] = ('','ln -nfs ../bkg_Hits' + str(det) + '.root . ;')[doembedding]
t['cmd'] += commondigicmd + ' --onlyDet ' + str(det)
if det == 'ITS':
t['cmd'] += staggITS
if det == 'MFT':
t['cmd'] += staggMFT
t['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
if det == 'TOF':
t['cmd'] += ' --ccdb-tof-sa'
Expand Down Expand Up @@ -1374,7 +1386,7 @@ def getDigiTaskName(det):
TPCSyncRECOtask['cmd'] = '${O2_ROOT}/bin/o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, ccdbbackend=False, runcommand=False) \
+ '--input-type clusters --output-type clusters,disable-writer ' \
+ putConfigValues()
TPCSyncRECOtask['cmd'] += ' | ${O2_ROOT}/bin/o2-gpu-reco-workflow' + getDPL_global_options(bigshm=True, ccdbbackend=True, runcommand=False) \
TPCSyncRECOtask['cmd'] += ' | ${O2_ROOT}/bin/o2-gpu-reco-workflow ' + getDPL_global_options(bigshm=True, ccdbbackend=True, runcommand=False) \
+ '--input-type clusters --output-type compressed-clusters-flat,clusters,send-clusters-per-sector --filtered-output-specs ' \
+ tpc_corr_scaling_options + ' ' + tpc_corr_options_mc \
+ putConfigValues(["TPCGasParam", "TPCCorrMap", "trackTuneParams"],
Expand Down Expand Up @@ -1414,6 +1426,7 @@ def getDigiTaskName(det):
ITSRECOtask['cmd'] = task_finalizer([
"${O2_ROOT}/bin/o2-its-reco-workflow" if args.detectorList == 'ALICE2' else "${O2_ROOT}/bin/o2-its3-reco-workflow",
getDPL_global_options(bigshm=havePbPb),
staggITS,
'--tracking-mode async',
putConfigValues(["ITSVertexerParam",
"ITSAlpideParam",
Expand All @@ -1439,6 +1452,7 @@ def getDigiTaskName(det):
ITSTPCMATCHtask=createTask(name='itstpcMatch_'+str(tf), needs=[TPCRECOtask['name'], ITSRECOtask['name'], FT0RECOtask['name'] if isActive("FT0") else None], tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='8000', relative_cpu=3/8)
ITSTPCMATCHtask["cmd"] = task_finalizer([
'${O2_ROOT}/bin/o2-tpcits-match-workflow',
staggITS,
getDPL_global_options(bigshm=True),
' --tpc-track-reader tpctracks.root',
'--tpc-native-cluster-reader \"--infile tpc-native-clusters.root\"',
Expand Down Expand Up @@ -1474,6 +1488,7 @@ def getDigiTaskName(det):
TRDTRACKINGtask2['cmd'] = task_finalizer([
'${O2_ROOT}/bin/o2-trd-global-tracking',
getDPL_global_options(bigshm=True),
staggITS,
('',' --disable-mc')[args.no_mc_labels],
putConfigValues(['ITSClustererParam',
'ITSCATrackerParam',
Expand Down Expand Up @@ -1537,6 +1552,7 @@ def getDigiTaskName(det):
MFTRECOtask['cmd'] += task_finalizer([
'${O2_ROOT}/bin/o2-mft-reco-workflow',
getDPL_global_options(),
staggMFT,
putConfigValues(['MFTTracking',
'MFTAlpideParam',
'ITSClustererParam',
Expand Down Expand Up @@ -1664,6 +1680,7 @@ def getDigiTaskName(det):
MFTMCHMATCHtask = createTask(name='mftmchMatch_'+str(tf), needs=forwardmatchneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1500')
MFTMCHMATCHtask['cmd'] = task_finalizer(
['${O2_ROOT}/bin/o2-globalfwd-matcher-workflow',
staggMFT,
putConfigValues(['ITSAlpideConfig',
'MFTAlpideConfig',
'FwdMatching'],{"FwdMatching.useMIDMatch": "true" if isActive("MID") else "false"}),
Expand All @@ -1679,7 +1696,7 @@ def getDigiTaskName(det):

if args.fwdmatching_save_trainingdata == True:
MFTMCHMATCHTraintask = createTask(name='mftmchMatchTrain_'+str(tf), needs=[MCHMIDMATCHtask['name'], MFTRECOtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1500')
MFTMCHMATCHTraintask['cmd'] = '${O2_ROOT}/bin/o2-globalfwd-matcher-workflow ' + putConfigValues(['ITSAlpideConfig','MFTAlpideConfig'],{"FwdMatching.useMIDMatch":"true"})
MFTMCHMATCHTraintask['cmd'] = '${O2_ROOT}/bin/o2-globalfwd-matcher-workflow ' + staggMFT + putConfigValues(['ITSAlpideConfig','MFTAlpideConfig'],{"FwdMatching.useMIDMatch":"true"})
MFTMCHMATCHTraintask['cmd']+= getDPL_global_options()
workflow['stages'].append(MFTMCHMATCHTraintask)

Expand Down Expand Up @@ -1769,6 +1786,7 @@ def getDigiTaskName(det):
SVFINDERtask = createTask(name='svfinder_'+str(tf), needs=[PVFINDERtask['name'], FT0FV0EMCCTPDIGItask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu=svfinder_cpu, mem='5000')
SVFINDERtask['cmd'] = task_finalizer(
[ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow',
staggITS,
getDPL_global_options(bigshm=True),
svfinder_threads,
putConfigValues(['svertexer', 'TPCCorrMap', 'GlobalParams'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
Expand Down Expand Up @@ -1825,6 +1843,8 @@ def getDigiTaskName(det):
AODtask['cmd'] += '[ -f AO2D.root ] && rm AO2D.root; '
AODtask['cmd'] += task_finalizer([
"${O2_ROOT}/bin/o2-aod-producer-workflow",
staggITS,
staggMFT,
"--reco-mctracks-only 1",
"--aod-writer-keep dangling",
"--aod-writer-resfile AO2D",
Expand Down Expand Up @@ -1943,15 +1963,15 @@ def remove_json_prefix(path):
objectsFile='mftDigitsQC.root')
addQCPerTF(taskName='mftClustersQC',
needs=[MFTRECOtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types none --cluster-types MFT',
readerCommand='o2-global-track-cluster-reader --track-types none --cluster-types MFT' + staggMFT,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-clusters.json')
addQCPerTF(taskName='mftTracksQC',
needs=[MFTRECOtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT',
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT' + staggMFT,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-tracks.json')
addQCPerTF(taskName='mftMCTracksQC',
needs=[MFTRECOtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT',
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT' + staggMFT,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-tracks-mc.json')

### TPC
Expand Down Expand Up @@ -2062,12 +2082,12 @@ def remove_json_prefix(path):
### ITS
addQCPerTF(taskName='ITSTrackSimTaskQC',
needs=[ITSRECOtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"',
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"' + staggITS,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/its-mc-tracks-qc.json')

addQCPerTF(taskName='ITSTracksClustersQC',
needs=[ITSRECOtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"',
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"' + staggITS,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/its-clusters-tracks-qc.json')

### CPV
Expand Down Expand Up @@ -2125,12 +2145,12 @@ def remove_json_prefix(path):
if isActive('MCH') and isActive('MID') and isActive('MFT') :
addQCPerTF(taskName='MUONTracksMFTTaskQC',
needs=[MFTMCHMATCHtask['name'], MCHMIDMATCHtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types "MFT,MCH,MID,MCH-MID,MFT-MCH,MFT-MCH-MID" --cluster-types "MCH,MID,MFT"',
readerCommand='o2-global-track-cluster-reader --track-types "MFT,MCH,MID,MCH-MID,MFT-MCH,MFT-MCH-MID" --cluster-types "MCH,MID,MFT"' + staggMFT,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mftmchmid-tracks-task.json')
elif isActive('MCH') and isActive('MFT') :
addQCPerTF(taskName='MCHMFTTaskQC',
needs=[MFTMCHMATCHtask['name']],
readerCommand='o2-global-track-cluster-reader --track-types "MCH,MFT,MFT-MCH" --cluster-types "MCH,MFT"',
readerCommand='o2-global-track-cluster-reader --track-types "MCH,MFT,MFT-MCH" --cluster-types "MCH,MFT"' + staggMFT,
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mftmch-tracks-task.json')


Expand All @@ -2147,7 +2167,9 @@ def remove_json_prefix(path):
TPCTStask = createTask(name='tpctimeseries_'+str(tf), needs=tpctsneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='2000', cpu='1')
TPCTStask['cmd'] = 'o2-global-track-cluster-reader --disable-mc --cluster-types "FT0,TOF,TPC" --track-types "ITS,TPC,ITS-TPC,ITS-TPC-TOF,ITS-TPC-TRD-TOF"'
TPCTStask['cmd'] += ' --primary-vertices '
TPCTStask['cmd'] += staggITS
TPCTStask['cmd'] += ' | o2-tpc-time-series-workflow --enable-unbinned-root-output --sample-unbinned-tsallis --sampling-factor 0.01 '
TPCTStask['cmd'] += staggITS
TPCTStask['cmd'] += putConfigValues() + ' ' + getDPL_global_options(bigshm=True)
# could be relaxed or changed once the timerseries worklow is more reactive to input cluster- and track-types
addWhenActive("TOF,TPC,FT0", workflow['stages'], TPCTStask)
Expand Down
Loading