Skip to content

Commit 41467f3

Browse files
committed
anchorMC: Integrate aligned geometry download into O2DPG workflow
So far, we are creating geometry files as step of the anchorMC script. However, it is better to do this as part of the actual MC workflow in order to benefit from the features of the workflow runner (checkpointing, etc).
1 parent c979b67 commit 41467f3

File tree

2 files changed

+53
-33
lines changed

2 files changed

+53
-33
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,60 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
510510
return common + " --shm-segment-size ${SHMSIZE:-50000000000} "
511511
else:
512512
return common
513-
513+
514+
515+
# prefetch the aligned geometry object (for use in reconstruction)
516+
GEOM_PREFETCH_TASK = createTask(name='geomprefetch', cpu='0')
517+
# We need to query the config if this is done with or without parallel world. This needs to be improved
518+
# as it could be defaulted in the ConfigKey system
519+
with_parallel_world = 1 if args.confKey.find("useParallelWorld=1") != -1 else 0
520+
geom_cmd = f'''
521+
# -- Create aligned geometry using ITS ideal alignment to avoid overlaps in geant
522+
ENABLEPW={with_parallel_world}
523+
524+
# when parallel world processing is disabled we need to switch off ITS alignment
525+
if [ "${{ENABLEPW}}" == "0" ]; then
526+
CCDBOBJECTS_IDEAL_MC="ITS/Calib/Align"
527+
TIMESTAMP_IDEAL_MC=1
528+
${{O2_ROOT}}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch/ -p ${{CCDBOBJECTS_IDEAL_MC}} \
529+
-d ${{ALICEO2_CCDB_LOCALCACHE}} --timestamp ${{TIMESTAMP_IDEAL_MC}}
530+
CCDB_RC="$?"
531+
if [ ! "${{CCDB_RC}}" == "0" ]; then
532+
echo "Problem during CCDB prefetching of ${{CCDBOBJECTS_IDEAL_MC}}. Exiting."
533+
exit ${{CCDB_RC}}
534+
fi
535+
fi
536+
537+
if [ "$ENABLEPW" == "0" ]; then
538+
REMAP_OPT="--condition-remap=file://${{ALICEO2_CCDB_LOCALCACHE}}=ITS/Calib/Align"
539+
else
540+
REMAP_OPT=""
541+
fi
542+
543+
# fetch the global alignment geometry
544+
${{O2_ROOT}}/bin/o2-create-aligned-geometry-workflow ${{ALIEN_JDL_CCDB_CONDITION_NOT_AFTER:+--condition-not-after $ALIEN_JDL_CCDB_CONDITION_NOT_AFTER}} \
545+
--configKeyValues "HBFUtils.startTime={args.timestamp}" -b --run ${{REMAP_OPT}}
546+
547+
# copy the object into the CCDB cache
548+
mkdir -p $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned
549+
ln -s -f $PWD/o2sim_geometry-aligned.root $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned/snapshot.root
550+
if [ "$ENABLEPW" == "0" ]; then
551+
[[ -f $PWD/its_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry && ln -s -f $PWD/its_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry/snapshot.root
552+
fi
553+
554+
# MFT
555+
[[ -f $PWD/mft_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry && ln -s -f $PWD/mft_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry/snapshot.root
556+
'''
557+
558+
with open("geomprefetcher_script.sh",'w') as f:
559+
f.write(geom_cmd)
560+
GEOM_PREFETCH_TASK['cmd'] = 'chmod +x ${PWD}/geomprefetcher_script.sh; ${PWD}/geomprefetcher_script.sh'
561+
workflow['stages'].append(GEOM_PREFETCH_TASK)
562+
563+
514564
# create/publish the GRPs and other GLO objects for consistent use further down the pipeline
515565
orbitsPerTF=int(args.orbitsPerTF)
516-
GRP_TASK = createTask(name='grpcreate', cpu='0')
566+
GRP_TASK = createTask(name='grpcreate', needs=["geomprefetch"], cpu='0')
517567
GRP_TASK['cmd'] = 'o2-grp-simgrp-tool createGRPs --timestamp ' + str(args.timestamp) + ' --run ' + str(args.run) + ' --publishto ${ALICEO2_CCDB_LOCALCACHE:-.ccdb} -o grp --hbfpertf ' + str(orbitsPerTF) + ' --field ' + args.field
518568
GRP_TASK['cmd'] += ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
519569
if (not args.run_anchored == True) and len(args.bcPatternFile) > 0:

MC/run/ANCHOR/anchorMC.sh

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -351,37 +351,7 @@ if [ "${ISEXCLUDED}" ]; then
351351
exit 0
352352
fi
353353

354-
# -- Create aligned geometry using ITS ideal alignment to avoid overlaps in geant
355-
ENABLEPW=0
356-
if [[ ${remainingargs} == *"GeometryManagerParam.useParallelWorld=1"* ]]; then
357-
ENABLEPW=1
358-
fi
359-
360-
if [ "${ENABLEPW}" == "0" ]; then
361-
CCDBOBJECTS_IDEAL_MC="ITS/Calib/Align"
362-
TIMESTAMP_IDEAL_MC=1
363-
${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch/ -p ${CCDBOBJECTS_IDEAL_MC} -d ${ALICEO2_CCDB_LOCALCACHE} --timestamp ${TIMESTAMP_IDEAL_MC}
364-
CCDB_RC="${?}"
365-
if [ ! "${CCDB_RC}" == "0" ]; then
366-
echo_error "Problem during CCDB prefetching of ${CCDBOBJECTS_IDEAL_MC}. Exiting."
367-
exit ${CCDB_RC}
368-
fi
369-
fi
370-
371-
# TODO This can potentially be removed or if needed, should be taken over by o2dpg_sim_workflow_anchored.py and O2_dpg_workflow_runner.py
372-
if [ "${ENABLEPW}" == "0" ]; then
373-
echo "run with echo in pipe" | ${O2_ROOT}/bin/o2-create-aligned-geometry-workflow ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER:+--condition-not-after ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER}} --configKeyValues "HBFUtils.startTime=${TIMESTAMP}" --condition-remap=file://${ALICEO2_CCDB_LOCALCACHE}=ITS/Calib/Align -b --run
374-
else
375-
echo "run with echo in pipe" | ${O2_ROOT}/bin/o2-create-aligned-geometry-workflow ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER:+--condition-not-after ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER}} --configKeyValues "HBFUtils.startTime=${TIMESTAMP}" -b --run
376-
fi
377-
mkdir -p $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned
378-
ln -s -f $PWD/o2sim_geometry-aligned.root $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned/snapshot.root
379-
if [ "${ENABLEPW}" == "0" ]; then
380-
[[ -f $PWD/its_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry && ln -s -f $PWD/its_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry/snapshot.root
381-
fi
382-
[[ -f $PWD/mft_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry && ln -s -f $PWD/mft_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry/snapshot.root
383-
384-
# -- RUN THE MC WORKLOAD TO PRODUCE AOD --
354+
# -- RUN THE MC WORKLOAD TO PRODUCE TARGETS --
385355

386356
export FAIRMQ_IPC_PREFIX=./
387357

0 commit comments

Comments
 (0)