Skip to content

Commit 39b766b

Browse files
jackal1-66sawenzel
authored andcommitted
Updated EPOS4 example using different versions and HQ
1 parent 9cb8054 commit 39b766b

File tree

6 files changed

+156
-17
lines changed

6 files changed

+156
-17
lines changed

run/SimExamples/HepMC_EPOS4/README.md

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ An in-depth explanation of the mechanisms behind the HepMC(3) data handling can
77
HepMC_fifo folder of the MC examples. The scripts use the `cmd` parameter of `GeneratorHepMC`
88
to spawn the EPOS4 generation via the `epos.sh` script.
99

10-
EPOS4 uses the outdated HepMC2 libraries, so this had to be specified in the steering scripts
10+
EPOS 4.0.0 uses the outdated HepMC2 libraries, so this had to be specified in the steering scripts
1111
of the generators configuration. If `HepMC.version=2` is removed then the scripts will not work
1212
anymore. This is to say that the balance achieved with the configurations provided is easily
1313
destroyed if the user base edits parts that are not understood completely.
14+
The latest EPOS 4.0.3 and EPOS4HQ both use HepMC3, so the version is automatically
15+
updated when these generators are used.
1416

1517
# Scripts description
1618

@@ -47,6 +49,7 @@ If no parameters are provided to the scripts, they will run with default values
4749
- **-n , --nevents** → changes the number of events in the .optns file or gets the one in the file if no events are provided
4850
- **-i , --input** → .optns filename to feed EPOS4, no extension must be set in the filename
4951
- **-j , --jobs** → sets the number of workers (jobs)
52+
- **-hq** → enables EPOS4HQ generation
5053
- **-h , --help** → prints usage instructions
5154
- **-e , --ecm** → sets the center-of-mass energy in the options file
5255

@@ -62,6 +65,6 @@ Now the three scripts start to differ:
6265
- **rundpg.sh** → first the o2dpg_sim_workflow.py script will be launched generating the json configuration, then the o2_dpg_workflow_runner.py script will start the workflow
6366
- **rundpl.sh** → o2-sim-dpl-eventgen is executed piping its results to o2-sim-mctracks-to-aod and afterwards to o2-analysis-mctracks-to-aod-simple-task
6467

65-
The last few lines of the scripts contain the execution of o2-sim, DPG worflow creator/runner and DPL software respectively, so this part can be modified by the users following their requirements. It's important not to delete from the configuration keys `GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none;HepMC.version=2;` and it would be better to provide additional configurations via the -m flag. EPOS4 cannot set a maximum impact parameter value, so it's better to leave the bMaxSwitch to none, while the others serve the sole purpose of running successfully the generator using auto generated FIFOs.
68+
The last few lines of the scripts contain the execution of o2-sim, DPG worflow creator/runner and DPL software respectively, so this part can be modified by the users following their requirements. It's important not to delete from the configuration keys `GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none$HEPMC;` and it would be better to provide additional configurations via the -m flag. EPOS4 cannot set a maximum impact parameter value, so it's better to leave the bMaxSwitch to none, while the others serve the sole purpose of running successfully the generator using auto generated FIFOs.
6669

6770

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# Script based on CRMC example
33
# EPOS4 option files must contain ihepmc set to 2 to print HepMC
44
# data on stdout. -hepmc flag is not needed anymore, but -hepstd is fundamental
55
# in order not to print useless information on stdout (a z-*optns*.mtr file will be created)
66

77
optns="example"
8-
seed=$RANDOM
8+
seed=1
9+
EPOS4=""
10+
11+
if [ -z "$EPO4VSN" ]; then
12+
# Error: EPO4VSN environment variable is not set
13+
exit 1
14+
fi
15+
16+
if [ "$EPO4VSN" = "4.0.0" ]; then
17+
EPOS4="$EPOS4_ROOT/epos4/scripts/epos"
18+
else
19+
EPOS4="$EPOS4_ROOT/bin/epos"
20+
fi
921

1022
while test $# -gt 0 ; do
1123
case $1 in
@@ -18,13 +30,23 @@ done
1830

1931
if [ ! -f $optns.optns ]; then
2032
echo "Error: Options file $optns.optns not found"
21-
exit 1
33+
exit 2
34+
fi
35+
36+
if grep -Fq "set ihq 1" $optns.optns; then
37+
if [ -z "$EPO4HQVSN" ]; then
38+
# Error: EPOS4HQ version not found
39+
exit 3
40+
else
41+
# Running with EPOS4HQ
42+
EPOS4="$EPO4HQ/bin/eposhq"
43+
fi
2244
fi
2345

2446
if [ $seed -eq 0 ]; then
25-
echo "Seed can't be 0, random number will be used"
26-
seed=$RANDOM
47+
# Seed can't be 0, random number will be used
48+
seed="$RANDOM"
2749
fi
2850

29-
# Or filters the stdout with only HepMC2 useful data
30-
$EPOS4_ROOT/epos4/scripts/epos -hepstd -s $seed $optns | sed -n 's/^\(HepMC::\|[EAUWVP] \)/\1/p'
51+
# OR filters the stdout with only HepMC useful data
52+
$EPOS4 -hepstd -s $seed $optns | sed -n 's/^\(HepMC::\|[EAUWVP] \)/\1/p'

