@@ -276,6 +276,18 @@ def load_external_config(configfile):
276276for 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+
279291if 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 ),
@@ -1442,7 +1455,8 @@ def getDigiTaskName(det):
14421455 getDPL_global_options (),
14431456 putConfigValues (),
14441457 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1445- workflow ['stages' ].append (PHSRECOtask )
1458+ if isActive ("PHS" ):
1459+ workflow ['stages' ].append (PHSRECOtask )
14461460
14471461 #<--------- CPV reco workflow
14481462 CPVRECOtask = createTask (name = 'cpvreco_' + str (tf ), needs = [getDigiTaskName ("CPV" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1451,7 +1465,8 @@ def getDigiTaskName(det):
14511465 getDPL_global_options (),
14521466 putConfigValues (),
14531467 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1454- workflow ['stages' ].append (CPVRECOtask )
1468+ if isActive ("CPV" ):
1469+ workflow ['stages' ].append (CPVRECOtask )
14551470
14561471 #<--------- ZDC reco workflow
14571472 ZDCRECOtask = createTask (name = 'zdcreco_' + str (tf ), needs = [getDigiTaskName ("ZDC" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" , "ZDC" ])
@@ -1460,7 +1475,8 @@ def getDigiTaskName(det):
14601475 getDPL_global_options (),
14611476 putConfigValues (),
14621477 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1463- workflow ['stages' ].append (ZDCRECOtask )
1478+ if isActive ("ZDC" ):
1479+ workflow ['stages' ].append (ZDCRECOtask )
14641480
14651481 ## forward matching
14661482 #<--------- MCH-MID forward matching
@@ -1506,7 +1522,7 @@ def getDigiTaskName(det):
15061522
15071523 #<--------- HMP forward matching
15081524 hmpmatchneeds = [HMPRECOtask ['name' ], ITSTPCMATCHtask ['name' ], TOFTPCMATCHERtask ['name' ], TRDTRACKINGtask2 ['name' ]]
1509- hmp_match_sources = dpl_option_from_config (anchorConfig , 'o2-hmpid-matcher-workflow' , 'track-sources' , default_value = 'ITS-TPC,ITS-TPC-TRD,TPC-TRD' )
1525+ hmp_match_sources = cleanDetectorInputList ( dpl_option_from_config (anchorConfig , 'o2-hmpid-matcher-workflow' , 'track-sources' , default_value = 'ITS-TPC,ITS-TPC-TRD,TPC-TRD' ) )
15101526 HMPMATCHtask = createTask (name = 'hmpmatch_' + str (tf ), needs = hmpmatchneeds , tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1000' )
15111527 HMPMATCHtask ['cmd' ] = task_finalizer (
15121528 ['${O2_ROOT}/bin/o2-hmpid-matcher-workflow' ,
@@ -1521,24 +1537,29 @@ def getDigiTaskName(det):
15211537 'o2-primary-vertexing-workflow' ,
15221538 'vertexing-sources' ,
15231539 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' )
1540+ pvfinder_sources = cleanDetectorInputList (pvfinder_sources )
1541+
15241542 pvfinder_matching_sources = dpl_option_from_config (anchorConfig ,
15251543 'o2-primary-vertexing-workflow' ,
15261544 'vertex-track-matching-sources' ,
15271545 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' )
1528- pvfinderneeds = [TRDTRACKINGtask2 ['name' ],
1529- FT0RECOtask ['name' ],
1530- FV0RECOtask ['name' ],
1531- EMCRECOtask ['name' ],
1532- PHSRECOtask ['name' ],
1533- CPVRECOtask ['name' ],
1534- FDDRECOtask ['name' ],
1535- ZDCRECOtask ['name' ],
1536- HMPMATCHtask ['name' ],
1537- HMPMATCHtask ['name' ],
1538- ITSTPCMATCHtask ['name' ],
1539- TOFTPCMATCHERtask ['name' ],
1540- MFTMCHMATCHtask ['name' ],
1546+ pvfinder_matching_sources = cleanDetectorInputList (pvfinder_matching_sources )
1547+
1548+ pvfinderneeds = [TRDTRACKINGtask2 ['name' ],
1549+ FT0RECOtask ['name' ],
1550+ FV0RECOtask ['name' ],
1551+ EMCRECOtask ['name' ],
1552+ PHSRECOtask ['name' ] if isActive ("PHS" ) else None ,
1553+ CPVRECOtask ['name' ] if isActive ("CPV" ) else None ,
1554+ FDDRECOtask ['name' ],
1555+ ZDCRECOtask ['name' ] if isActive ("ZDC" ) else None ,
1556+ HMPMATCHtask ['name' ],
1557+ HMPMATCHtask ['name' ],
1558+ ITSTPCMATCHtask ['name' ],
1559+ TOFTPCMATCHERtask ['name' ],
1560+ MFTMCHMATCHtask ['name' ],
15411561 MCHMIDMATCHtask ['name' ]]
1562+ pvfinderneeds = [ p for p in pvfinderneeds if p != None ]
15421563
15431564 PVFINDERtask = createTask (name = 'pvfinder_' + str (tf ), needs = pvfinderneeds , tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], cpu = NWORKERS_TF , mem = '4000' )
15441565 PVFINDERtask ['cmd' ] = task_finalizer (
@@ -1569,6 +1590,7 @@ def getDigiTaskName(det):
15691590 'o2-primary-vertexing-workflow' ,
15701591 'vertex-track-matching-sources' ,
15711592 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' )
1593+ svfinder_sources = cleanDetectorInputList (svfinder_sources )
15721594 SVFINDERtask = createTask (name = 'svfinder_' + str (tf ), needs = [PVFINDERtask ['name' ], FT0FV0EMCCTPDIGItask ['name' ]], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], cpu = svfinder_cpu , mem = '5000' )
15731595 SVFINDERtask ['cmd' ] = task_finalizer (
15741596 [ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow' ,
@@ -1588,6 +1610,7 @@ def getDigiTaskName(det):
15881610 # TODO This needs further refinement, sources and dependencies should be constructed dynamically
15891611 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'
15901612 aodinfosources = dpl_option_from_config (anchorConfig , 'o2-aod-producer-workflow' , 'info-sources' , default_value = aod_info_souces_default )
1613+ aodinfosources = cleanDetectorInputList (aodinfosources )
15911614 aodneeds = [PVFINDERtask ['name' ], SVFINDERtask ['name' ]]
15921615
15931616 if usebkgcache :
@@ -1641,20 +1664,20 @@ def getDigiTaskName(det):
16411664 print ("Adding TPC residuals extraction and aggregation" )
16421665
16431666 #<------------- TPC residuals extraction
1644- scdcalib_vertex_sources = dpl_option_from_config (anchorConfig ,
1667+ scdcalib_vertex_sources = cleanDetectorInputList ( dpl_option_from_config (anchorConfig ,
16451668 'o2-tpc-scdcalib-interpolation-workflow' ,
16461669 'vtx-sources' ,
1647- 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' )
1670+ 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' ))
16481671
1649- scdcalib_track_sources = dpl_option_from_config (anchorConfig ,
1672+ scdcalib_track_sources = cleanDetectorInputList ( dpl_option_from_config (anchorConfig ,
16501673 'o2-tpc-scdcalib-interpolation-workflow' ,
16511674 'tracking-sources' ,
1652- 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' )
1675+ 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' ))
16531676
1654- scdcalib_track_extraction = dpl_option_from_config (anchorConfig ,
1677+ scdcalib_track_extraction = cleanDetectorInputList ( dpl_option_from_config (anchorConfig ,
16551678 'o2-tpc-scdcalib-interpolation-workflow' ,
16561679 'tracking-sources-map-extraction' ,
1657- default_value = 'ITS-TPC' )
1680+ default_value = 'ITS-TPC' ))
16581681
16591682 SCDCALIBtask = createTask (name = 'scdcalib_' + str (tf ), needs = [PVFINDERtask ['name' ]], tf = tf , cwd = timeframeworkdir , lab = ["CALIB" ], mem = '4000' )
16601683 SCDCALIBtask ['cmd' ] = task_finalizer (
0 commit comments