|
41 | 41 |
|
42 | 42 | sys.path.append(join(dirname(__file__), '.', 'o2dpg_workflow_utils')) |
43 | 43 |
|
44 | | -from o2dpg_workflow_utils import createTask, createGlobalInitTask, dump_workflow, adjust_RECO_environment, isActive, activate_detector, deactivate_detector, compute_n_workers, merge_dicts |
| 44 | +from o2dpg_workflow_utils import createTask, createGlobalInitTask, dump_workflow, adjust_RECO_environment, isActive, activate_detector, deactivate_detector, compute_n_workers, merge_dicts, read_detector_list, restrict_to_built |
45 | 45 | from o2dpg_qc_finalization_workflow import include_all_QC_finalization |
46 | 46 | from o2dpg_sim_config import create_sim_config, create_geant_config, constructConfigKeyArg, option_if_available, overwrite_config |
47 | 47 | from o2dpg_dpl_config_tools import dpl_option_from_config, TaskFinalizer, quote_if_needed |
@@ -310,8 +310,22 @@ def load_external_config(configfile): |
310 | 310 | activeDetectors = ','.join(r & a) |
311 | 311 | # the last case: simply take what comes from the anchored config |
312 | 312 |
|
313 | | -# convert to set/hashmap |
314 | | -activeDetectors = { det:1 for det in activeDetectors.split(',') if det not in args.skipModules and det not in args.skipReadout} |
| 313 | +# convert to set/hashmap, keeping only detectors that the chosen detector list builds (e.g. no TRD in ALICE2.1) |
| 314 | +builtModules = read_detector_list(args.detectorList) |
| 315 | +requested = [det for det in activeDetectors.split(',') if det] |
| 316 | +if builtModules is None: |
| 317 | + print(f"Warning: cannot read detector list {args.detectorList}; active detectors are not checked against it") |
| 318 | +else: |
| 319 | + restrict_to_built(builtModules) |
| 320 | + if 'IT3' in builtModules and 'ITS' not in builtModules: |
| 321 | + requested = ['IT3' if det == 'ITS' else det for det in requested] |
| 322 | + requested = [det for det in requested if det == 'all' or det in builtModules] |
| 323 | +activeDetectors = { det:1 for det in requested if det not in args.skipModules and det not in args.skipReadout} |
| 324 | +# IT3 replaces ITS when the detector list builds it |
| 325 | +useIT3 = ('IT3' in builtModules) if builtModules is not None else args.detectorList == 'ALICE2.1' |
| 326 | +if not activeDetectors: |
| 327 | + print(f"Error: no active detector left after applying detector list {args.detectorList} and the skip options") |
| 328 | + sys.exit(1) |
315 | 329 | for det in activeDetectors: |
316 | 330 | activate_detector(det) |
317 | 331 | for det in args.skipModules: |
@@ -832,7 +846,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): |
832 | 846 |
|
833 | 847 | # a list of smaller sensors (used to construct digitization tasks in a parametrized way) |
834 | 848 | smallsensorlist = [ "ITS", "TOF", "FDD", "MCH", "MID", "MFT", "HMP", "PHS", "CPV", "ZDC" ] |
835 | | -if args.detectorList == 'ALICE2.1': |
| 849 | +if useIT3: |
836 | 850 | smallsensorlist = ['IT3' if sensor == 'ITS' else sensor for sensor in smallsensorlist] |
837 | 851 |
|
838 | 852 | # a list of detectors that serve as input for the trigger processor CTP --> these need to be processed together for now |
@@ -893,7 +907,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): |
893 | 907 | QEDBaseConfig = "GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-7;QEDGenParam.yMax=7;QEDGenParam.ptMin=0.001;QEDGenParam.ptMax=1.;QEDGenParam.xSectionHad="+str(XSecSys[COLTYPE])+";QEDGenParam.Z="+str(Zsys[COLTYPE])+";QEDGenParam.cmEnergy="+str(ECMS)+";Diamond.width[2]=6.;" |
894 | 908 | QEDCONFKEY = constructConfigKeyArg(create_geant_config(args, QEDBaseConfig + args.confKeyQED)) |
895 | 909 | qed_detectorlist = ' ITS MFT FT0 FV0 FDD ' |
896 | | - if args.detectorList == 'ALICE2.1': |
| 910 | + if useIT3: |
897 | 911 | qed_detectorlist = qed_detectorlist.replace('ITS', 'IT3') |
898 | 912 | QED_task['cmd'] = 'o2-sim -e TGeant3 --field ccdb -j ' + str('1') + ' -o qed' \ |
899 | 913 | + ' -n ' + str(NEventsQED) + ' -m ' + qed_detectorlist \ |
@@ -1221,7 +1235,7 @@ def createRestDigiTask(name, det='ALLSMALLER'): |
1221 | 1235 | tneeds += [QED_task['name']] |
1222 | 1236 | commondigicmd = '${O2_ROOT}/bin/o2-sim-digitizer-workflow ' + getDPL_global_options() + ' -n ' + str(args.ns) + simsoption \ |
1223 | 1237 | + ' --interactionRate ' + str(INTRATE) + ' --incontext ' + str(CONTEXTFILE) + ' --disable-write-ini' \ |
1224 | | - + putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "ITSDigitizerParam" if args.detectorList == 'ALICE2' else "IT3DigitizerParam"], |
| 1238 | + + putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "IT3DigitizerParam" if useIT3 else "ITSDigitizerParam"], |
1225 | 1239 | localCF={"DigiParams.seed" : str(TFSEED), "MCHDigitizer.seed" : str(TFSEED)}) + QEDdigiargs |
1226 | 1240 |
|
1227 | 1241 | if det=='ALLSMALLER': # here we combine all smaller digits in one DPL workflow |
@@ -1449,10 +1463,10 @@ def getDigiTaskName(det): |
1449 | 1463 |
|
1450 | 1464 | #<--------- ITS reco task |
1451 | 1465 | ITSMemEstimate = 12000 if havePbPb else 2000 # PbPb has much large mem requirement for now (in worst case) |
1452 | | - ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("ITS" if args.detectorList == 'ALICE2' else "IT3")], |
| 1466 | + ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("IT3" if useIT3 else "ITS")], |
1453 | 1467 | tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem=str(ITSMemEstimate)) |
1454 | 1468 | ITSRECOtask['cmd'] = task_finalizer([ |
1455 | | - "${O2_ROOT}/bin/o2-its-reco-workflow" if args.detectorList == 'ALICE2' else "${O2_ROOT}/bin/o2-its3-reco-workflow", |
| 1469 | + "${O2_ROOT}/bin/o2-its3-reco-workflow" if useIT3 else "${O2_ROOT}/bin/o2-its-reco-workflow", |
1456 | 1470 | getDPL_global_options(bigshm=havePbPb), |
1457 | 1471 | staggITS, |
1458 | 1472 | '--tracking-mode async', |
|
0 commit comments