Skip to content

Commit a60401c

Browse files
shahor02sawenzelclaude
authored
Support ITS(MFT) staggerd MC with ALIEN_JDL_ITS(MFT)_STAGGERED=1 (#2487)
* Support ITS(MFT) staggerd MC with ALIEN_JDL_ITS(MFT)_STAGGERED=1 Validated with AliceO2Group/AliceO2#15878, but the QC tasks are not yet ready for the staggered data * At the moment disable the tasks not yet ready for per-layer input * Add a workflow test with ITS and MFT staggering enabled This commit adds a CI workflow test that creates and runs a pp workflow with ALIEN_JDL_ITS_STAGGERED=1 and ALIEN_JDL_MFT_STAGGERED=1. - wf_test_pp.sh does not set the variables, so the staggering code paths of this PR were not exercised by CI. - The test is picked up automatically from MC/bin/tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Sandro Wenzel <sandro.wenzel@cern.ch> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent ca01439 commit a60401c

2 files changed

Lines changed: 79 additions & 18 deletions

File tree

‎MC/bin/o2dpg_sim_workflow.py‎

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,20 @@ def load_external_config(configfile):
241241
# merge the dictionaries into anchorConfig, the latter takes precedence
242242
merge_dicts(anchorConfig, config_overwrite)
243243

244+
async_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
245+
246+
# Check if either ITS or MFT are in the staggered mode (either from the async reco workflow or imposed externally).
247+
# Note thas some QC tracks at the moment need to be suppressed in this mode
248+
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 ''
249+
# MFT still needs to update its reconstruction to account for per-layer input, uncomment line below whtb it is ready and remove "Ignoring ..." stuff.
250+
#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 ''
251+
#if environ.get('ALIEN_JDL_MFT_STAGGERED') == '1':
252+
# print ("Ignoring ALIEN_JDL_MFT_STAGGERED as the MFT reconstruction is not yet ready to take it")
253+
staggMFT = ''
254+
244255
# We still may need adjust configurations manually for consistency:
245256
#
246257
# * 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:
247-
async_envfile = 'env_async.env' if environ.get('ALIEN_JDL_O2DPG_ASYNC_RECO_TAG') is not None else None
248258
tpcreco_mctimegain = option_if_available('o2-tpc-reco-workflow', '--tpc-mc-time-gain', envfile=async_envfile)
249259
if tpcreco_mctimegain == '':
250260
# TODO: Upload all MC time gain objects to TestReco and remove year dependence
@@ -1203,6 +1213,10 @@ def createRestDigiTask(name, det='ALLSMALLER'):
12031213
detlist = ','.join(smallsensorlist)
12041214
detlist = cleanDetectorInputList(detlist)
12051215
t['cmd'] += commondigicmd + ' --onlyDet ' + detlist
1216+
if 'ITS' in detlist:
1217+
t['cmd'] += staggITS
1218+
if 'MFT' in detlist:
1219+
t['cmd'] += staggMFT
12061220
t['cmd'] += ' --ccdb-tof-sa --forceSelectedDets '
12071221
t['cmd'] += (' --combine-devices ','')[args.no_combine_dpl_devices]
12081222
t['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
@@ -1215,6 +1229,10 @@ def createRestDigiTask(name, det='ALLSMALLER'):
12151229
t = createTask(name=name, needs=tneeds, tf=tf, cwd=timeframeworkdir, lab=["DIGI","SMALLDIGI"], cpu='1')
12161230
t['cmd'] = ('','ln -nfs ../bkg_Hits' + str(det) + '.root . ;')[doembedding]
12171231
t['cmd'] += commondigicmd + ' --onlyDet ' + str(det)
1232+
if det == 'ITS':
1233+
t['cmd'] += staggITS
1234+
if det == 'MFT':
1235+
t['cmd'] += staggMFT
12181236
t['cmd'] += ('',' --disable-mc')[args.no_mc_labels]
12191237
if det == 'TOF':
12201238
t['cmd'] += ' --ccdb-tof-sa'
@@ -1374,7 +1392,7 @@ def getDigiTaskName(det):
13741392
TPCSyncRECOtask['cmd'] = '${O2_ROOT}/bin/o2-tpc-reco-workflow ' + getDPL_global_options(bigshm=True, ccdbbackend=False, runcommand=False) \
13751393
+ '--input-type clusters --output-type clusters,disable-writer ' \
13761394
+ putConfigValues()
1377-
TPCSyncRECOtask['cmd'] += ' | ${O2_ROOT}/bin/o2-gpu-reco-workflow' + getDPL_global_options(bigshm=True, ccdbbackend=True, runcommand=False) \
1395+
TPCSyncRECOtask['cmd'] += ' | ${O2_ROOT}/bin/o2-gpu-reco-workflow ' + getDPL_global_options(bigshm=True, ccdbbackend=True, runcommand=False) \
13781396
+ '--input-type clusters --output-type compressed-clusters-flat,clusters,send-clusters-per-sector --filtered-output-specs ' \
13791397
+ tpc_corr_scaling_options + ' ' + tpc_corr_options_mc \
13801398
+ putConfigValues(["TPCGasParam", "TPCCorrMap", "trackTuneParams"],
@@ -1414,6 +1432,7 @@ def getDigiTaskName(det):
14141432
ITSRECOtask['cmd'] = task_finalizer([
14151433
"${O2_ROOT}/bin/o2-its-reco-workflow" if args.detectorList == 'ALICE2' else "${O2_ROOT}/bin/o2-its3-reco-workflow",
14161434
getDPL_global_options(bigshm=havePbPb),
1435+
staggITS,
14171436
'--tracking-mode async',
14181437
putConfigValues(["ITSVertexerParam",
14191438
"ITSAlpideParam",
@@ -1439,6 +1458,7 @@ def getDigiTaskName(det):
14391458
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)
14401459
ITSTPCMATCHtask["cmd"] = task_finalizer([
14411460
'${O2_ROOT}/bin/o2-tpcits-match-workflow',
1461+
staggITS,
14421462
getDPL_global_options(bigshm=True),
14431463
' --tpc-track-reader tpctracks.root',
14441464
'--tpc-native-cluster-reader \"--infile tpc-native-clusters.root\"',
@@ -1474,6 +1494,7 @@ def getDigiTaskName(det):
14741494
TRDTRACKINGtask2['cmd'] = task_finalizer([
14751495
'${O2_ROOT}/bin/o2-trd-global-tracking',
14761496
getDPL_global_options(bigshm=True),
1497+
staggITS,
14771498
('',' --disable-mc')[args.no_mc_labels],
14781499
putConfigValues(['ITSClustererParam',
14791500
'ITSCATrackerParam',
@@ -1537,6 +1558,7 @@ def getDigiTaskName(det):
15371558
MFTRECOtask['cmd'] += task_finalizer([
15381559
'${O2_ROOT}/bin/o2-mft-reco-workflow',
15391560
getDPL_global_options(),
1561+
staggMFT,
15401562
putConfigValues(['MFTTracking',
15411563
'MFTAlpideParam',
15421564
'ITSClustererParam',
@@ -1664,6 +1686,7 @@ def getDigiTaskName(det):
16641686
MFTMCHMATCHtask = createTask(name='mftmchMatch_'+str(tf), needs=forwardmatchneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1500')
16651687
MFTMCHMATCHtask['cmd'] = task_finalizer(
16661688
['${O2_ROOT}/bin/o2-globalfwd-matcher-workflow',
1689+
staggMFT,
16671690
putConfigValues(['ITSAlpideConfig',
16681691
'MFTAlpideConfig',
16691692
'FwdMatching'],{"FwdMatching.useMIDMatch": "true" if isActive("MID") else "false"}),
@@ -1679,7 +1702,7 @@ def getDigiTaskName(det):
16791702

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

@@ -1769,6 +1792,7 @@ def getDigiTaskName(det):
17691792
SVFINDERtask = createTask(name='svfinder_'+str(tf), needs=[PVFINDERtask['name'], FT0FV0EMCCTPDIGItask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu=svfinder_cpu, mem='5000')
17701793
SVFINDERtask['cmd'] = task_finalizer(
17711794
[ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow',
1795+
staggITS,
17721796
getDPL_global_options(bigshm=True),
17731797
svfinder_threads,
17741798
putConfigValues(['svertexer', 'TPCCorrMap', 'GlobalParams'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
@@ -1825,6 +1849,8 @@ def getDigiTaskName(det):
18251849
AODtask['cmd'] += '[ -f AO2D.root ] && rm AO2D.root; '
18261850
AODtask['cmd'] += task_finalizer([
18271851
"${O2_ROOT}/bin/o2-aod-producer-workflow",
1852+
staggITS,
1853+
staggMFT,
18281854
"--reco-mctracks-only 1",
18291855
"--aod-writer-keep dangling",
18301856
"--aod-writer-resfile AO2D",
@@ -1934,24 +1960,25 @@ def remove_json_prefix(path):
19341960
### MFT
19351961

19361962
# to be enabled once MFT Digits should run 5 times with different configurations
1937-
if isActive("MFT"):
1963+
# At the moment QC does not support per-layer digits/clusters, disable these tasks if staggering is requested
1964+
if isActive("MFT") and not staggMFT:
19381965
for flp in range(5):
19391966
addQCPerTF(taskName='mftDigitsQC' + str(flp),
1940-
needs=[getDigiTaskName("MFT")],
1941-
readerCommand='o2-qc-mft-digits-root-file-reader --mft-digit-infile=mftdigits.root',
1942-
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-digits-' + str(flp) + '.json',
1943-
objectsFile='mftDigitsQC.root')
1967+
needs=[getDigiTaskName("MFT")],
1968+
readerCommand='o2-qc-mft-digits-root-file-reader --mft-digit-infile=mftdigits.root' + staggMFT,
1969+
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-digits-' + str(flp) + '.json',
1970+
objectsFile='mftDigitsQC.root')
19441971
addQCPerTF(taskName='mftClustersQC',
19451972
needs=[MFTRECOtask['name']],
1946-
readerCommand='o2-global-track-cluster-reader --track-types none --cluster-types MFT',
1973+
readerCommand='o2-global-track-cluster-reader --track-types none --cluster-types MFT' + staggMFT,
19471974
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-clusters.json')
19481975
addQCPerTF(taskName='mftTracksQC',
19491976
needs=[MFTRECOtask['name']],
1950-
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT',
1977+
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT' + staggMFT,
19511978
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-tracks.json')
19521979
addQCPerTF(taskName='mftMCTracksQC',
19531980
needs=[MFTRECOtask['name']],
1954-
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT',
1981+
readerCommand='o2-global-track-cluster-reader --track-types MFT --cluster-types MFT' + staggMFT,
19551982
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mft-tracks-mc.json')
19561983

19571984
### TPC
@@ -2062,13 +2089,15 @@ def remove_json_prefix(path):
20622089
### ITS
20632090
addQCPerTF(taskName='ITSTrackSimTaskQC',
20642091
needs=[ITSRECOtask['name']],
2065-
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"',
2092+
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"' + staggITS,
20662093
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/its-mc-tracks-qc.json')
20672094

2068-
addQCPerTF(taskName='ITSTracksClustersQC',
2069-
needs=[ITSRECOtask['name']],
2070-
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"',
2071-
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/its-clusters-tracks-qc.json')
2095+
# At the moment QC does not support per-layer digits/clusters, disable these tasks if staggering is requested
2096+
if not staggITS:
2097+
addQCPerTF(taskName='ITSTracksClustersQC',
2098+
needs=[ITSRECOtask['name']],
2099+
readerCommand='o2-global-track-cluster-reader --track-types "ITS" --cluster-types "ITS"' + staggITS,
2100+
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/its-clusters-tracks-qc.json')
20722101

20732102
### CPV
20742103
if isActive('CPV'):
@@ -2125,12 +2154,12 @@ def remove_json_prefix(path):
21252154
if isActive('MCH') and isActive('MID') and isActive('MFT') :
21262155
addQCPerTF(taskName='MUONTracksMFTTaskQC',
21272156
needs=[MFTMCHMATCHtask['name'], MCHMIDMATCHtask['name']],
2128-
readerCommand='o2-global-track-cluster-reader --track-types "MFT,MCH,MID,MCH-MID,MFT-MCH,MFT-MCH-MID" --cluster-types "MCH,MID,MFT"',
2157+
readerCommand='o2-global-track-cluster-reader --track-types "MFT,MCH,MID,MCH-MID,MFT-MCH,MFT-MCH-MID" --cluster-types "MCH,MID,MFT"' + staggMFT,
21292158
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mftmchmid-tracks-task.json')
21302159
elif isActive('MCH') and isActive('MFT') :
21312160
addQCPerTF(taskName='MCHMFTTaskQC',
21322161
needs=[MFTMCHMATCHtask['name']],
2133-
readerCommand='o2-global-track-cluster-reader --track-types "MCH,MFT,MFT-MCH" --cluster-types "MCH,MFT"',
2162+
readerCommand='o2-global-track-cluster-reader --track-types "MCH,MFT,MFT-MCH" --cluster-types "MCH,MFT"' + staggMFT,
21342163
configFilePath='json://${O2DPG_ROOT}/MC/config/QC/json/mftmch-tracks-task.json')
21352164

21362165

@@ -2147,7 +2176,9 @@ def remove_json_prefix(path):
21472176
TPCTStask = createTask(name='tpctimeseries_'+str(tf), needs=tpctsneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='2000', cpu='1')
21482177
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"'
21492178
TPCTStask['cmd'] += ' --primary-vertices '
2179+
TPCTStask['cmd'] += staggITS
21502180
TPCTStask['cmd'] += ' | o2-tpc-time-series-workflow --enable-unbinned-root-output --sample-unbinned-tsallis --sampling-factor 0.01 '
2181+
TPCTStask['cmd'] += staggITS
21512182
TPCTStask['cmd'] += putConfigValues() + ' ' + getDPL_global_options(bigshm=True)
21522183
# could be relaxed or changed once the timerseries worklow is more reactive to input cluster- and track-types
21532184
addWhenActive("TOF,TPC,FT0", workflow['stages'], TPCTStask)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
#
4+
# A pp workflow MC->RECO->AOD with ITS and MFT staggering enabled
5+
#
6+
7+
# make sure O2DPG + O2 is loaded
8+
[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
9+
[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1
10+
11+
12+
# ----------- START ACTUAL JOB -----------------------------
13+
14+
NSIGEVENTS=${NSIGEVENTS:-5}
15+
SIGPROC=${SIGPROC:-cdiff}
16+
NTIMEFRAMES=${NTIMEFRAMES:-2}
17+
SIMENGINE=${SIMENGINE:-TGeant3}
18+
NWORKERS=${NWORKERS:-1}
19+
SEED=${SEED:-624}
20+
INTERACTIONRATE=${INTERACTIONRATE:-50000}
21+
22+
# enable ITS and MFT staggering in all consumers
23+
export ALIEN_JDL_ITS_STAGGERED=1
24+
export ALIEN_JDL_MFT_STAGGERED=1
25+
26+
# create workflow
27+
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM 5020 -col pp -gen pythia8 -proc ${SIGPROC} -ns ${NSIGEVENTS} \
28+
-tf ${NTIMEFRAMES} -e ${SIMENGINE} -j ${NWORKERS} -seed ${SEED} \
29+
--include-analysis -run 310000 -interactionRate ${INTERACTIONRATE} \
30+
--include-local-qc

0 commit comments

Comments
 (0)