Skip to content

Commit

Permalink
Merge pull request #28 from maureeungaro/main
Browse files Browse the repository at this point in the history
ci using modules
  • Loading branch information
maureeungaro authored Mar 2, 2023
2 parents ab0b9c6 + 2023ec0 commit ac0e1fd
Show file tree
Hide file tree
Showing 28 changed files with 1,412 additions and 201 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: needs.generate-matrix.outputs.jobtype == '0'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: jeffersonlab/gemc:3.0-clas12
container: jeffersonlab/gemc3:1.0c12s
name: Build ${{ matrix.detector }}
strategy:
fail-fast: false
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/dawn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: needs.generate-matrix.outputs.jobtype == '0'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: jeffersonlab/gemc:3.0-clas12
container: jeffersonlab/gemc3:1.0c12s
name: Dawn Screenshot ${{ matrix.detector }}
strategy:
fail-fast: false
Expand All @@ -57,18 +57,11 @@ jobs:
- name: Run Dawn
run: |
./ci/tests.sh -s ${{ matrix.detector }} -d
- name: Archive PDFs
uses: actions/upload-artifact@v3
# https://github.com/stefanzweifel/git-auto-commit-action
- uses: stefanzweifel/git-auto-commit-action@v4
with:
name: Archive Dawn Screenshots
path: screenshots
- name: Commit PDFs
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git diff --name-only
#git add screenshots
#git commit -m 'Re-build package plot' || echo "No changes to commit"
#git push origin || echo "No changes to commit"
commit_message: Apply php-cs-fixer changes
file_pattern: 'screenshots/*/*.pdf'


2 changes: 1 addition & 1 deletion .github/workflows/overlaps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: needs.generate-matrix.outputs.jobtype == '0'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: jeffersonlab/gemc:3.0-clas12
container: jeffersonlab/gemc3:1.0c12s
name: Overlaps ${{ matrix.detector }}
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: needs.generate-matrix.outputs.jobtype == '0'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: jeffersonlab/gemc:3.0-clas12
container: jeffersonlab/gemc3:1.0c12s
name: Tests ${{ matrix.detector }}
strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: needs.generate-matrix.outputs.jobtype == '0'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: jeffersonlab/gemc:3.0-clas12
container: jeffersonlab/gemc3:1.0c12s
name: Validate ${{ matrix.detector }}
strategy:
fail-fast: false
Expand All @@ -56,7 +56,7 @@ jobs:
uses: actions/checkout@main
- name: Validate ${{ matrix.detector }}
run: |
./ci/validateAgainstGemc2.sh -s ${{ matrix.detector }} -p /jlab/clas12Tags/$CLAS12TAG/experiments/clas12
./ci/validateAgainstGemc2.sh -s ${{ matrix.detector }} -p /work/clas12_tags/$CLAS12TAG/experiments/clas12
env:
CLAS12TAG: 5.1

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Software to build CLAS12 systems geometry and digitization plugins

## Geometry service

CLAS12 systems that use the coatjava geometry service to share geometry between simulation and recontruction
use groovy to import the geometry parameters. To install coatjava:
Some CLAS12 systems use the coatjava geometry service to share geometry
between simulation and recontruction. Those systems use groovy to import
the geometry parameters. To install coatjava:

- Download coatjava:
`./installClas12Coatjava.sh`

`installClas12Coatjava.sh`

To create volume parameters for a system, run the groovy scripts through the runFactories script:
To create volume parameters for a system, run the groovy scripts
through the runFactories script:

`cd groovyFactories`

Expand Down
45 changes: 26 additions & 19 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
# git clone http://github.com/maureeungaro/clas12-systems /root/clas12-systems && cd /root/clas12-systems
# ./ci/build.sh -s ftof

if [[ -z "${G3CLAS12_VERSION}" ]]; then
# load environment if we're on the container
# notice the extra argument to the source command
TERM=xterm # source script use tput for colors, TERM needs to be specified
FILE=/etc/profile.d/jlab.sh
test -f $FILE && source $FILE keepmine
# if we are in the docker container, we need to load the modules
if [[ -z "${DISTTAG}" ]]; then
echo "\nNot in container"
else
echo clas12-systems ci/build: environment already defined
echo "\nIn container: ${DISTTAG}"
source /app/localSetup.sh
fi

Help()
Expand All @@ -35,6 +33,8 @@ Help()
echo
}



