Skip to content

Commit 9424d3c

Browse files
committed
Improvement for --skipModules/--skipReadout
1 parent 7989801 commit 9424d3c

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
'for given interaction rate; '
110110
'pass this to avoid that')
111111
parser.add_argument('--skipModules',nargs="*", help="List of modules to skip in geometry budget (and therefore processing)", default=["ZDC"])
112+
parser.add_argument('--skipReadout',nargs="*", help="List of modules to take out from readout", default=[""])
112113
parser.add_argument('--with-ZDC', action='store_true', help='Enable ZDC in workflow')
113114
parser.add_argument('-seed',help='random seed number', default=None)
114115
parser.add_argument('-o',help='output workflow file', default='workflow.json')
@@ -257,6 +258,19 @@ def load_external_config(configfile):
257258
print(f"INFO: Written additional config key parameters to JSON {config_key_param_path}")
258259
json.dump(anchorConfig, f, indent=2)
259260

261+
# Processing skipped material budget (modules):
262+
# - If user did NOT specify --with-ZDC
263+
# - AND ZDC is not already in the list
264+
# --> append ZDC automatically
265+
if args.with_ZDC:
266+
# User wants ZDC to *not* be skipped → ensure it's removed
267+
args.skipModules = [m for m in args.skipModules if m != "ZDC"]
268+
else:
269+
# If user did not request --with-ZDC,
270+
# auto-append ZDC unless already present
271+
if "ZDC" not in args.skipModules:
272+
args.skipModules.append("ZDC")
273+
260274
# with this we can tailor the workflow to the presence of
261275
# certain detectors
262276
# these are all detectors that should be assumed active
@@ -267,14 +281,14 @@ def load_external_config(configfile):
267281
# if "all" here, there was in fact nothing in the anchored script, set to what is passed to this script (which it either also "all" or a subset)
268282
activeDetectors = readout_detectors
269283
elif readout_detectors != 'all' and activeDetectors != 'all':
270-
# in this case both are comma-seperated lists. Take intersection
284+
# in this case both are comma-separated lists. Take intersection
271285
r = set(readout_detectors.split(','))
272286
a = set(activeDetectors.split(','))
273287
activeDetectors = ','.join(r & a)
274288
# the last case: simply take what comes from the anchored config
275289

276290
# convert to set/hashmap
277-
activeDetectors = { det:1 for det in activeDetectors.split(',') }
291+
activeDetectors = { det:1 for det in activeDetectors.split(',') if det not in args.skipModules and det not in args.skipReadout}
278292
for det in activeDetectors:
279293
activate_detector(det)
280294

@@ -409,18 +423,6 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
409423
NTIMEFRAMES=int(args.tf)
410424
NWORKERS=args.n_workers
411425

412-
# Processing skipped material budget (modules):
413-
# - If user did NOT specify --with-ZDC
414-
# - AND ZDC is not already in the list
415-
# --> append ZDC automatically
416-
if args.with_ZDC:
417-
# User wants ZDC to *not* be skipped → ensure it's removed
418-
args.skipModules = [m for m in args.skipModules if m != "ZDC"]
419-
else:
420-
# If user did not request --with-ZDC,
421-
# auto-append ZDC unless already present
422-
if "ZDC" not in args.skipModules:
423-
args.skipModules.append("ZDC")
424426

425427
SKIPMODULES = " ".join(["--skipModules"] + args.skipModules) if len(args.skipModules) > 0 else ""
426428
SIMENGINE=args.e
@@ -1443,7 +1445,7 @@ def getDigiTaskName(det):
14431445
TPCRECOtask['name'],
14441446
ITSTPCMATCHtask['name'],
14451447
TRDTRACKINGtask2['name'] if isActive("TRD") else None]
1446-
toftracksrcdefault = dpl_option_from_config(anchorConfig, 'o2-tof-matcher-workflow', '--track-sources', default_value='TPC,ITS-TPC,TPC-TRD,ITS-TPC-TRD')
1448+
toftracksrcdefault = cleanDetectorInputList(dpl_option_from_config(anchorConfig, 'o2-tof-matcher-workflow', '--track-sources', default_value='TPC,ITS-TPC,TPC-TRD,ITS-TPC-TRD'))
14471449
tofusefit = option_if_available('o2-tof-matcher-workflow', '--use-fit', envfile=async_envfile)
14481450
TOFTPCMATCHERtask = createTask(name='toftpcmatch_'+str(tf), needs=toftpcmatchneeds, tf=tf, cwd=timeframeworkdir, lab=["RECO"], mem='1000')
14491451
tofmatcher_cmd_parts = [

0 commit comments

Comments
 (0)