Skip to content

Commit 2e31c7c

Browse files
committed
Convert PWGHF embedding_bechmark to pipeline system
First step of code reduction and transition.
1 parent f2a65e1 commit 2e31c7c

File tree

1 file changed

+7
-118
lines changed

1 file changed

+7
-118
lines changed

MC/run/PWGHF/embedding_benchmark.sh

Lines changed: 7 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -22,124 +22,13 @@ NBKGEVENTS=${NBKGEVENTS:-20}
2222
MODULES="--skipModules ZDC"
2323
SIMENGINE=${SIMENGINE:-TGeant4}
2424

25-
# We will collect output files of the workflow in a dedicated output dir
26-
# (these are typically the files that should be left-over from a GRID job)
27-
[ ! -d output ] && mkdir output
25+
# create workflow
26+
${O2DPG_ROOT}/MC/run/PWGHF/create_embedding_workflow.py -tf ${NTIMEFRAMES} -nb ${NBKGEVENTS} \
27+
-ns ${NSIGEVENTS} -e ${SIMENGINE} \
28+
-j ${NWORKERS} --embedding True
2829

29-
copypersistentsimfiles() {
30-
simprefix=$1
31-
outputdir=$2
32-
cp ${simprefix}_Kine.root ${simprefix}_grp.root ${simprefix}*.ini ${outputdir}
33-
}
30+
# run workflow (linearized)
31+
${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json -jmax 1
3432

35-
# background task -------
36-
taskwrapper bkgsim.log o2-sim -e ${SIMENGINE} -j ${NWORKERS} -n ${NBKGEVENTS} -g pythia8hi ${MODULES} -o bkg \
37-
--configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini
38-
echo "Return status of background sim: $?"
39-
# register some background output --> make this declarative
40-
copypersistentsimfiles bkg output
41-
42-
# loop over timeframes
43-
for tf in `seq 1 ${NTIMEFRAMES}`; do
44-
45-
RNDSEED=0
46-
PTHATMIN=0. # [default = 0]
47-
PTHATMAX=-1. # [default = -1]
48-
49-
# produce the signal configuration
50-
taskwrapper gensgnconf_${tf}.log ${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \
51-
--output=pythia8.cfg \
52-
--seed=${RNDSEED} \
53-
--idA=2212 \
54-
--idB=2212 \
55-
--eCM=13000. \
56-
--process=ccbar \
57-
--ptHatMin=${PTHATMIN} \
58-
--ptHatMax=${PTHATMAX}
59-
60-
# simulate the signals for this timeframe
61-
taskwrapper sgnsim_${tf}.log o2-sim -e ${SIMENGINE} ${MODULES} -n ${NSIGEVENTS} -j ${NWORKERS} -g extgen \
62-
--configFile ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini \
63-
--configKeyValues "GeneratorPythia8.config=pythia8.cfg" \
64-
--embedIntoFile bkg_Kine.root \
65-
-o sgn${tf}
66-
67-
# register some signal output --> make this declarative
68-
# copypersistentsimfiles sgn${tf} output
69-
# we need to copy the current geometry file for its-reco
70-
cp sgn${tf}_geometry.root o2sim_geometry.root
71-
72-
CONTEXTFILE=collisioncontext_${tf}.root
73-
74-
# now run digitization phase
75-
echo "Running digitization for $intRate kHz interaction rate"
76-
77-
gloOpt="-b --run --shm-segment-size ${SHMSIZE:-50000000000}" # TODO: decide shared mem based on event number - default should be ok for 100PbPb timeframes
78-
79-
taskwrapper tpcdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --onlyDet TPC --interactionRate 50000 --tpc-lanes ${NWORKERS} --outcontext ${CONTEXTFILE}
80-
echo "Return status of TPC digitization: $?"
81-
82-
[ ! -f tpcdigits_${tf}.root ] && mv tpcdigits.root tpcdigits_${tf}.root
83-
# --> a) random seeding
84-
# --> b) propagation of collisioncontext and application in other digitization steps
85-
86-
taskwrapper trddigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --onlyDet TRD --interactionRate 50000 --configKeyValues "TRDSimParams.digithreads=10" --incontext ${CONTEXTFILE}
87-
echo "Return status of TRD digitization: $?"
88-
89-
taskwrapper restdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --skipDet TRD,TPC --interactionRate 50000 --incontext ${CONTEXTFILE}
90-
echo "Return status of OTHER digitization: $?"
91-
92-
cp bkg_grp.root o2sim_grp.root
93-
cp collisioncontext_${tf}.root collisioncontext.root
94-
# -----------
95-
# reco
96-
# -----------
97-
98-
# TODO: check value for MaxTimeBin; A large value had to be set tmp in order to avoid crashes bases on "exceeding timeframe limit"
99-
taskwrapper tpcreco_${tf}.log o2-tpc-reco-workflow $gloOpt --tpc-digit-reader \"--infile tpcdigits_${tf}.root\" --input-type digits --output-type clusters,tracks,send-clusters-per-sector --configKeyValues "\"GPU_global.continuousMaxTimeBin=100000;GPU_proc.ompThreads=${NWORKERS}\""
100-
echo "Return status of tpcreco: $?"
101-
102-
echo "Running ITS reco flow"
103-
taskwrapper itsreco_${tf}.log o2-its-reco-workflow --trackerCA --tracking-mode async $gloOpt
104-
echo "Return status of itsreco: $?"
105-
106-
echo "Running FT0 reco flow"
107-
#needs FT0 digitized data
108-
taskwrapper ft0reco_${tf}.log o2-ft0-reco-workflow $gloOpt
109-
echo "Return status of ft0reco: $?"
110-
111-
echo "Running ITS-TPC macthing flow"
112-
#needs results of o2-tpc-reco-workflow, o2-its-reco-workflow and o2-fit-reco-workflow
113-
taskwrapper itstpcMatch_${tf}.log o2-tpcits-match-workflow $gloOpt --tpc-track-reader \"tpctracks.root\" --tpc-native-cluster-reader \"--infile tpc-native-clusters.root\"
114-
echo "Return status of itstpcMatch: $?"
115-
116-
echo "Running ITSTPC-TOF macthing flow"
117-
#needs results of TOF digitized data and results of o2-tpcits-match-workflow
118-
taskwrapper tofMatch_${tf}.log o2-tof-reco-workflow $gloOpt
119-
echo "Return status of its-tpc-tof match: $?"
120-
121-
echo "Running TPC-TOF macthing flow"
122-
#needs results of TOF clusters data from o2-tof-reco-workflow and results of o2-tpc-reco-workflow
123-
taskwrapper tofMatchTPC.log o2-tof-matcher-tpc $gloOpt
124-
echo "Return status of o2-tof-matcher-tpc: $?"
125-
126-
echo "Running primary vertex finding flow"
127-
#needs results of TPC-ITS matching and FIT workflows
128-
taskwrapper pvfinder_${tf}.log o2-primary-vertexing-workflow $gloOpt
129-
echo "Return status of primary vertexing: $?"
130-
131-
# -----------
132-
# produce AOD
133-
# -----------
134-
135-
# enable later. It still has memory access problems
136-
# taskwrapper aod_${tf}.log o2-aod-producer-workflow --aod-writer-keep dangling --aod-writer-resfile "AO2D" --aod-writer-resmode UPDATE --aod-timeframe-id ${tf} $gloOpt
137-
138-
cp ${CONTEXTFILE} output
139-
140-
# cleanup step for this timeframe (we cleanup disc space early so as to make possible checkpoint dumps smaller)
141-
taskwrapper cleanup_${tf}.log "[ -f aod${tf}.log_done ] && rm sgn${tf}* && rm *digits*.root; exit 0"
142-
done
143-
144-
# We need to exit for the ALIEN JOB HANDLER!
14533
exit 0
34+

0 commit comments

Comments
 (0)