if [ $# -eq 0 ]; then
Help
exit 1
Expand Down Expand Up @@ -91,9 +91,8 @@ CreateAndCopyDetectorTXTs() {
subDir=$(basename $system)
filesToCopy=$(ls | grep \.txt | grep "$subdir")
echo
echo Moving $=filesToCopy to $GPLUGIN_PATH and cleaning up
echo
mv $=filesToCopy $GPLUGIN_PATH
echo "Moving $=filesToCopy to $GEMCDB_ENV"
mv $=filesToCopy $GEMCDB_ENV/
# cleaning up
test -d __pycache__ && rm -rf __pycache__
}
Expand All @@ -105,8 +104,12 @@ CompileAndCopyPlugin() {
echo Compiling $detector plugin with options: "$copt"
echo
cd plugin
#scons -c
scons SHOWENV=1 SHOWBUILD=1 $copt
scons SHOWENV=1 SHOWBUILD=1 $copt install
if [ $? -ne 0 ]; then
echo "Building plugin for $detector failed"
exit 1
fi

gpls=$(ls *.gplugin)
for gpl in $gpls;
do
Expand All @@ -119,22 +122,20 @@ CompileAndCopyPlugin() {
fi
done
echo
echo Moving plugins to $GPLUGIN_PATH
mv *.gplugin $GPLUGIN_PATH
echo "GPLUGIN_PATH is $GPLUGIN_PATH. Content:"
ls -ltrh $GPLUGIN_PATH/
}

BuildSystem() {
system=$1
DefineScriptName $system
echo
echo Building geometry for $system. GPLUGIN_PATH is $GPLUGIN_PATH
echo Building geometry for $system.
echo
pwd
cd $system
CreateAndCopyDetectorTXTs $system
test -d plugin && CompileAndCopyPlugin || echo "No plugin to build."
echo $GPLUGIN_PATH content:
ls -ltrh $GPLUGIN_PATH
cd $startDir
}

Expand All @@ -145,9 +146,15 @@ BuildAllSystems() {
done
}

# for some reason DYLD_LIBRARY_PATH is not passed to this script
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH

# location of geometry database - notice we need to set it here again
startDir=`pwd`
GPLUGIN_PATH=$startDir/systemsTxtDB
script=no
export GEMCDB_ENV="$(pwd)/systemsTxtDB"

echo "BUILD.SH: GLIBRARY is $GLIBRARY, GPLUGIN_PATH is $GPLUGIN_PATH, GEMCDB_ENV is $GEMCDB_ENV"

script=no
[[ -v buildAll ]] && BuildAllSystems || BuildSystem $detector

38 changes: 17 additions & 21 deletions ci/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
# git clone http://github.com/gemc/clas12-systems /root/clas12-systems && cd /root/clas12-systems
# git clone http://github.com/maureeungaro/clas12-systems /root/clas12-systems && cd /root/clas12-systems
# ./ci/tests.sh -s ftof -o
# ./ci/tests.sh -s ftof -t
# ./ci/tests.sh -s ftof -d

if [[ -z "${G3CLAS12_VERSION}" ]]; then
# load environment if we're on the container
# notice the extra argument to the source command
TERM=xterm # source script use tput for colors, TERM needs to be specified
FILE=/etc/profile.d/jlab.sh
test -f $FILE && source $FILE keepmine
# if we are in the docker container, we need to load the modules
if [[ -z "${DISTTAG}" ]]; then
echo "\nNot in container"
else
echo clas12-systems ci/tests: environment already defined
echo "\nIn container: ${DISTTAG}"
TERM=xterm # source script use tput for colors, TERM needs to be specified
source /app/localSetup.sh
fi

Help()
Expand Down Expand Up @@ -107,25 +108,20 @@ PublishDawn () {

[[ -v testType ]] && echo Running $testType tests || TestTypeNotDefined

startDir=`pwd`
GPLUGIN_PATH=$startDir/systemsTxtDB
cp $GLIBRARY/lib/gstreamer*.gplugin $GPLUGIN_PATH
jcards=no

./ci/build.sh -s $detector
if [ $? -ne 0 ]; then
echo building system $detector failed
exit 1
fi

# sets the list of jcards to run
JcardsToRun

# for some reason DYLD_LIBRARY_PATH is not passed to this script
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH

# location of database
export GEMCDB_ENV=systemsTxtDB
# location of geometry database - notice we need to set it here again
startDir=`pwd`
export GEMCDB_ENV="$(pwd)/systemsTxtDB"

echo "TEST.SH: GLIBRARY is $GLIBRARY, GPLUGIN_PATH is $GPLUGIN_PATH, GEMCDB_ENV is $GEMCDB_ENV"

# sets the list of jcards to run
jcards=no
JcardsToRun

for jc in $=jcards
do
Expand Down
22 changes: 10 additions & 12 deletions ci/validateAgainstGemc2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
# git clone http://github.com/maureeungaro/clas12-systems /root/clas12-systems && cd /root/clas12-systems
# ./ci/validateAgainstGemc2.sh -s ftof

if [[ -z "${G3CLAS12_VERSION}" ]]; then
# load environment if we're on the container
# notice the extra argument to the source command
TERM=xterm # source script use tput for colors, TERM needs to be specified
FILE=/etc/profile.d/jlab.sh
test -f $FILE && source $FILE keepmine
# if we are in the docker container, we need to load the modules
if [[ -z "${DISTTAG}" ]]; then
echo "\nNot in container"
else
echo clas12-systems ci/validateAgainstGemc2: environment already defined
echo "\nIn container: ${DISTTAG}"
source /app/localSetup.sh
fi


Expand Down Expand Up @@ -152,13 +150,13 @@ function run_comparison {
}

./ci/build.sh -s $detector
if [ $? -ne 0 ]; then
echo building system $detector failed
exit 1
fi


echo
echo "Comparing gemc2 and gemc3 geometry for $detector"
echo
run_comparison

if [ $? -ne 0 ]; then
echo "Comparing gemc2 and gemc3 geometry for $detector failed"
exit 1
fi
2 changes: 1 addition & 1 deletion ec/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
# loop over all the defined builder functions
for var_key, file_name in VARIATION_MAP.items():

basepath = os.environ["GPLUGIN_PATH"]
basepath = os.environ["GEMCDB_ENV"]

_logger.info(f"Building EC configuration for variation {var_key}")
# Define GConfiguration name, factory and description. Initialize it.
Expand Down
29 changes: 26 additions & 3 deletions ec/plugin/SConstruct
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# This compiles the example(s) and the library
from init_env import init_environment
import os

# load needed environment for this library
env = init_environment('glibrary clhep geant4 ccdb')
env.Append(CXXFLAGS=['-std=c++17'])


# standard pre and suffix for gemc plugins
# standard pre and suffix for gemc plugins and path
env.Replace(SHLIBSUFFIX = ".gplugin")
env.Replace(SHLIBPREFIX = "")
plugins_dir_s = os.environ.get('GPLUGIN_PATH')
plugins_dir = os.path.realpath(plugins_dir_s)

env.Append(CXXFLAGS=['-std=c++20'])

sources = [
'readoutSpecs.cc',
Expand All @@ -17,5 +20,25 @@ sources = [
'hitDigitization.cc'
]

# space added to













plugin = env.SharedLibrary( source = sources, target = 'ecal')



# use scons install to copy the plugin to the plugin directory
# see scons user guide (scons install) for more info
env.Alias('install', plugins_dir)
env.Install(plugins_dir, plugin)
15 changes: 12 additions & 3 deletions ft/plugin/SConstruct
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# This compiles the example(s) and the library
from init_env import init_environment
import os

# load needed environment for this library
env = init_environment('glibrary clhep geant4 ccdb')
env.Append(CXXFLAGS=['-std=c++17'])


# standard pre and suffix for gemc plugins
# standard pre and suffix for gemc plugins and path
env.Replace(SHLIBSUFFIX = ".gplugin")
env.Replace(SHLIBPREFIX = "")
plugins_dir_s = os.environ.get('GPLUGIN_PATH')
plugins_dir = os.path.realpath(plugins_dir_s)

env.Append(CXXFLAGS=['-std=c++20'])

ft_cal_sources = [
'ft_cal_readoutSpecs.cc',
Expand All @@ -35,3 +38,9 @@ ft_cal_plugin = env.SharedLibrary( source = ft_cal_sources, target = 'ft_cal
ft_hodo_plugin = env.SharedLibrary( source = ft_hodo_sources, target = 'ft_hodo')
ft_mmtrk_plugin = env.SharedLibrary( source = ft_mmtrk_sources, target = 'ft_trk')

# use scons install to copy the plugin to the plugin directory
# see scons user guide (scons install) for more info
env.Alias('install', plugins_dir)
env.Install(plugins_dir, ft_cal_plugin)
env.Install(plugins_dir, ft_hodo_plugin)
env.Install(plugins_dir, ft_mmtrk_plugin)
2 changes: 1 addition & 1 deletion ftof/ftof.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
# loop over all the defined builder functions
for var_key, file_name in VARIATION_MAP.items():

basepath = os.environ["GPLUGIN_PATH"]
basepath = os.environ["GEMCDB_ENV"]

_logger.info(f"Building ftof configuration for variation {var_key}")
# Define GConfiguration name, factory and description. Initialize it.
Expand Down
Loading

0 comments on commit ac0e1fd

Please sign in to comment.