@@ -331,7 +331,17 @@ def cleanDetectorInputList(inputlist):
331331 del activeDetectors ['ZDC' ]
332332
333333def addWhenActive (detID , needslist , appendstring ):
334- if isActive (detID ):
334+ """Adds item to a list if detector(s) is (are) active
335+
336+ Args:
337+ detID: str
338+ detector to check, can also be comma-separated list of detectors
339+ needslist: list
340+ list, e.g. of task dicts added to workflow['stages']
341+ appendstring: str, dict, ...
342+ to be appended to needslist
343+ """
344+ if all (isActive (part ) for part in detID .split ("," )):
335345 needslist .append (appendstring )
336346
337347def retrieve_sor (run_number ):
@@ -1175,8 +1185,7 @@ def putConfigValues(listOfMainKeys=[], localCF = {}, globalTFConfig = True):
11751185 + ' --onlyDet TRD --interactionRate ' + str (INTRATE ) + ' --incontext ' + str (CONTEXTFILE ) + ' --disable-write-ini' \
11761186 + putConfigValues (localCF = {"TRDSimParams.digithreads" : NWORKERS_TF , "DigiParams.seed" : str (TFSEED )}) + " --forceSelectedDets"
11771187 TRDDigitask ['cmd' ] += ('' ,' --disable-mc' )[args .no_mc_labels ]
1178- if isActive ("TRD" ):
1179- workflow ['stages' ].append (TRDDigitask )
1188+ addWhenActive ("TRD" , workflow ['stages' ], TRDDigitask )
11801189
11811190 # these are digitizers which are single threaded
11821191 def createRestDigiTask (name , det = 'ALLSMALLER' ):
@@ -1271,6 +1280,7 @@ def getDigiTaskName(det):
12711280 if not args .combine_tpc_clusterization :
12721281 # We treat TPC clusterization in multiple (sector) steps in order to
12731282 # stay within the memory limit or to parallelize over sector from outside (not yet supported within cluster algo)
1283+ # For the clusterization we disable the TPC SC corrections
12741284 tpcclustertasks = []
12751285 sectorpertask = 18
12761286 for s in range (0 ,35 ,sectorpertask ):
@@ -1284,6 +1294,8 @@ def getDigiTaskName(det):
12841294 getDPL_global_options (bigshm = True ),
12851295 '--input-type ' + ('digitizer' ,'digits' )[args .no_tpc_digitchunking ],
12861296 '--output-type clusters,send-clusters-per-sector' ,
1297+ '--corrmap-lumi-mode 3' ,
1298+ '--disable-ctp-lumi-request' ,
12871299 f'--tpc-native-cluster-writer \" --outfile tpc-native-clusters-part{ (int )(s / sectorpertask )} .root\" ' ,
12881300 f'--tpc-sectors { s } -{ s + sectorpertask - 1 } ' ,
12891301 putConfigValues (["GPU_global" ,
@@ -1293,6 +1305,7 @@ def getDigiTaskName(det):
12931305 '--disable-mc' if args .no_mc_labels else None
12941306 ], configname = "tpcclusterizertask"
12951307 )
1308+ # RS: note that --disable-IDC-scalers should be added to options above once it is added by the CorrectionMapsOptions::addGlobalOptions)
12961309
12971310 tpcclussect ['env' ] = { "OMP_NUM_THREADS" : "4" , "TBB_NUM_THREADS" : "4" }
12981311 tpcclussect ['semaphore' ] = "tpctriggers.root"
@@ -1307,7 +1320,7 @@ def getDigiTaskName(det):
13071320 # TODO: adapt this to the case above and merge code / avoid code duplication
13081321 tpcclus = createTask (name = 'tpccluster_' + str (tf ), needs = tpcclusterneed , tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], cpu = NWORKERS_TF , mem = '2000' )
13091322 tpcclus ['cmd' ] = '${O2_ROOT}/bin/o2-tpc-chunkeddigit-merger --tpc-lanes ' + str (NWORKERS_TF )
1310- tpcclus ['cmd' ] += ' | ${O2_ROOT}/bin/o2-tpc-reco-workflow ' + getDPL_global_options () + ' --input-type digitizer --output-type clusters,send-clusters-per-sector ' + putConfigValues (["GPU_global" ,"TPCGasParam" ,"TPCCorrMap" ],{"GPU_proc.ompThreads" : 1 }) + ('' ,' --disable-mc' )[args .no_mc_labels ]
1323+ tpcclus ['cmd' ] += ' | ${O2_ROOT}/bin/o2-tpc-reco-workflow ' + getDPL_global_options () + ' --input-type digitizer --output-type clusters,send-clusters-per-sector --corrmap-lumi-mode 3 --disable-ctp-lumi-request ' + putConfigValues (["GPU_global" ,"TPCGasParam" ,"TPCCorrMap" ],{"GPU_proc.ompThreads" : 1 }) + ('' ,' --disable-mc' )[args .no_mc_labels ]
13111324 workflow ['stages' ].append (tpcclus )
13121325 tpcreconeeds .append (tpcclus ['name' ])
13131326
@@ -1352,10 +1365,13 @@ def getDigiTaskName(det):
13521365 if not isActive ('CTP' ):
13531366 # CTP digits won't be produced for this timeframe (CTP not in the readout detector list)
13541367 tpc_corr_scaling_options += ' --disable-ctp-lumi-request'
1355-
1368+
13561369 # why not simply?
13571370 # tpc_corr_scaling_options = ('--lumi-type 1', '')[tpcDistortionType != 0]
13581371
1372+ # at the moment MC is not ready for the sector edge fluctuations (RS: and does not use IDC but --disable-IDC-scalers can be added only once it is added by the CorrectionMapsOptions::addGlobalOptions)
1373+ tpc_corr_scaling_options += option_if_available ('o2-tpc-reco-workflow' , '--disable-sec-edge-fluc-correction' , envfile = async_envfile )
1374+
13591375 #<--------- TPC reco task
13601376 if includeTPCSyncMode :
13611377 tpcSyncreconeeds = tpcreconeeds .copy ()
@@ -1422,8 +1438,7 @@ def getDigiTaskName(det):
14221438 '--disable-slewing-calib' , # because effect not simulated in MC
14231439 putConfigValues ()
14241440 ])
1425- if isActive ("FT0" ):
1426- workflow ['stages' ].append (FT0RECOtask )
1441+ addWhenActive ("FT0" , workflow ['stages' ], FT0RECOtask )
14271442
14281443 #<--------- ITS-TPC track matching task
14291444 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 )
@@ -1455,8 +1470,7 @@ def getDigiTaskName(det):
14551470 getDPL_global_options (),
14561471 putConfigValues (),
14571472 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1458- if isActive ("TRD" ):
1459- workflow ['stages' ].append (TRDTRACKINGtask )
1473+ addWhenActive ("TRD" , workflow ['stages' ], TRDTRACKINGtask )
14601474
14611475 #<--------- TRD global tracking
14621476 # FIXME This is so far a workaround to avoud a race condition for trdcalibratedtracklets.root
@@ -1476,8 +1490,7 @@ def getDigiTaskName(det):
14761490 '--track-sources ' + trd_track_sources ,
14771491 tpc_corr_scaling_options ,
14781492 tpc_corr_options_mc ])
1479- if isActive ("TRD" ):
1480- workflow ['stages' ].append (TRDTRACKINGtask2 )
1493+ addWhenActive ("TRD" , workflow ['stages' ], TRDTRACKINGtask2 )
14811494
14821495 #<--------- TOF reco task
14831496 TOFRECOtask = createTask (name = 'tofmatch_' + str (tf ), needs = [ITSTPCMATCHtask ['name' ], getDigiTaskName ("TOF" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1488,8 +1501,7 @@ def getDigiTaskName(det):
14881501 putConfigValues (),
14891502 ('' ,' --disable-mc' )[args .no_mc_labels ]
14901503 ])
1491- if isActive ('TOF' ):
1492- workflow ['stages' ].append (TOFRECOtask )
1504+ addWhenActive ("TOF" , workflow ['stages' ], TOFRECOtask )
14931505
14941506 #<--------- TOF-TPC(-ITS) global track matcher workflow
14951507 toftpcmatchneeds = [TOFRECOtask ['name' ],
@@ -1517,8 +1529,7 @@ def getDigiTaskName(det):
15171529 tpc_corr_options_mc
15181530 ]
15191531 TOFTPCMATCHERtask ['cmd' ] = task_finalizer (tofmatcher_cmd_parts )
1520- if isActive ('TOF' ):
1521- workflow ['stages' ].append (TOFTPCMATCHERtask )
1532+ addWhenActive ("TOF" , workflow ['stages' ], TOFTPCMATCHERtask )
15221533
15231534 # MFT reco: needing access to kinematics (when assessment enabled)
15241535 mftreconeeds = [getDigiTaskName ("MFT" )]
@@ -1537,8 +1548,7 @@ def getDigiTaskName(det):
15371548 'MFTClustererParam' ]),
15381549 ('' ,'--disable-mc' )[args .no_mc_labels ],
15391550 ('' ,'--run-assessment' )[args .mft_assessment_full ]])
1540- if isActive ("MFT" ):
1541- workflow ['stages' ].append (MFTRECOtask )
1551+ addWhenActive ("MFT" , workflow ['stages' ], MFTRECOtask )
15421552
15431553 # MCH reco: needing access to kinematics ... so some extra logic needed here
15441554 mchreconeeds = [getDigiTaskName ("MCH" )]
@@ -1554,8 +1564,7 @@ def getDigiTaskName(det):
15541564 putConfigValues (),
15551565 ('' ,' --disable-mc' )[args .no_mc_labels ],
15561566 '--enable-clusters-root-output' ])
1557- if isActive ("MCH" ):
1558- workflow ['stages' ].append (MCHRECOtask )
1567+ addWhenActive ("MCH" , workflow ['stages' ], MCHRECOtask )
15591568
15601569 #<--------- MID reco workflow
15611570 MIDRECOtask = createTask (name = 'midreco_' + str (tf ), needs = [getDigiTaskName ("MID" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1566,26 +1575,23 @@ def getDigiTaskName(det):
15661575 MIDRECOtask ['cmd' ] += task_finalizer (['${O2_ROOT}/bin/o2-mid-reco-workflow' ,
15671576 getDPL_global_options (),
15681577 putConfigValues (),('' ,' --disable-mc' )[args .no_mc_labels ]])
1569- if isActive ('MID' ):
1570- workflow ['stages' ].append (MIDRECOtask )
1578+ addWhenActive ("MID" , workflow ['stages' ], MIDRECOtask )
15711579
15721580 #<--------- FDD reco workflow
15731581 FDDRECOtask = createTask (name = 'fddreco_' + str (tf ), needs = [getDigiTaskName ("FDD" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
15741582 FDDRECOtask ['cmd' ] = task_finalizer (['${O2_ROOT}/bin/o2-fdd-reco-workflow' ,
15751583 getDPL_global_options (ccdbbackend = False ),
15761584 putConfigValues (),
15771585 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1578- if isActive ("FDD" ):
1579- workflow ['stages' ].append (FDDRECOtask )
1586+ addWhenActive ("FDD" , workflow ['stages' ], FDDRECOtask )
15801587
15811588 #<--------- FV0 reco workflow
15821589 FV0RECOtask = createTask (name = 'fv0reco_' + str (tf ), needs = [getDigiTaskName ("FV0" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
15831590 FV0RECOtask ['cmd' ] = task_finalizer (['${O2_ROOT}/bin/o2-fv0-reco-workflow' ,
15841591 getDPL_global_options (),
15851592 putConfigValues (),
15861593 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1587- if isActive ("FV0" ):
1588- workflow ['stages' ].append (FV0RECOtask )
1594+ addWhenActive ("FV0" , workflow ['stages' ], FV0RECOtask )
15891595
15901596 # calorimeters
15911597 #<--------- EMC reco workflow
@@ -1617,8 +1623,7 @@ def getDigiTaskName(det):
16171623 getDPL_global_options (),
16181624 '--subspec 0' ,
16191625 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1620- if isActive ("EMC" ):
1621- workflow ['stages' ].append (EMCRECOtask )
1626+ addWhenActive ("EMC" , workflow ['stages' ], EMCRECOtask )
16221627
16231628 #<--------- PHS reco workflow
16241629 PHSRECOtask = createTask (name = 'phsreco_' + str (tf ), needs = [getDigiTaskName ("PHS" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1627,8 +1632,7 @@ def getDigiTaskName(det):
16271632 getDPL_global_options (),
16281633 putConfigValues (),
16291634 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1630- if isActive ("PHS" ):
1631- workflow ['stages' ].append (PHSRECOtask )
1635+ addWhenActive ("PHS" , workflow ['stages' ], PHSRECOtask )
16321636
16331637 #<--------- CPV reco workflow
16341638 CPVRECOtask = createTask (name = 'cpvreco_' + str (tf ), needs = [getDigiTaskName ("CPV" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1637,8 +1641,7 @@ def getDigiTaskName(det):
16371641 getDPL_global_options (),
16381642 putConfigValues (),
16391643 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1640- if isActive ("CPV" ):
1641- workflow ['stages' ].append (CPVRECOtask )
1644+ addWhenActive ("CPV" , workflow ['stages' ], CPVRECOtask )
16421645
16431646 #<--------- ZDC reco workflow
16441647 ZDCRECOtask = createTask (name = 'zdcreco_' + str (tf ), needs = [getDigiTaskName ("ZDC" )], tf = tf , cwd = timeframeworkdir , lab = ["RECO" , "ZDC" ])
@@ -1647,8 +1650,7 @@ def getDigiTaskName(det):
16471650 getDPL_global_options (),
16481651 putConfigValues (),
16491652 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1650- if isActive ("ZDC" ):
1651- workflow ['stages' ].append (ZDCRECOtask )
1653+ addWhenActive ("ZDC" , workflow ['stages' ], ZDCRECOtask )
16521654
16531655 ## forward matching
16541656 #<--------- MCH-MID forward matching
@@ -1658,8 +1660,7 @@ def getDigiTaskName(det):
16581660 getDPL_global_options (ccdbbackend = False ),
16591661 putConfigValues (),
16601662 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1661- if isActive ("MID" ) and isActive ("MCH" ):
1662- workflow ['stages' ].append (MCHMIDMATCHtask )
1663+ addWhenActive ("MID,MCH" , workflow ['stages' ], MCHMIDMATCHtask )
16631664
16641665 #<--------- MFT-MCH forward matching
16651666 forwardmatchneeds = [MCHRECOtask ['name' ],
@@ -1679,8 +1680,7 @@ def getDigiTaskName(det):
16791680 ['${O2_ROOT}/bin/o2-globalfwd-assessment-workflow' ,
16801681 getDPL_global_options (),
16811682 ('' ,' --disable-mc' )[args .no_mc_labels ]])
1682- if isActive ("MFT" ) and isActive ("MCH" ):
1683- workflow ['stages' ].append (MFTMCHMATCHtask )
1683+ addWhenActive ("MFT,MCH" , workflow ['stages' ], MFTMCHMATCHtask )
16841684
16851685 if args .fwdmatching_save_trainingdata == True :
16861686 MFTMCHMATCHTraintask = createTask (name = 'mftmchMatchTrain_' + str (tf ), needs = [MCHMIDMATCHtask ['name' ], MFTRECOtask ['name' ]], tf = tf , cwd = timeframeworkdir , lab = ["RECO" ], mem = '1500' )
@@ -1695,8 +1695,7 @@ def getDigiTaskName(det):
16951695 ['${O2_ROOT}/bin/o2-hmpid-digits-to-clusters-workflow' ,
16961696 getDPL_global_options (ccdbbackend = False ),
16971697 putConfigValues ()])
1698- if isActive ("HMP" ):
1699- workflow ['stages' ].append (HMPRECOtask )
1698+ addWhenActive ("HMP" , workflow ['stages' ], HMPRECOtask )
17001699
17011700 #<--------- HMP forward matching
17021701 hmpmatchneeds = [HMPRECOtask ['name' ],
@@ -1712,8 +1711,7 @@ def getDigiTaskName(det):
17121711 getDPL_global_options (),
17131712 putConfigValues ()
17141713 ])
1715- if isActive ("HMP" ):
1716- workflow ['stages' ].append (HMPMATCHtask )
1714+ addWhenActive ("HMP" , workflow ['stages' ], HMPMATCHtask )
17171715
17181716 #<---------- primary vertex finding
17191717 pvfinder_sources = dpl_option_from_config (anchorConfig ,
@@ -2156,9 +2154,8 @@ def remove_json_prefix(path):
21562154 TPCTStask ['cmd' ] += ' --primary-vertices '
21572155 TPCTStask ['cmd' ] += ' | o2-tpc-time-series-workflow --enable-unbinned-root-output --sample-unbinned-tsallis --sampling-factor 0.01 '
21582156 TPCTStask ['cmd' ] += putConfigValues () + ' ' + getDPL_global_options (bigshm = True )
2159- if isActive ('TOF' ) and isActive ('TPC' ) and isActive ('FT0' ):
2160- # could be relaxed or changed once the timerseries worklow is more reactive to input cluster- and track-types
2161- workflow ['stages' ].append (TPCTStask )
2157+ # could be relaxed or changed once the timerseries worklow is more reactive to input cluster- and track-types
2158+ addWhenActive ("TOF,TPC,FT0" , workflow ['stages' ], TPCTStask )
21622159
21632160 # cleanup
21642161 # --------
0 commit comments