Skip to content

Commit 1f8c321

Browse files
sawenzelclaude
andcommitted
Make the TPC time-series task follow the active detectors
This fixes the TRD/CTRACKLETS failure of the TPC time-series task in the MC workflow and makes its inputs follow the active detectors. - The reader used fixed cluster types without TRD, so the time series failed with "No matching output found for TRD/CTRACKLETS/0" once it requested TRD tracklets. - Track types now follow the active detectors and the anchored TRD and TOF matching sources. - The same track list goes to o2-tpc-time-series-workflow via --track-sources. - Builds with their own readers get --disable-root-input, so only one reader list exists. - TOF and TRD are optional, and the task requires ITS, TPC and FT0. - Builds without --track-sources keep the previous command and require TOF and TRD. https://its.cern.ch/jira/browse/O2-7264 #2532 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f5b3059 commit 1f8c321

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

‎MC/bin/o2dpg_sim_workflow.py‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,23 +2170,50 @@ def remove_json_prefix(path):
21702170

21712171
#<------------------ TPC - time-series objects
21722172
# initial implementation taken from comments in https://its.cern.ch/jira/browse/O2-4612
2173-
# TODO: this needs to be made configurable (as a function of which detectors are actually present)
2173+
# the inputs follow the active detectors where the time series accepts --track-sources
2174+
tpcts_sources = ''
2175+
tpcts_ownreaders = ''
2176+
if isActive("ITS") and isActive("TPC") and isActive("FT0"):
2177+
tpcts_sources = option_if_available('o2-tpc-time-series-workflow', '--track-sources', envfile=async_envfile)
2178+
tpcts_ownreaders = option_if_available('o2-tpc-time-series-workflow', '--disable-root-input', envfile=async_envfile)
2179+
if not tpcts_sources and tf == 1:
2180+
print("WARNING: o2-tpc-time-series-workflow has no --track-sources; the TPC time series runs only with TOF and TRD active")
2181+
if tpcts_sources:
2182+
# only the tracks which the TRD and TOF matching produce with the anchored configuration
2183+
trdsrc = trd_track_sources.split(',')
2184+
tofsrc = toftracksrcdefault.split(',')
2185+
tpcts_tracklist = ["ITS", "TPC", "ITS-TPC"]
2186+
tpcts_tracklist += ["ITS-TPC-TRD"] if "ITS-TPC" in trdsrc else []
2187+
tpcts_tracklist += ["ITS-TPC-TOF"] if "ITS-TPC" in tofsrc else []
2188+
tpcts_tracklist += ["ITS-TPC-TRD-TOF"] if "ITS-TPC" in trdsrc and "ITS-TPC-TRD" in tofsrc else []
2189+
tpcts_tracktypes = cleanDetectorInputList(",".join(tpcts_tracklist))
2190+
tpcts_clustertypes = "FT0,TPC"
2191+
tpcts_clustertypes += ",TOF" if "TOF" in tpcts_tracktypes else ""
2192+
tpcts_clustertypes += ",TRD" if "TRD" in tpcts_tracktypes else ""
2193+
tpcts_detectors = "ITS,TPC,FT0"
2194+
else:
2195+
# older async tags (e.g. 2023 apass4, 2024 pp apass1) always ask for TOF and TRD inputs
2196+
tpcts_tracktypes = "ITS,TPC,ITS-TPC,ITS-TPC-TOF,ITS-TPC-TRD-TOF"
2197+
tpcts_clustertypes = "FT0,TOF,TPC"
2198+
tpcts_detectors = "ITS,TPC,FT0,TOF,TRD"
21742199
tpctsneeds = [ TPCRECOtask['name'],
21752200
ITSTPCMATCHtask['name'],
2176-
TOFTPCMATCHERtask['name'],
21772201
FT0RECOtask['name'],
2178-
PVFINDERtask['name'],
2179-
TRDTRACKINGtask2['name']
2202+
PVFINDERtask['name']
21802203
]
2204+
addWhenActive("TOF", tpctsneeds, TOFTPCMATCHERtask['name'])
2205+
addWhenActive("TRD", tpctsneeds, TRDTRACKINGtask2['name'])
21812206
TPCTStask = createTask(name='tpctimeseries_'+str(tf), needs=tpctsneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='2000', cpu='1')
2182-
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"'
2207+
TPCTStask['cmd'] = f'o2-global-track-cluster-reader --disable-mc --cluster-types "{tpcts_clustertypes}" --track-types "{tpcts_tracktypes}"'
21832208
TPCTStask['cmd'] += ' --primary-vertices '
21842209
TPCTStask['cmd'] += staggITS
2185-
TPCTStask['cmd'] += ' | o2-tpc-time-series-workflow --enable-unbinned-root-output --sample-unbinned-tsallis --sampling-factor 0.01 '
2210+
# newer builds have their own readers; switch them off so that only the reader above runs
2211+
TPCTStask['cmd'] += f' | o2-tpc-time-series-workflow{tpcts_ownreaders}'
2212+
TPCTStask['cmd'] += f'{tpcts_sources} "{tpcts_tracktypes},FT0"' if tpcts_sources else ''
2213+
TPCTStask['cmd'] += ' --enable-unbinned-root-output --sample-unbinned-tsallis --sampling-factor 0.01 '
21862214
TPCTStask['cmd'] += staggITS
21872215
TPCTStask['cmd'] += putConfigValues() + ' ' + getDPL_global_options(bigshm=True)
2188-
# could be relaxed or changed once the timerseries worklow is more reactive to input cluster- and track-types
2189-
addWhenActive("TOF,TPC,FT0", workflow['stages'], TPCTStask)
2216+
addWhenActive(tpcts_detectors, workflow['stages'], TPCTStask)
21902217

21912218
# cleanup
21922219
# --------

0 commit comments

Comments
 (0)