Skip to content

Commit

Permalink
Added new production branch sync
Browse files Browse the repository at this point in the history
  • Loading branch information
cdean-github committed Dec 26, 2021
1 parent cebec72 commit fa2b4b6
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/sync-with-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ jobs:
from_branch: production
target_branch: production_pythia8
github_token: ${{ github.token }}

- name: Merge production -> production_singleParticle_0-20GeV
uses: devmasx/merge-branch@v1.3.1
with:
type: now
from_branch: production
target_branch: production_singleParticle_0-20GeV
github_token: ${{ github.token }}
4 changes: 2 additions & 2 deletions detectors/EICDetector/Fun4All_G4_EICDetector.C
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int Fun4All_G4_EICDetector(
const string &outputFile = "G4EICDetector.root",
const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root",
const int skip = 0,
const string &outdir = ".")
const string &outdir = ".", const string particleType = "e-")
{
//---------------
// Fun4All server
Expand Down Expand Up @@ -141,7 +141,7 @@ int Fun4All_G4_EICDetector(
// add the settings for other with [1], next with [2]...
if (Input::SIMPLE)
{
INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5);
INPUTGENERATOR::SimpleEventGenerator[0]->add_particles(particleType, 5);
if (Input::HEPMC || Input::EMBED)
{
INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true);
Expand Down
104 changes: 104 additions & 0 deletions detectors/EICDetector/run_EIC_production.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash

source /cvmfs/eic.opensciencegrid.org/ecce/gcc-8.3/opt/fun4all/core/bin/ecce_setup.sh -n $6

export ROOT_INCLUDE_PATH=$(pwd)/../../common:$ROOT_INCLUDE_PATH

metaDataFile=${5}/${3}.txt
tmpLogFile=${3}.out

d=`date +%Y/%m/%d`
t=`date +%H:%M`

# Print production details to screen and to metadata file simultaneously
cat << EOF | tee ${metaDataFile}
====== Your production details ======
Production started: ${d} ${t}
Production site: $9
Production Host: ${HOSTNAME}
ECCE build: $6
ECCE macros branch: ${12}
ECCE macros hash: $8
PWG: $7
Generator: ${10}
Collision type: ${11}
Input file: $2
Output file: $3
Output dir: $5
Number of events: $1
Skip: $4
=====================================
EOF

particleType=
if [ "${12}" == "production_singleParticle" ]
then
if [ "${11}" == "singlePion" ]
then
particleType="pi-"
elif [ "${11}" == "singlePionPlus" ]
then
particleType="pi+"
elif [ "${11}" == "singleMuon" ]
then
particleType="mu-"
elif [ "${11}" == "singleMuonPlus" ]
then
particleType="mu+"
elif [ "${11}" == "singlePositron" ]
then
particleType="e+"
else
particleType="e-"
fi
fi

# Run Fun4all. Send output to stdout but also capture to temporary local file
if [ "${12}" == "production_singleParticle" ]
then
echo running root.exe -q -b Fun4All_G4_EICDetector.C\($1,\"$2\",\"$3\",\"\",$4,\"$5\"\,\"${particleType}\"\)
root.exe -q -b Fun4All_G4_EICDetector.C\($1,\"$2\",\"$3\",\"\",$4,\"$5\",\"${particleType}\"\) | tee ${tmpLogFile}
else
echo running root.exe -q -b Fun4All_G4_EICDetector.C\($1,\"$2\",\"$3\",\"\",$4,\"$5\"\)
root.exe -q -b Fun4All_G4_EICDetector.C\($1,\"$2\",\"$3\",\"\",$4,\"$5\"\) | tee ${tmpLogFile}
fi
rc_dst=$?
echo " rc for dst: $rc_dst"

# Do some basic error handling here: is this failed we need to abort! Continuing might cause broken files on all levels.
if [ ".$rc_dst" != ".0" ] || ! [ -e "$outputPath/$outputFile" ]
then
echo " DST production failed. EXIT here, no file copy will be initiated!"
ls -lhrt $outputPath
exit $rc_dst
fi

# Scan stdout of Fun4all for random number seeds and add to metadata file
echo production script finished, writing metadata
echo "" >> ${metaDataFile}
echo Seeds: >> ${metaDataFile}
grep 'PHRandomSeed::GetSeed()' ${tmpLogFile} | awk '{print $3}' >> ${metaDataFile}
rm ${tmpLogFile}

echo "" >> ${metaDataFile}
echo md5sum: >> ${metaDataFile}
md5sum ${5}/${3} | awk '{print $1}' >> ${metaDataFile}

echo "DST has been created"
echo "Now producing evaluators"

root.exe -q -b Fun4All_runEvaluators.C\(0,\"$3\",\"$5\",0,\"$5\"\)

rc_eval=$?
echo " rc for eval: $rc_eval"
# Do some more error handling here.
if [ ".$rc_eval" != ".0" ]
then
echo " EVAL production failed. Delete the potentially broken or incomplete EVAL files."
echo " --> but keeping the DST and continue to copy."
evalFileHeader=$(echo $3 | sed 's/.root//')
rm -rf ${outputPath}/eval_*/${evalFileHeader}*
fi

echo "script done"

0 comments on commit fa2b4b6

Please sign in to comment.