Skip to content

Commit

Permalink
Merge branch 'Application' into Application
Browse files Browse the repository at this point in the history
  • Loading branch information
marc1uk authored Feb 16, 2024
2 parents 9411ae1 + 426b7cb commit 3424918
Show file tree
Hide file tree
Showing 187 changed files with 12,663 additions and 1,156 deletions.
75 changes: 64 additions & 11 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,68 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag anniesoft/toolanalysis:latest

- name: docker login
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v2

- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du / -hx -d 4 --threshold=1G | sort -hr | head
- name: Free disk space
run: |
# https://github.com/actions/virtual-environments/issues/2840
# https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm /usr/local/share/boost || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY";
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk google-cloud-cli imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge google-chrome-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^temurin' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
docker rmi $(docker image ls -aq) || true
sudo swapoff /swapfile || true
sudo rm -rf /swapfile
sudo apt-get autoremove -y >/dev/null 2>&1 || true
sudo apt-get autoclean -y >/dev/null 2>&1 || true
- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du / -hx -d 4 --threshold=1G | sort -hr | head
- name: Build the Docker image
run: docker build . --file Dockerfile --tag anniesoft/toolanalysis:latest

- name: docker login
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: push docker images
run: docker push anniesoft/toolanalysis:latest
- name: push docker images
run: docker push anniesoft/toolanalysis:latest

- name: cleanup2
run:
docker rmi $(docker image ls -aq) || true;
103 changes: 95 additions & 8 deletions .github/workflows/tempbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,99 @@ jobs:

build_1:
runs-on: ubuntu-latest
container: 'anniesoft/toolanalysis:latest'
#container: 'anniesoft/toolanalysis:latest'
steps:
- uses: actions/checkout@v2
- name: prerequisits
run: yum install -y git make gcc-c++ which wget
- name: build
run: echo `pwd` && ln -s /ToolAnalysis/ToolDAQ $PWD/ToolDAQ && ls -l && ls -l ./ToolDAQ && source ./Setup.sh && make clean && make
- name: test
run : source ./Setup.sh && ./Analyse
- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du / -hx -d 4 --threshold=1G | sort -hr | head
- name: Free disk space
run: |
# https://github.com/actions/virtual-environments/issues/2840
# https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm /usr/local/share/boost || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY";
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk google-cloud-cli imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge google-chrome-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^temurin' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
#docker rmi $(docker image ls -aq) || true
sudo swapoff /swapfile || true
sudo rm -rf /swapfile
sudo apt-get autoremove -y >/dev/null 2>&1 || true
sudo apt-get autoclean -y >/dev/null 2>&1 || true
- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du / -hx -d 4 --threshold=1G | sort -hr | head
- name: checkout
uses: actions/checkout@v2

##################

#- name: prerequisites
# run: yum install -y git make gcc-c++ which wget

#- name: build
# run:
# echo `pwd` && ln -s /ToolAnalysis/ToolDAQ $PWD/ToolDAQ && ls -l && ls -l ./ToolDAQ && source ./Setup.sh && make clean && make

##################

#- name: test
# run : source ./Setup.sh && ./Analyse

#- name: build and test
# uses: docker://anniesoft/toolanalysis:latest
# with:
# entrypoint: /bin/bash
# args: -c "echo `pwd` && ln -s /ToolAnalysis/ToolDAQ $PWD/ToolDAQ && ls -l && ls -l ./ToolDAQ && source ./Setup.sh && make clean && make && ./Analyse"

##################

- name: build and test
uses: addnab/docker-run-action@v3
with:
image: anniesoft/toolanalysis:latest
registry: docker.io
options: -v ${{ github.workspace }}:/TA
run: |
echo "Running Script"
echo `pwd`
ls -l
cd /TA
ls -l
ln -s /ToolAnalysis/ToolDAQ $PWD/ToolDAQ
ls -l ./ToolDAQ
source ./Setup.sh
make clean
make
./Analyse

