Skip to content

Commit c2f0bca

Browse files
committed
Take out CPV, PHS, ZDC from workflow when they are not in the run
This commit removes CPV, PHS and ZDC from the simulation workflow when these detectors are not part of the data taking. Fixes https://its.cern.ch/jira/browse/O2-6145 Previusly we treated this scenario with zero-hit propagation, but this could still lead to noise-digits leading to some spurios AOD entries.
1 parent 04b9d6b commit c2f0bca

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,18 @@ def load_external_config(configfile):
276276
for det in activeDetectors:
277277
activate_detector(det)
278278

279+
# function to finalize detector source lists based on activeDetectors
280+
# detector source lists are comma separated lists of DET1, DET2, DET1-DET2, ...
281+
def cleanDetectorInputList(inputlist):
282+
sources_list = inputlist.split(",")
283+
# Filter the sources
284+
filtered_sources = [
285+
src for src in sources_list
286+
if all(isActive(part) for part in src.split("-"))
287+
]
288+
# Recompose into a comma-separated string
289+
return ",".join(filtered_sources)
290+
279291
if not args.with_ZDC:
280292
# deactivate to be able to use isActive consistently for ZDC
281293
deactivate_detector('ZDC')
@@ -1071,6 +1083,7 @@ def createRestDigiTask(name, det='ALLSMALLER'):
10711083
t['cmd'] = ('','ln -nfs ../bkg_Hits*.root . ;')[doembedding]
10721084
detlist = ''
10731085
detlist = ','.join(smallsensorlist)
1086+
detlist = cleanDetectorInputList(detlist)
10741087
t['cmd'] += commondigicmd + ' --onlyDet ' + detlist
10751088
t['cmd'] += ' --ccdb-tof-sa --forceSelectedDets '
10761089
t['cmd'] += (' --combine-devices ','')[args.no_combine_dpl_devices]
@@ -1292,7 +1305,7 @@ def getDigiTaskName(det):
12921305
#<--------- TRD global tracking
12931306
# FIXME This is so far a workaround to avoud a race condition for trdcalibratedtracklets.root
12941307
TRDTRACKINGtask2 = createTask(name='trdreco2_'+str(tf), needs=[TRDTRACKINGtask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem='2000')
1295-
trd_track_sources = dpl_option_from_config(anchorConfig, 'o2-trd-global-tracking', 'track-sources', default_value='TPC,ITS-TPC')
1308+
trd_track_sources = cleanDetectorInputList(dpl_option_from_config(anchorConfig, 'o2-trd-global-tracking', 'track-sources', default_value='TPC,ITS-TPC'))
12961309
TRDTRACKINGtask2['cmd'] = task_finalizer([
12971310
'${O2_ROOT}/bin/o2-trd-global-tracking',
12981311
getDPL_global_options(bigshm=True),
@@ -1445,7 +1458,8 @@ def getDigiTaskName(det):
14451458
getDPL_global_options(),
14461459
putConfigValues(),
14471460
('',' --disable-mc')[args.no_mc_labels]])
1448-
workflow['stages'].append(PHSRECOtask)
1461+
if isActive("PHS"):
1462+
workflow['stages'].append(PHSRECOtask)
14491463

14501464
#<--------- CPV reco workflow
14511465
CPVRECOtask = createTask(name='cpvreco_'+str(tf), needs=[getDigiTaskName("CPV")], tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1500')
@@ -1454,7 +1468,8 @@ def getDigiTaskName(det):
14541468
getDPL_global_options(),
14551469
putConfigValues(),
14561470
('',' --disable-mc')[args.no_mc_labels]])
1457-
workflow['stages'].append(CPVRECOtask)
1471+
if isActive("CPV"):
1472+
workflow['stages'].append(CPVRECOtask)
14581473

14591474
#<--------- ZDC reco workflow
14601475
ZDCRECOtask = createTask(name='zdcreco_'+str(tf), needs=[getDigiTaskName("ZDC")], tf=tf, cwd=timeframeworkdir, lab=["RECO", "ZDC"])
@@ -1463,7 +1478,8 @@ def getDigiTaskName(det):
14631478
getDPL_global_options(),
14641479
putConfigValues(),
14651480
('',' --disable-mc')[args.no_mc_labels]])
1466-
workflow['stages'].append(ZDCRECOtask)
1481+
if isActive("ZDC"):
1482+
workflow['stages'].append(ZDCRECOtask)
14671483

14681484
## forward matching
14691485
#<--------- MCH-MID forward matching
@@ -1509,7 +1525,7 @@ def getDigiTaskName(det):
15091525

