|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | # Embed jet-jet events in a pre-defined pT hard bin into HI events, both Pythia8 |
4 | | -# run_jets_embedding.sh n_pthatbin |
| 4 | +# Execute: ./run_jets_embedding.sh |
| 5 | +# Set at least before running PTHATBIN with 1 to 21 |
5 | 6 |
|
6 | | -set -x |
| 7 | +#set -x |
7 | 8 |
|
8 | | -MODULES="PIPE ITS TPC EMCAL" |
9 | | -BKGEVENTS=5 |
10 | | -SIGEVENTS=20 |
11 | | -NWORKERS=8 |
| 9 | +# ----------- LOAD UTILITY FUNCTIONS -------------------------- |
| 10 | +. ${O2_ROOT}/share/scripts/jobutils.sh |
12 | 11 |
|
13 | | -# generate background |
| 12 | +# ----------- START ACTUAL JOB ----------------------------- |
14 | 13 |
|
15 | | -o2-sim -j ${NWORKERS} -n ${BKGEVENTS} -g pythia8hi -m ${MODULES} -o bkg \ |
16 | | - --configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini \ |
17 | | - > logbkg 2>&1 |
18 | | - |
19 | | -# generate Pythia8 configuration |
20 | | - |
21 | | -RNDSEED=0 # [default = 0] time-based random seed |
| 14 | +RNDSEED=${RNDSEED:-0} # [default = 0] time-based random seed |
| 15 | +NSIGEVENTS=${NSIGEVENTS:-20} |
| 16 | +NBKGEVENTS=${NBKGEVENTS:-20} |
| 17 | +NWORKERS=${NWORKERS:-8} |
| 18 | +MODULES="--skipModules ZDC" #"PIPE ITS TPC EMCAL" |
| 19 | +CONFIG_ENERGY=${CONFIG_ENERGY:-5020.0} |
| 20 | +CONFIG_NUCLEUSA=${CONFIG_NUCLEUSA:-2212} |
| 21 | +CONFIG_NUCLEUSB=${CONFIG_NUCLEUSB:-2212} |
22 | 22 |
|
23 | 23 | # Define the pt hat bin arrays |
24 | 24 | pthatbin_loweredges=(0 5 7 9 12 16 21 28 36 45 57 70 85 99 115 132 150 169 190 212 235) |
25 | 25 | pthatbin_higheredges=( 5 7 9 12 16 21 28 36 45 57 70 85 99 115 132 150 169 190 212 235 -1) |
26 | 26 |
|
27 | | -# Define environmental vars for pt binning |
28 | | -PTHATBIN=$1 #set it here or externally? Add protection out of array? |
| 27 | +# Recover environmental vars for pt binning |
| 28 | +#PTHATBIN=${PTHATBIN:-1} |
| 29 | + |
| 30 | +if [ -z "$PTHATBIN" ]; then |
| 31 | + echo "Pt-hat bin (env. var. PTHATBIN) not set, abort." |
| 32 | + exit 1 |
| 33 | +fi |
29 | 34 |
|
30 | 35 | PTHATMIN=${pthatbin_loweredges[$PTHATBIN]} |
31 | 36 | PTHATMAX=${pthatbin_higheredges[$PTHATBIN]} |
32 | 37 |
|
| 38 | +# Generate background |
| 39 | +taskwrapper bkgsim.log o2-sim -j ${NWORKERS} -n ${NBKGEVENTS} \ |
| 40 | + -g pythia8hi -m ${MODULES} -o bkg \ |
| 41 | + --configFile ${O2DPG_ROOT}/MC/config/common/ini/basic.ini |
| 42 | + |
| 43 | +# Generate Pythia8 jet-jet configuration |
33 | 44 | ${O2DPG_ROOT}/MC/config/common/pythia8/utils/mkpy8cfg.py \ |
34 | | - --output=pythia8_jets.cfg \ |
35 | | - --seed=${RNDSEED} \ |
36 | | - --idA=2212 \ |
37 | | - --idB=2212 \ |
38 | | - --eCM=5020. \ |
39 | | - --process=jets \ |
40 | | - --ptHatMin=${PTHATMIN} \ |
41 | | - --ptHatMax=${PTHATMAX} |
42 | | - |
43 | | -# embed signal into background |
44 | | - |
45 | | -o2-sim -j ${NWORKERS} -n ${SIGEVENTS} -g pythia8 -m ${MODULES} -o sgn \ |
| 45 | + --output=pythia8_jets.cfg \ |
| 46 | + --seed=${RNDSEED} \ |
| 47 | + --idA=${CONFIG_NUCLEUSA} \ |
| 48 | + --idB=${CONFIG_NUCLEUSB} \ |
| 49 | + --eCM=${CONFIG_ENERGY} \ |
| 50 | + --process=jets \ |
| 51 | + --ptHatMin=${PTHATMIN} \ |
| 52 | + --ptHatMax=${PTHATMAX} |
| 53 | + |
| 54 | +# Generate and embed signal into background |
| 55 | +taskwrapper sgnsim.log o2-sim -j ${NWORKERS} -n ${NSIGEVENTS} \ |
| 56 | + -g pythia8 -m ${MODULES} \ |
46 | 57 | --configKeyValues "GeneratorPythia8.config=pythia8_jets.cfg" \ |
47 | | - --embedIntoFile bkg_Kine.root \ |
48 | | - > logsgn 2>&1 |
| 58 | + --embedIntoFile bkg_Kine.root \ |
| 59 | + -o sgn |
| 60 | + |
| 61 | +# We need to exit for the ALIEN JOB HANDLER! |
| 62 | +exit 0 |
0 commit comments