11 changes: 7 additions & 4 deletions DataModel/BeamDataPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@ struct BeamDataPoint : public SerialisableObject {

friend class boost::serialization::access;

BeamDataPoint() : value(0.), unit("") {}
BeamDataPoint(double Value, const std::string& Unit)
: value(Value), unit(Unit) {}
BeamDataPoint() : value(0.), unit(""), time(0) {}
BeamDataPoint(double Value, const std::string& Unit, uint64_t time=0)
: value(Value), unit(Unit), time(0) {}
double value;
std::string unit;
uint64_t time;

template<class Archive> void serialize(Archive & ar,
const unsigned int version)
{
ar & value;
ar & unit;
ar & time;
}

virtual bool Print() override {
std::cout << "Value : " << value << '\n';
std::cout << "Unit : " << unit << '\n';
std::cout << "Unit : " << unit << '\n';
std::cout << "Time : " << time << '\n';
return true;
}

Expand Down
10 changes: 10 additions & 0 deletions DataModel/Direction.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ class Direction : public SerialisableObject{

return true;
}

inline Direction Unit(){
double thismag = Mag();
Direction unitvec(x/thismag,y/thismag,z/thismag);
return unitvec;
}

inline double Mag2() const { return x*x + y*y + z*z; }

inline double Mag() const { return sqrt(Mag2()); }

private:
double x; // meters
Expand Down
56 changes: 38 additions & 18 deletions DataModel/GenieInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class GenieInfo {
int probepdg=-1;
std::string probepartname="";
//FourVector* probemomentum=0; // GeV/c?
Position probethreemomentum=Position(0.,0.,0.); // GeV/c?
Position probemomentumdir=Position(0.,0.,0.); // unit vector
Direction probethreemomentum=Direction(0.,0.,0.); // GeV/c?
Direction probemomentumdir=Direction(0.,0.,0.); // unit vector
double probeanglex=0.; // rads
double probeangley=0.; // rads
double probeangle=0.; // rads
Expand All @@ -57,7 +57,7 @@ class GenieInfo {
//genie::GHepParticle* targetnucleon=0;
int targetnucleonpdg=-1;
std::string targetnucleonname=""; // pdg if name not known
Position targetnucleonthreemomentum=Position(0.,0.,0.); // GeV/c? only defined if there is a target nucleon: not true for all events
Direction targetnucleonthreemomentum=Direction(0.,0.,0.); // GeV/c? only defined if there is a target nucleon: not true for all events
double targetnucleonenergy=0.; // GeV. only defined if there is a target nucleon

// target nucleus:
Expand All @@ -74,15 +74,25 @@ class GenieInfo {
// final state lepton:
std::string fsleptonname=""; // "n/a" if not defined
double fsleptonenergy=0.; // GeV. -1 if not defined
int fsleptonpdg=-1; // -1 if not defined
double fsleptonm=0; // -1 if not defined
Direction fsleptonmomentum=Direction(0.,0.,0.); // GeV/c. 0 if not defined
Direction fsleptonmomentumdir=Direction(0.,0.,0.); // unit vector. 0 if not defined
Position fsleptonvtx=Position(0.,0.,0.); // cm. 0 if not defined
double fsleptont=0.; // ns. -1 if not deined

// other remnants: TODO: this information is NOT being correctly read in
int numfsprotons=-1;
int numfsneutrons=-1;
int numfspi0=-1;
int numfspiplus=-1;
int numfspiminus=-1;
int numfskplus=-1;
int numfskminus=-1;
// other remnants: TODO: this information is NOT being correctly read in
int numfsprotons=-1;
int numfsneutrons=-1;
int numfspi0=-1;
int numfspiplus=-1;
int numfspipluscher=-1;
int numfspiminus=-1;
int numfspiminuscher=-1;
int numfskplus=-1;
int numfskpluscher=-1;
int numfskminus=-1;
int numfskminuscher=-1;

// kinematic information
//FourVector* k1=0; // GeV/c? Neutrino incoming momentum vector
Expand Down Expand Up @@ -130,13 +140,23 @@ class GenieInfo {
ar & remnantnucleusenergy;
ar & fsleptonname;
ar & fsleptonenergy;
ar & numfsprotons;
ar & numfsneutrons;
ar & numfspi0;
ar & numfspiplus;
ar & numfspiminus;
ar & numfskplus;
ar & numfskminus;
ar & fsleptonpdg;
ar & fsleptonm;
ar & fsleptonmomentum;
ar & fsleptonmomentumdir;
ar & fsleptonvtx;
ar & fsleptont;
ar & numfsprotons;
ar & numfsneutrons;
ar & numfspi0;
ar & numfspiplus;
ar & numfspipluscher;
ar & numfspiminus;
ar & numfspiminuscher;
ar & numfskplus;
ar & numfskpluscher;
ar & numfskminus;
ar & numfskminuscher;
ar & q;
ar & costhfsl;
ar & fslangle;
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM anniesoft/toolanalysis:base
### Run the following commands as super user (root):
USER root

Run cd ToolAnalysis; bash -c "source Setup.sh; make update; make;"
Run cd ToolAnalysis; bash -c "source Setup.sh && git checkout -- . && make update && make"

### Open terminal
CMD ["/bin/bash"]
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ToolDAQPath=${PWD}/ToolDAQ

CPPFLAGS= -Wno-reorder -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable -Werror=return-type -Wl,--no-as-needed
GIT_VERSION := "$(shell git describe --dirty --always)"

CPPFLAGS= -DVERSION=\"$(GIT_VERSION)\" -Wno-reorder -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable -Werror=return-type -Wl,--no-as-needed

CC=g++ -std=c++1y -g -fPIC -shared $(CPPFLAGS)
CCC= g++ -std=c++1y -g -fPIC $(CPPFLAGS)
Expand Down
Loading

0 comments on commit 3424918

Please sign in to comment.