run/SimExamples/HepMC_EPOS4/example.optns

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ set nfreeze 1 !number of freeze out events per hydro event
2929
set modsho 1 !printout every modsho events
3030
set centrality 0 !0=min bias
3131
set ihepmc 2 !HepMC output enabled on stdout
32-
set nfull 10
32+
set nfull 10 !Total nEvents to be generated
33+
set ihq 1 !Enable EPOS4HQ

run/SimExamples/HepMC_EPOS4/rundpg.sh

100644100755
Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ optns="example"
2323
TF=1
2424
eCM=-1
2525
JOBS=2
26+
HEPMC=""
27+
HQ=false
28+
29+
if [ -z "$EPO4VSN" ]; then
30+
echo "Error: EPOS4 version not found"
31+
exit 7
32+
fi
33+
if [ "$EPO4VSN" == "4.0.0" ]; then
34+
HEPMC=";HepMC.version=2"
35+
else
36+
HEPMC=";HepMC.version=3"
37+
fi
2638

2739
usage()
2840
{
@@ -38,6 +50,7 @@ Options:
3850
-h,--help Print these instructions
3951
-e,--ecm ENERGY Center-of-Mass energy
4052
-t,--tf TF Timeframes ($TF)
53+
-hq HQ Enable EPOS4HQ
4154
-- Rest of command line sent to o2-sim
4255
4356
COMMAND must be quoted if it contains spaces or other special
@@ -59,6 +72,7 @@ while test $# -gt 0 ; do
5972
-i|--input) optns=$2 ; shift ;;
6073
-j|--jobs) JOBS=$2 ; shift ;;
6174
-e|--ecm) eCM=$2 ; shift ;;
75+
-hq) HQ=true ; shift ;;
6276
-h|--help) usage; ${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py --help ; exit 0 ;;
6377
-t|--tf) TF=$2 ; shift ;;
6478
--) shift ; break ;;
@@ -115,6 +129,30 @@ else
115129
fi
116130
fi
117131

132+
# Set HQ mode
133+
134+
if [ "$HQ" = true ]; then
135+
echo "Setting HQ mode"
136+
if grep -Fq "ihq" $optns.optns; then
137+
sed -i "/ihq/c\set ihq 1" $optns.optns
138+
else
139+
echo "set ihq 1" >> $optns.optns
140+
fi
141+
if [ -z "$EPO4HQVSN" ]; then
142+
echo "Error: EPOS4HQ version not found"
143+
exit 7
144+
else
145+
HEPMC=";HepMC.version=3"
146+
fi
147+
else
148+
echo "Turning OFF HQ mode"
149+
if grep -Fq "ihq" $optns.optns; then
150+
sed -i "/ihq/c\set ihq 0" $optns.optns
151+
else
152+
echo "set ihq 0" >> $optns.optns
153+
fi
154+
fi
155+
118156
# Copy options file in each timeframe folder
119157
for i in $(seq 1 $TF); do
120158
if [ ! -d tf$i ]; then
@@ -125,8 +163,8 @@ done
125163

126164
# create workflow
127165

128-
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM $eCM -ns $NEV -gen hepmc -tf $TF -j $JOBS \
129-
-interactionRate 500000 -confKey "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none;HepMC.version=2;${more}"
166+
${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py -eCM $eCM -ns $NEV -gen hepmc -tf $TF -j $JOBS -seed $RANDOM \
167+
-interactionRate 500000 -confKey "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none$HEPMC;${more}"
130168

131169
# Run workflow
132170
${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json -tt aod --stdout-on-failure

run/SimExamples/HepMC_EPOS4/rundpl.sh

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ more=""
2121
optns="example"
2222
eCM=-1
2323
JOBS=2
24+
HEPMC=""
25+
HQ=false
26+
27+
if [ -z "$EPO4VSN" ]; then
28+
echo "Error: EPOS4 version not found"
29+
exit 7
30+
fi
31+
if [ "$EPO4VSN" == "4.0.0" ]; then
32+
HEPMC=";HepMC.version=2"
33+
else
34+
HEPMC=";HepMC.version=3"
35+
fi
2436

2537
usage()
2638
{
@@ -35,6 +47,7 @@ Options:
3547
-j,--jobs JOBS Number of jobs ($JOBS)
3648
-e,--ecm ENERGY Center-of-Mass energy
3749
-h,--help Print these instructions
50+
-hq HQ Enable EPOS4HQ
3851
-- Rest of command line sent to o2-sim
3952
4053
COMMAND must be quoted if it contains spaces or other special
@@ -56,6 +69,7 @@ while test $# -gt 0 ; do
5669
-i|--input) optns=$2 ; shift ;;
5770
-j|--jobs) JOBS=$2 ; shift ;;
5871
-e|--ecm) eCM=$2 ; shift ;;
72+
-hq) HQ=true ; shift ;;
5973
-h|--help) usage; o2-sim-dpl-eventgen --help full ; exit 0 ;;
6074
--) shift ; break ;;
6175
*) echo "Unknown option '$1', did you forget '--'?" >/dev/stderr
@@ -111,9 +125,32 @@ else
111125
fi
112126
fi
113127

