Skip to content

Commit 438b480

Browse files
committed
HF embedding: complement workflow up to AOD
* some minor adjustments: be able to set engine
1 parent de94d89 commit 438b480

File tree

1 file changed

+52
-14
lines changed

1 file changed

+52
-14
lines changed

MC/run/PWGHF/embedding_benchmark.sh

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#!/bin/bash
22

33
#
4-
# A example workflow doing signal-background embedding, meant
4+
# A example workflow MC->RECO->AOD doing signal-background embedding, meant
55
# to study embedding speedups.
66
# Background events are reused across timeframes.
77
#
88

9+
# make sure O2DPG + O2 is loaded
10+
[ ! "{O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
11+
[ ! "{O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1
12+
913
# ----------- LOAD UTILITY FUNCTIONS --------------------------
1014
. ${O2_ROOT}/share/scripts/jobutils.sh
1115

@@ -16,6 +20,7 @@ NTIMEFRAMES=${NTIMEFRAMES:-5}
1620
NWORKERS=${NWORKERS:-8}
1721
NBKGEVENTS=${NBKGEVENTS:-20}
1822
MODULES="--skipModules ZDC"
23+
SIMENGINE=${SIMENGINE:-TGeant4}
1924

2025
# We will collect output files of the workflow in a dedicated output dir
2126
# (these are typically the files that should be left-over from a GRID job)
@@ -28,8 +33,9 @@ copypersistentsimfiles() {
2833
}
2934

3035
# background task -------
31-
taskwrapper bkgsim.log o2-sim -j ${NWORKERS} -n ${NBKGEVENTS} -g pythia8hi ${MODULES} -o bkg \
36+
taskwrapper bkgsim.log o2-sim -e ${SIMENGINE} -j ${NWORKERS} -n ${NBKGEVENTS} -g pythia8hi ${MODULES} -o bkg \
3237
--configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini
38+
echo "Return status of background sim: $?"
3339
# register some background output --> make this declarative
3440
copypersistentsimfiles bkg output
3541

@@ -41,7 +47,7 @@ for tf in `seq 1 ${NTIMEFRAMES}`; do
4147
PTHATMAX=-1. # [default = -1]
4248

4349
# produce the signal configuration
44-
${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \
50+
taskwrapper gensgnconf${tf}.log ${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \
4551
--output=pythia8.cfg \
4652
--seed=${RNDSEED} \
4753
--idA=2212 \
@@ -52,23 +58,23 @@ for tf in `seq 1 ${NTIMEFRAMES}`; do
5258
--ptHatMax=${PTHATMAX}
5359

5460
# simulate the signals for this timeframe
55-
taskwrapper sgnsim_${tf}.log o2-sim ${MODULES} -n ${NSIGEVENTS} -e TGeant3 -j ${NWORKERS} -g extgen \
61+
taskwrapper sgnsim_${tf}.log o2-sim -e ${SIMENGINE} ${MODULES} -n ${NSIGEVENTS} -j ${NWORKERS} -g extgen \
5662
--configFile ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini \
5763
--configKeyValues "GeneratorPythia8.config=pythia8.cfg" \
5864
--embedIntoFile bkg_Kine.root \
5965
-o sgn${tf}
6066

6167
# register some signal output --> make this declarative
62-
copypersistentsimfiles sgn${tf} output
63-
# we need to copy the current grp for tpc-reco
64-
cp sgn${tf}_grp.root o2sim_grp.root
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
6571

6672
CONTEXTFILE=collisioncontext_${tf}.root
6773

6874
# now run digitization phase
6975
echo "Running digitization for $intRate kHz interaction rate"
7076

71-
gloOpt="-b --run --shm-segment-size ${SHMSIZE:-20000000000}" # TODO: decide shared mem based on event number - default should be ok for 100PbPb timeframes
77+
gloOpt="-b --run --shm-segment-size ${SHMSIZE:-50000000000}" # TODO: decide shared mem based on event number - default should be ok for 100PbPb timeframes
7278

7379
taskwrapper tpcdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --onlyDet TPC --interactionRate 50000 --tpc-lanes ${NWORKERS} --outcontext ${CONTEXTFILE}
7480
[ ! -f tpcdigits_${tf}.root ] && mv tpcdigits.root tpcdigits_${tf}.root
@@ -79,22 +85,54 @@ for tf in `seq 1 ${NTIMEFRAMES}`; do
7985
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}
8086
echo "Return status of TRD digitization: $?"
8187

82-
taskwrapper restdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --skipDet TRD,TPC,FT0 --interactionRate 50000 --incontext ${CONTEXTFILE}
88+
taskwrapper restdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --skipDet TRD,TPC --interactionRate 50000 --incontext ${CONTEXTFILE}
8389
echo "Return status of OTHER digitization: $?"
8490

91+
cp bkg_grp.root o2sim_grp.root
92+
cp collisioncontext_${tf}.root collisioncontext.root
93+
# -----------
94+
# reco
95+
# -----------
96+
8597
# TODO: check value for MaxTimeBin; A large value had to be set tmp in order to avoid crashes bases on "exceeding timeframe limit"
8698
taskwrapper tpcreco_${tf}.log o2-tpc-reco-workflow $gloOpt --tpc-digit-reader \"--infile tpcdigits_${tf}.root\" --input-type digits --output-type clusters,tracks --tpc-track-writer \"--treename events --track-branch-name Tracks --trackmc-branch-name TracksMCTruth\" --configKeyValues \"GPU_global.continuousMaxTimeBin=100000\"
8799
echo "Return status of tpcreco: $?"
88100

89-
# we need to move these products somewhere
90-
mv tpctracks.root tpctracks_${tf}.root
101+
echo "Running ITS reco flow"
102+
taskwrapper itsreco.log o2-its-reco-workflow --trackerCA --async-phase $gloOpt
103+
echo "Return status of itsreco: $?"
104+
105+
echo "Running FT0 reco flow"
106+
#needs FT0 digitized data
107+
taskwrapper ft0reco.log o2-ft0-reco-workflow $gloOpt
108+
echo "Return status of ft0reco: $?"
109+
110+
echo "Running ITS-TPC macthing flow"
111+
#needs results of o2-tpc-reco-workflow, o2-its-reco-workflow and o2-fit-reco-workflow
112+
taskwrapper itstpcMatch.log o2-tpcits-match-workflow $gloOpt --tpc-track-reader \"tpctracks.root\" --tpc-native-cluster-reader \"--infile tpc-native-clusters.root\"
113+
echo "Return status of itstpcMatch: $?"
114+
115+
echo "Running ITSTPC-TOF macthing flow"
116+
#needs results of TOF digitized data and results of o2-tpcits-match-workflow
117+
taskwrapper tofMatch.log o2-tof-reco-workflow $gloOpt
118+
echo "Return status of its-tpc-tof match: $?"
119+
120+
echo "Running primary vertex finding flow"
121+
#needs results of TPC-ITS matching and FIT workflows
122+
taskwrapper pvfinder.log o2-primary-vertexing-workflow $gloOpt
123+
echo "Return status of primary vertexing: $?"
124+
125+
# -----------
126+
# produce AOD
127+
# -----------
128+
129+
# enable later. It still has memory access problems
130+
#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
91131

92-
# we essentially only keep tpctracks
93-
mv tpctracks_${tf}.root output
94132
cp ${CONTEXTFILE} output
95133

96134
# cleanup step for this timeframe (we cleanup disc space early so as to make possible checkpoint dumps smaller)
97-
taskwrapper cleanup_${tf}.log "[ -f tpcreco_${tf}.log_done ] && rm sgn${tf}* && rm *digits*.root"
135+
taskwrapper cleanup_${tf}.log "[ -f aod${tf}.log_done ] && rm sgn${tf}* && rm *digits*.root"
98136
done
99137

100138
# We need to exit for the ALIEN JOB HANDLER!

0 commit comments

Comments
 (0)