Skip to content

Commit cac8e8f

Browse files
committed
Improve anchorMC testing for 2tags
1 parent 691d4d5 commit cac8e8f

File tree

3 files changed

+176
-0
lines changed

3 files changed

+176
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
#JDL_OUTPUT=*.txt@disk=1,AO2D.root@disk=2,*.log@disk=1,*stat*@disk=1,*.json@disk=1,debug*tgz@disk=2
3+
#JDL_ERROROUTPUT=*.txt@disk=1,AO2D.root@disk=2,*.log@disk=1,*.json@disk=1,debug*tgz@disk=2
4+
#JDL_PACKAGE=%{SOFTWARETAG_SIM}
5+
#JDL_REQUIRE=%{JDL_REQUIREMENT}
6+
7+
#
8+
# A template anchoring script to test various anchoring setups
9+
# and software combinations
10+
#
11+
12+
# only relevant if executed locally
13+
if [ ! ${O2_ROOT} ]; then
14+
source <(/cvmfs/alice.cern.ch/bin/alienv printenv %{SOFTWARETAG_SIM})
15+
fi
16+
17+
# meta configuration of the job (influences reco config)
18+
export ALIEN_JDL_LPMPRODUCTIONTYPE=MC
19+
export ALIEN_JDL_CPULIMIT=8
20+
21+
export ALIEN_JDL_LPMANCHORPASSNAME=%{PASSNAME}
22+
export ALIEN_JDL_MCANCHOR=%{PASSNAME}
23+
export ALIEN_JDL_COLLISIONSYSTEM=%{COL_SYSTEM}
24+
export ALIEN_JDL_LPMPASSNAME=%{PASSNAME}
25+
export ALIEN_JDL_LPMRUNNUMBER=%{RUN_NUMBER}
26+
export ALIEN_JDL_LPMANCHORRUN=%{RUN_NUMBER}
27+
28+
export ALIEN_JDL_LPMINTERACTIONTYPE=%{INTERACTIONTYPE}
29+
export ALIEN_JDL_LPMPRODUCTIONTAG=%{PRODUCTION_TAG}
30+
export ALIEN_JDL_LPMANCHORPRODUCTION=%{ANCHOR_PRODUCTION}
31+
export ALIEN_JDL_LPMANCHORYEAR=%{ANCHORYEAR}
32+
export ALIEN_JDL_O2DPG_ASYNC_RECO_TAG="%{SOFTWARETAG_ASYNC}"
33+
34+
# get custom O2DPG for 2tag treatment (could be used to test different O2DPG branches)
35+
# git clone https://github.com/AliceO2Group/O2DPG O2DPG
36+
# export O2DPG_ROOT=${PWD}/O2DPG
37+
# export ALIEN_JDL_O2DPG_OVERWRITE=${PWD}/O2DPG
38+
39+
# dimension the job
40+
export NTIMEFRAMES=1
41+
export NSIGEVENTS=200000
42+
43+
# further configuration of the job
44+
export ALIEN_JDL_ADDTIMESERIESINMC=0
45+
export DISABLE_QC=1
46+
export ALIEN_JDL_MC_ORBITS_PER_TF=10000:10000000:1 #
47+
export ALIEN_JDL_O2DPGWORKFLOWTARGET="aod"
48+
49+
# select anchoring points
50+
export PRODSPLIT=${ALIEN_O2DPG_GRIDSUBMIT_PRODSPLIT:-100}
51+
export SPLITID=${ALIEN_O2DPG_GRIDSUBMIT_SUBJOBID:-50}
52+
export CYCLE=0
53+
54+
# generator and other sim configuration
55+
export ALIEN_JDL_ANCHOR_SIM_OPTIONS="%{SIM_OPTIONS}"
56+
57+
echo "Hello World"
58+
59+
# execute
60+
# ${O2DPG_ROOT}/MC/run/ANCHOR/anchorMC.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#comment
2+
%{SOFTWARETAG_SIM},%{SOFTWARETAG_ASYNC},%{PASSNAME},%{COL_SYSTEM},%{RUN_NUMBER},%{INTERACTIONTYPE},%{PRODUCTION_TAG},%{ANCHOR_PRODUCTION},%{ANCHORYEAR},%{SIM_OPTIONS}
3+
O2sim::v20250306-1,O2PDPSuite::async-async-v1-01-08-slc9-alidist-async-v1-01-01-1,apass7,p-p,526641,pp,LHC25a9_Plus10,LHC22o,2022,-gen pythia8
4+
#O2sim::v20250305-1,O2PDPSuite::async-async-v1-01-12-slc9-alidist-async-v1-01-01-1,apass1,p-p,551398,pp,LHC25a7_Plus10,LHC24ag,2024,-gen pythia8
5+
#O2sim::v20250305-1,O2PDPSuite::async-async-v1-02-10-slc9-alidist-async-v1-02-01-1,apass1,Pb-Pb,559544,PbPb,LHC25c5b,LHC24ar,2024,-gen pythia8 -confKey 'SimCutParams.globalDensityFactor=0.9f'