114-
# Starting simulation => seed is fed automatically to epos with the --seed flag. HepMC.version = 2 is mandatory
128+
# Set HQ mode
129+
130+
if [ "$HQ" = true ]; then
131+
echo "Setting HQ mode"
132+
if grep -Fq "ihq" $optns.optns; then
133+
sed -i "/ihq/c\set ihq 1" $optns.optns
134+
else
135+
echo "set ihq 1" >> $optns.optns
136+
fi
137+
if [ -z "$EPO4HQVSN" ]; then
138+
echo "Error: EPOS4HQ version not found"
139+
exit 7
140+
else
141+
HEPMC=";HepMC.version=3"
142+
fi
143+
else
144+
echo "Turning OFF HQ mode"
145+
if grep -Fq "ihq" $optns.optns; then
146+
sed -i "/ihq/c\set ihq 0" $optns.optns
147+
else
148+
echo "set ihq 0" >> $optns.optns
149+
fi
150+
fi
151+
152+
# Starting simulation => seed is fed automatically to epos with the --seed flag. HepMC.version = 2 is mandatory for version 4.0.0
115153
# otherwise the simulation won't work.
116154
# Seed is automatically set to Random by the epos.sh script because the --seed option with o2-sim-dpl-eventgen does not feed the number to GeneratorHepMC
117-
118-
o2-sim-dpl-eventgen -b --nEvents ${NEV} --generator hepmc --configKeyValues "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none;HepMC.version=2;${more}" |\
155+
o2-sim-dpl-eventgen -b --nEvents ${NEV} --generator hepmc --configKeyValues "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none$HEPMC;${more}" |\
119156
o2-sim-mctracks-to-aod -b | o2-analysis-mctracks-to-aod-simple-task -b

run/SimExamples/HepMC_EPOS4/runo2sim.sh

100644100755
Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ more=""
2121
optns="example"
2222
eCM=-1
2323
JOBS=2
24+
HEPMC=""
25+
HQ=false
26+
27+
if [ -z "$EPO4VSN" ]; then
28+
echo "Error: EPOS4 version not found"
29+
exit 7
30+
fi
31+
if [ "$EPO4VSN" == "4.0.0" ]; then
32+
HEPMC=";HepMC.version=2"
33+
else
34+
HEPMC=";HepMC.version=3"
35+
fi
2436

2537
usage()
2638
{
@@ -35,6 +47,7 @@ Options:
3547
-j,--jobs JOBS Number of jobs ($JOBS)
3648
-e,--ecm ENERGY Center-of-Mass energy
3749
-h,--help Print these instructions
50+
-hq HQ Enable EPOS4HQ
3851
-- Rest of command line sent to o2-sim
3952
4053
COMMAND must be quoted if it contains spaces or other special
@@ -56,6 +69,7 @@ while test $# -gt 0 ; do
5669
-i|--input) optns=$2 ; shift ;;
5770
-j|--jobs) JOBS=$2 ; shift ;;
5871
-e|--ecm) eCM=$2 ; shift ;;
72+
-hq) HQ=true ; shift ;;
5973
-h|--help) usage; o2-sim --help full ; exit 0 ;;
6074
--) shift ; break ;;
6175
*) echo "Unknown option '$1', did you forget '--'?" >/dev/stderr
@@ -111,7 +125,31 @@ else
111125
fi
112126
fi
113127

114-
# Starting simulation => seed is fed automatically to epos with the --seed flag. HepMC.version = 2 is mandatory
128+
# Set HQ mode
129+
130+
if [ "$HQ" = true ]; then
131+
echo "Setting HQ mode"
132+
if grep -Fq "ihq" $optns.optns; then
133+
sed -i "/ihq/c\set ihq 1" $optns.optns
134+
else
135+
echo "set ihq 1" >> $optns.optns
136+
fi
137+
if [ -z "$EPO4HQVSN" ]; then
138+
echo "Error: EPOS4HQ version not found"
139+
exit 7
140+
else
141+
HEPMC=";HepMC.version=3"
142+
fi
143+
else
144+
echo "Turning OFF HQ mode"
145+
if grep -Fq "ihq" $optns.optns; then
146+
sed -i "/ihq/c\set ihq 0" $optns.optns
147+
else
148+
echo "set ihq 0" >> $optns.optns
149+
fi
150+
fi
151+
152+
# Starting simulation => seed is fed automatically to epos with the --seed flag. HepMC.version = 2 is mandatory for version 4.0.0
115153
# otherwise the simulation won't work
116154
o2-sim -j $JOBS -n ${NEV} -g hepmc --seed $RANDOM \
117-
--configKeyValues "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none;HepMC.version=2;${more}"
155+
--configKeyValues "GeneratorFileOrCmd.cmd=$cmd -i $optns;GeneratorFileOrCmd.bMaxSwitch=none$HEPMC;${more}"

0 commit comments

Comments
 (0)