|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# |
| 4 | +# A example workflow doing signal-background embedding, meant |
| 5 | +# to study embedding speedups. |
| 6 | +# Background events are reused across timeframes. |
| 7 | +# |
| 8 | + |
| 9 | +# ----------- LOAD UTILITY FUNCTIONS -------------------------- |
| 10 | +. ${O2_ROOT}/share/scripts/jobutils.sh |
| 11 | + |
| 12 | +# ----------- START ACTUAL JOB ----------------------------- |
| 13 | + |
| 14 | +NSIGEVENTS=${NSIGEVENTS:-20} |
| 15 | +NTIMEFRAMES=${NTIMEFRAMES:-5} |
| 16 | +NWORKERS=${NWORKERS:-8} |
| 17 | +NBKGEVENTS=${NBKGEVENTS:-20} |
| 18 | +MODULES="--skipModules ZDC" |
| 19 | + |
| 20 | + |
| 21 | +# background task ------- |
| 22 | +taskwrapper bkgsim.log o2-sim -j ${NWORKERS} -n ${NBKGEVENTS} -g pythia8hi ${MODULES} -o bkg \ |
| 23 | + --configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini |
| 24 | + |
| 25 | +# loop over timeframes |
| 26 | +for tf in `seq 1 ${NTIMEFRAMES}`; do |
| 27 | + |
| 28 | + RNDSEED=0 |
| 29 | + PTHATMIN=0. # [default = 0] |
| 30 | + PTHATMAX=-1. # [default = -1] |
| 31 | + |
| 32 | + # produce the signal configuration |
| 33 | + ${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \ |
| 34 | + --output=pythia8.cfg \ |
| 35 | + --seed=${RNDSEED} \ |
| 36 | + --idA=2212 \ |
| 37 | + --idB=2212 \ |
| 38 | + --eCM=13000. \ |
| 39 | + --process=ccbar \ |
| 40 | + --ptHatMin=${PTHATMIN} \ |
| 41 | + --ptHatMax=${PTHATMAX} |
| 42 | + |
| 43 | + # simulate the signals for this timeframe |
| 44 | + taskwrapper sgnsim_${tf}.log o2-sim ${MODULES} -n ${NSIGEVENTS} -e TGeant3 -j ${NWORKERS} -g extgen \ |
| 45 | + --configFile ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini \ |
| 46 | + --configKeyValues "GeneratorPythia8.config=pythia8.cfg" \ |
| 47 | + --embedIntoFile bkg_Kine.root \ |
| 48 | + -o sgn${tf} |
| 49 | + |
| 50 | + CONTEXTFILE=collisioncontext_${tf}.root |
| 51 | + |
| 52 | + cp sgn${tf}_grp.root o2sim_grp.root |
| 53 | + |
| 54 | + # now run digitization phase |
| 55 | + echo "Running digitization for $intRate kHz interaction rate" |
| 56 | + |
| 57 | + gloOpt="-b --run --shm-segment-size 10000000000" # TODO: decide shared mem based on event number |
| 58 | + |
| 59 | + taskwrapper tpcdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --onlyDet TPC --interactionRate 50000 --tpc-lanes ${NWORKERS} --outcontext ${CONTEXTFILE} |
| 60 | + # --> a) random seeding |
| 61 | + # --> b) propagation of collisioncontext and application in other digitization steps |
| 62 | + |
| 63 | + echo "Return status of TPC digitization: $?" |
| 64 | + 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} |
| 65 | + echo "Return status of TRD digitization: $?" |
| 66 | + |
| 67 | + taskwrapper restdigi_${tf}.log o2-sim-digitizer-workflow $gloOpt -n ${NSIGEVENTS} --sims bkg,sgn${tf} --skipDet TRD,TPC,FT0 --interactionRate 50000 --incontext ${CONTEXTFILE} |
| 68 | + echo "Return status of OTHER digitization: $?" |
| 69 | + |
| 70 | + taskwrapper tpcreco_${tf}.log o2-tpc-reco-workflow $gloOpt --tpc-digit-reader \"--infile tpcdigits.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=10000\" |
| 71 | + echo "Return status of tpcreco: $?" |
| 72 | + |
| 73 | + # we need to move these products somewhere |
| 74 | + mv tpctracks.root tpctracks_${tf}.root |
| 75 | + mv tpcdigits.root tpcdigits_${tf}.root |
| 76 | +done |
| 77 | + |
| 78 | +# We need to exit for the ALIEN JOB HANDLER! |
| 79 | +exit 0 |
0 commit comments