MC/run/ANCHOR/tests/test_looper.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/bash
2+
3+
# loops over all test cases and executes them
4+
5+
#!/bin/bash
6+
7+
# Read the CSV file
8+
INPUT_FILE="test_anchor_cases.csv"
9+
INPUT_FILE_STRIPPED=${INPUT_FILE}_clean
10+
TEMPLATE_FILE="test_anchor_2tag_template.sh"
11+
OUTPUT_FILE="test_anchor_generated"
12+
13+
SITES_FILE="test_GRID_sites.dat"
14+
15+
REQUIRE_STRING=""
16+
{
17+
while read -r -a values; do
18+
if [ ! "${REQUIRE_STRING}" == "" ]; then
19+
REQUIRE_STRING="${REQUIRE_STRING} ||"
20+
fi
21+
REQUIRE_STRING="${REQUIRE_STRING} (other.CE == \"${values}\")"
22+
done
23+
} < ${SITES_FILE}
24+
REQUIRE_STRING="(${REQUIRE_STRING});"
25+
26+
echo "REQUIRE STRING ${REQUIRE_STRING}"
27+
28+
# strip comments from CSV file
29+
grep -v '#' ${INPUT_FILE} > ${INPUT_FILE_STRIPPED}
30+
31+
# Read the header line and convert it into variable names
32+
IFS=',' read -r -a headers < "$INPUT_FILE_STRIPPED"
33+
34+
# Replace placeholders in the header (e.g., %{VAR} → VAR)
35+
for i in "${!headers[@]}"; do
36+
headers[$i]=$(echo "${headers[$i]}" | sed -E 's/#?%\{//;s/\}//g')
37+
done
38+
39+
# Read and process each subsequent line
40+
{
41+
read # Skip the header line
42+
43+
count=1 # Counter for output files
44+
while IFS=',' read -r -a values; do
45+
# Assign each value to its corresponding variable
46+
for i in "${!headers[@]}"; do
47+
declare "${headers[$i]}"="${values[$i]}"
48+
done
49+
50+
# Example: Print assigned variables
51+
echo "SOFTWARETAG_SIM: $SOFTWARETAG_SIM"
52+
echo "SOFTWARETAG_ASYNC: $SOFTWARETAG_ASYNC"
53+
echo "PASSNAME: $PASSNAME"
54+
echo "COL_SYSTEM: $COL_SYSTEM"
55+
echo "RUN_NUMBER: $RUN_NUMBER"
56+
echo "INTERACTIONTYPE: $INTERACTIONTYPE"
57+
echo "PRODUCTION_TAG: $PRODUCTION_TAG"
58+
echo "ANCHOR_PRODUCTION: $ANCHOR_PRODUCTION"
59+
echo "ANCHORYEAR: $ANCHORYEAR"
60+
echo "SIM_OPTIONS: $SIM_OPTIONS"
61+
echo "--------------------------------"
62+
63+
OUTPUT_FILE_FINAL="${OUTPUT_FILE}_case${count}.sh"
64+
cp "$TEMPLATE_FILE" "$OUTPUT_FILE_FINAL"
65+
66+
# create final test script with these values
67+
cp "$TEMPLATE_FILE" "$OUTPUT_FILE_FINAL"
68+
for var in "${headers[@]}"; do
69+
sed -i "s|%{$var}|${!var}|g" "$OUTPUT_FILE_FINAL"
70+
done
71+
# put the require spec
72+
sed -i "s/%{JDL_REQUIREMENT}/${REQUIRE_STRING}/g" "$OUTPUT_FILE_FINAL"
73+
74+
# THIS COULD BE DONE CONDITIONALLY
75+
# we submit the test to the GRID
76+
echo "${O2DPG_ROOT}/GRID/utils/grid_submit.sh --prodsplit 1 --local --singularity --ttl 360 --script ${OUTPUT_FILE_FINAL} --jobname "anchorTest${count}" --wait --fetch-output" > submit_case${count}.sh
77+
# TODO: optional local execution
78+
79+
((count++)) # Increment counter for next row
80+
done
81+
} < "${INPUT_FILE_STRIPPED}" #Redirect file input here to avoid subshell issues
82+
exit 0
83+
84+
# now we submit all the jobs in the background and wait for them to return
85+
for s in `ls submit*.sh`; do
86+
echo "submitting ${s}"
87+
bash ${s} &> log_${s} &
88+
done
89+
90+
# for for all (GRID) jobs to return
91+
wait
92+
93+
# verify / validate the output produced from these jobs
94+
# The test is successfull if at least one subjob from each test
95+
# produced the AO2D output.
96+
echo "-- Jobs done ... validating --"
97+
98+
for s in `ls submit*.sh`; do
99+
# find out output path
100+
# Local working directory is /tmp/alien_work/anchorTest1-20250306-052755
101+
TEST_OUTPUT_PATH=$(grep "Local working directory is" log_${s} | awk '//{print $5}')
102+
103+
# see if there is an AO2D.root and a workflow.json in one of the jobs in that folder
104+
find ${TEST_OUTPUT_PATH} -name "AO2D.root"
105+
SUCCESS_AOD=$?
106+
107+
find ${TEST_OUTPUT_PATH} -name "workflow.json"
108+
done
109+
110+
111+
echo "-- Cleaning up ... "

0 commit comments

Comments
 (0)