15101526
#<--------- HMP forward matching
15111527
hmpmatchneeds = [HMPRECOtask['name'], ITSTPCMATCHtask['name'], TOFTPCMATCHERtask['name'], TRDTRACKINGtask2['name']]
1512-
hmp_match_sources = dpl_option_from_config(anchorConfig, 'o2-hmpid-matcher-workflow', 'track-sources', default_value='ITS-TPC,ITS-TPC-TRD,TPC-TRD')
1528+
hmp_match_sources = cleanDetectorInputList(dpl_option_from_config(anchorConfig, 'o2-hmpid-matcher-workflow', 'track-sources', default_value='ITS-TPC,ITS-TPC-TRD,TPC-TRD'))
15131529
HMPMATCHtask = createTask(name='hmpmatch_'+str(tf), needs=hmpmatchneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1000')
15141530
HMPMATCHtask['cmd'] = task_finalizer(
15151531
['${O2_ROOT}/bin/o2-hmpid-matcher-workflow',
@@ -1524,24 +1540,29 @@ def getDigiTaskName(det):
15241540
'o2-primary-vertexing-workflow',
15251541
'vertexing-sources',
15261542
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1543+
pvfinder_sources = cleanDetectorInputList(pvfinder_sources)
1544+
15271545
pvfinder_matching_sources = dpl_option_from_config(anchorConfig,
15281546
'o2-primary-vertexing-workflow',
15291547
'vertex-track-matching-sources',
15301548
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1531-
pvfinderneeds = [TRDTRACKINGtask2['name'],
1532-
FT0RECOtask['name'],
1533-
FV0RECOtask['name'],
1534-
EMCRECOtask['name'],
1535-
PHSRECOtask['name'],
1536-
CPVRECOtask['name'],
1537-
FDDRECOtask['name'],
1538-
ZDCRECOtask['name'],
1539-
HMPMATCHtask['name'],
1540-
HMPMATCHtask['name'],
1541-
ITSTPCMATCHtask['name'],
1542-
TOFTPCMATCHERtask['name'],
1543-
MFTMCHMATCHtask['name'],
1549+
pvfinder_matching_sources = cleanDetectorInputList(pvfinder_matching_sources)
1550+
1551+
pvfinderneeds = [TRDTRACKINGtask2['name'],
1552+
FT0RECOtask['name'],
1553+
FV0RECOtask['name'],
1554+
EMCRECOtask['name'],
1555+
PHSRECOtask['name'] if isActive("PHS") else None,
1556+
CPVRECOtask['name'] if isActive("CPV") else None,
1557+
FDDRECOtask['name'],
1558+
ZDCRECOtask['name'] if isActive("ZDC") else None,
1559+
HMPMATCHtask['name'],
1560+
HMPMATCHtask['name'],
1561+
ITSTPCMATCHtask['name'],
1562+
TOFTPCMATCHERtask['name'],
1563+
MFTMCHMATCHtask['name'],
15441564
MCHMIDMATCHtask['name']]
1565+
pvfinderneeds = [ p for p in pvfinderneeds if p != None ]
15451566

15461567
PVFINDERtask = createTask(name='pvfinder_'+str(tf), needs=pvfinderneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu=NWORKERS_TF, mem='4000')
15471568
PVFINDERtask['cmd'] = task_finalizer(
@@ -1572,6 +1593,7 @@ def getDigiTaskName(det):
15721593
'o2-primary-vertexing-workflow',
15731594
'vertex-track-matching-sources',
15741595
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,ZDC,FDD,HMP,FV0,TRD,MCH,CTP')
1596+
svfinder_sources = cleanDetectorInputList(svfinder_sources)
15751597
SVFINDERtask = createTask(name='svfinder_'+str(tf), needs=[PVFINDERtask['name'], FT0FV0EMCCTPDIGItask['name']], tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu=svfinder_cpu, mem='5000')
15761598
SVFINDERtask['cmd'] = task_finalizer(
15771599
[ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow',
@@ -1591,6 +1613,7 @@ def getDigiTaskName(det):
15911613
# TODO This needs further refinement, sources and dependencies should be constructed dynamically
15921614
aod_info_souces_default = 'ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,ZDC,FDD,HMP,FV0,TRD,MCH,CTP'
15931615
aodinfosources = dpl_option_from_config(anchorConfig, 'o2-aod-producer-workflow', 'info-sources', default_value=aod_info_souces_default)
1616+
aodinfosources = cleanDetectorInputList(aodinfosources)
15941617
aodneeds = [PVFINDERtask['name'], SVFINDERtask['name']]
15951618

15961619
if usebkgcache:
@@ -1644,20 +1667,20 @@ def getDigiTaskName(det):
16441667
print ("Adding TPC residuals extraction and aggregation")
16451668

16461669
#<------------- TPC residuals extraction
1647-
scdcalib_vertex_sources = dpl_option_from_config(anchorConfig,
1670+
scdcalib_vertex_sources = cleanDetectorInputList(dpl_option_from_config(anchorConfig,
16481671
'o2-tpc-scdcalib-interpolation-workflow',
16491672
'vtx-sources',
1650-
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1673+
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP'))
16511674

1652-
scdcalib_track_sources = dpl_option_from_config(anchorConfig,
1675+
scdcalib_track_sources = cleanDetectorInputList(dpl_option_from_config(anchorConfig,
16531676
'o2-tpc-scdcalib-interpolation-workflow',
16541677
'tracking-sources',
1655-
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1678+
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP'))
16561679

1657-
scdcalib_track_extraction = dpl_option_from_config(anchorConfig,
1680+
scdcalib_track_extraction = cleanDetectorInputList(dpl_option_from_config(anchorConfig,
16581681
'o2-tpc-scdcalib-interpolation-workflow',
16591682
'tracking-sources-map-extraction',
1660-
default_value='ITS-TPC')
1683+
default_value='ITS-TPC'))
16611684

16621685
SCDCALIBtask = createTask(name='scdcalib_'+str(tf), needs=[PVFINDERtask['name']], tf=tf, cwd=timeframeworkdir, lab=["CALIB"], mem='4000')
16631686
SCDCALIBtask['cmd'] = task_finalizer(

0 commit comments

Comments
 (0)