#Basic commnad to run epic
./bin/epic --seed=0 --scenario=example.xml
#Basic command to run the container
singularity exec --writable --containall --bind ./test/:/work/workspace/epic/test/ epic_partons ./../../work/workspace/epic/test/run.sh

BEFORE START ANY STEP, MAKE SURE YOU ARE ON THE /work/workspace/ directory

1. Singularity container. You can modify the .def file so all software that I install manually with "apt-get install", is done automatically.
	sudo singularity build --sandbox epic_partons epic_partons.def
	sudo singularity shell --writable --containall epic_partons

	mkdir /work
	mkdir /work/workspace

	apt-get install language-pack-en-base
	locale
	export LANG=en_US.UTF-8
	export LC_CTYPE=en_US.UTF-8
	export LC_NUMERIC=en_US.UTF-8
	export LC_TIME=en_US.UTF-8	
	export LC_COLLATE=en_US.UTF-8
	export LC_MONETARY=en_US.UTF-8
	export LC_MESSAGES=en_US.UTF-8
	export LC_PAPER=en_US.UTF-8
	export LC_NAME=en_US.UTF-8
	export LC_ADDRESS=en_US.UTF-8
	export LC_TELEPHONE=en_US.UTF-8
	export LC_MEASUREMENT=en_US.UTF-8
	export LC_IDENTIFICATION=en_US.UTF-8

	chmod -R 777 /	
	apt-get update


1. Apfel++
	git clone https://github.com/vbertone/apfelxx.git
	cd apfelxx
	mkdir build && cd build
	apt-get install gfortran
	cmake ..
	make && make install
2. LHAPDF 6.5.4
	apt-get install wget 
	wget https://lhapdf.hepforge.org/downloads/?f=LHAPDF-6.5.4.tar.gz -O LHAPDF-6.X.Y.tar.gz
	tar -xf LHAPDF-6.X.Y.tar.gz
	cd LHAPDF-6.5.4
	./configure --disable-python
	make
	make install		
	
3. ROOT: 
	apt-get install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev libssl-dev
	apt-get install gfortran libpcre3-dev \
	xlibmesa-glu-dev libglew-dev libftgl-dev \
	libmysqlclient-dev libfftw3-dev libcfitsio-dev \
	graphviz-dev libavahi-compat-libdnssd-dev \
	libldap2-dev libxml2-dev libkrb5-dev \
	libgsl0-dev qtwebengine5-dev
	
	
	wget https://root.cern/download/root_v6.26.10.Linux-centos8-x86_64-gcc8.5.tar.gz
	singularity shell --writable partons_singularity
	tar -xzvf root_v6.26.10.Linux-centos8-x86_64-gcc8.5.tar.gz
	source root/bin/thisroot.sh

	apt-get install libxft2	

4. CMake: 
	Download from https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz
	singularity shell --writable partons_singularity
	extract the tar.gz file
	cd cmake-3.26.3
	./bootstrap -- -DCMAKE_USE_OPENSSL=OFF
	make
	make install
		
5. QT5(optional): 
	wget https://download.qt.io/new_archive/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
	mkdir Qt5.7.0/
	chmod +x qt-opensource-linux-x64-5.7.0.run 
	./qt-opensource-linux-x64-5.7.0.run
	Follow the installation manually

6. PARTONS: /work/workspace/
	GIT_SSL_NO_VERIFY=true git clone https://drf-gitlab.cea.fr/partons/core/elementary-utils.git --branch release-v3 --depth 1
	GIT_SSL_NO_VERIFY=true git clone https://drf-gitlab.cea.fr/partons/core/numa.git --branch release-v3 --depth 1
	git clone -b ddvcs https://drf-gitlab.cea.fr/partons/core/partons
	git clone -b ddvcs https://drf-gitlab.cea.fr/partons/core/partons-example

	cd elementary-utils/build
	cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Debug
	make
	make install
	cd ../../numa/build
	cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Debug
	make
	make install
	cd ../../partons/build
	cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Debug
	make
	make install
	cd ../../partons-example/build
	cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Debug
	make
				
7. Install HepMC3: 
	#if you dont install it using ROOTIO it epic wont work
	git clone https://gitlab.cern.ch/hepmc/HepMC3.git
	mkdir hepmc3-build
	cd hepmc3-build
	cmake -DHEPMC3_ENABLE_ROOTIO=ON -DROOT_DIR=/work/workspace/root/ -DCMAKE_INSTALL_PREFIX=../hepmc3-install ../HepMC3
	export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/workspace/root/lib/
	make -j1 install

8. Boost
	wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz
	tar -xf boost_1_81_0.tar.gz
	cd boost_1_81_0
	./bootstrap.sh 
	./b2 install --prefix=/usr/local/
	export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/workspace/boost_1_81_0/stage/lib

	
9. Install EPIC: /work/workspace/
	wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
	dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb

	git clone -b 13-implementation-of-ddvcs https://github.com/pawelsznajder/epic/
	apt-get install nano
	change the following line in epic/CMakeLists.txt:
		set(CMAKE_CXX_STANDARD 11) to set(CMAKE_CXX_STANDARD 14)
	
	cd epic/build/
	cmake -DCMAKE_PREFIX_PATH="/root/workspace/hepmc3-install/share/HepMC3/cmake;/root/workspace/Qt5.7.0/5.7/gcc_64/lib/cmake/Qt5;/root/workspace/Qt5.7.0/5.7/gcc_64/lib/cmake/Qt5Widgets" ..
	
	#if you failed the QT5 installation do
	cmake -DCMAKE_PREFIX_PATH="/work/workspace/hepmc3-install/share/HepMC3/cmake" ..

	make
	
10. Final steps
	chmod -R 777 /work/
	touch /etc/localtime

