# env_setup **Repository Path**: hyin_lhcb/env_setup ## Basic Information - **Project Name**: env_setup - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-29 - **Last Updated**: 2025-12-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # env_setup The software environment setup of this project is based on the cvmfs system. You need have cvmfs setup properly, before compile and testing the codes. ## 1. Prerequisites You need have cvmfs setup properly, before compile and testing the codes. To set up cvmfs, you can follow the instructions provided at https://cvmfs.readthedocs.io/en/stable/cpt-quickstart.html. This repository only contains the necessary files to set up the environment for the project. Here, just take the example of windows + WSL2 + ubuntu + cvmfs. ### 1.1 windows + WSL2 + ubuntu + cvmfs 1. Disk space requirements: - 50GB free disk space on the Windows for cvmfs. - 10-20GB free disk space on the Ubuntu virtual machine, as the workspace. - Use `C` disk as the workspace, if possible. 2. Install WSL2, vscode and Ubuntu from the Microsoft Store. 3. Install cvmfs from the Ubuntu terminal. ```bash sudo apt update && sudo apt upgrade –y wget https://cvmrepo.s3.cern.ch/cvmrepo/apt/cvmfs-release-latest_all.deb sudo dpkg -i cvmfs-release-latest_all.deb rm -f cvmfs-release-latest_all.deb sudo apt-get -y update sudo apt-get -y install cvmfs sudo apt install g++ gfortran make libgl1-mesa-dev libncurses5-dev libncursesw5-dev libsfml-dev libcln-dev sudo apt install build-essential libglu1-mesa-dev freeglut3-dev x11 git sudo locale-gen en_US.UTF-8 ``` Below may be useful later. Will update if needed. ``` sudo apt install xdg-utils mesa-utils libgl1-mesa-dri libegl1 sudo apt install libeigen3-dev libgsl-dev ``` 4. Configure cvmfs. ```bash sudo mkdir -p /etc/cvmfs echo "CVMFS_REPOSITORIES=sft.cern.ch,sw.hsf.org" | sudo tee /etc/cvmfs/default.local echo "CVMFS_HTTP_PROXY=DIRECT" | sudo tee -a /etc/cvmfs/default.local ``` 5. Enable cvmfs. ```bash sudo cvmfs_config setup sudo cvmfs_config probe ``` 6. To avoid repeating the above steps, you can add the following lines to the `/etc/systemd/system/cvmfs-setup.service` to automatically configure CVMFS upon login. ```bash sudo vi /etc/systemd/system/cvmfs-setup.service ``` ```bash [Unit] Description=Setup and probe CVMFS After=network.target [Service] Type=oneshot ExecStart=/usr/bin/cvmfs_config setup ExecStart=/usr/bin/cvmfs_config probe RemainAfterExit=yes [Install] WantedBy=multi-user.target ``` Then, restart the related services, as ```bash sudo systemctl enable cvmfs-setup.service sudo systemctl start cvmfs-setup.service ``` ## 2. Environment setup To set up the environment, you can use the following command in the Ubuntu terminal: ```bash sudo cvmfs_config setup sudo cvmfs_config probe source /cvmfs/sw.hsf.org/key4hep/setup.sh ``` The first two commands only needed for each login, while the last command is needed for each session (shell). ### 2.1 `lhapdf` setup For some packages, the `lhapdf` is needed, such as `CT18NLO`. However, for some reason, the pdf-sets are not avaiable in cvmfs. In this case, we could download the pdf-sets in a local directory, and setup the environment. ```bash mkdir -p $HOME/.lhapdf/share/LHAPDF cd $HOME/.lhapdf/share/LHAPDF wget http://lhapdfsets.web.cern.ch/lhapdfsets/current/CT18NLO.tar.gz tar -xvzf CT18NLO.tar.gz cd - ``` ### 2.2 environment setup ```bash source setup.sh ``` ## 3. Download packages ```bash git clone https://gitlab.cern.ch/muon-proton-scattering/generators/esepp.git git clone https://gitlab.cern.ch/muon-proton-scattering/generators/djangoh_tch285.git git clone https://gitee.com/hyin_lhcb/hepgenplusplus.git ``` For `epic`: ```bash git clone https://gitee.com/hyin_lhcb/apfelxx.git git clone https://drf-gitlab.cea.fr/partons/core/elementary-utils.git git clone https://drf-gitlab.cea.fr/partons/core/numa.git git clone https://drf-gitlab.cea.fr/partons/core/partons.git git clone https://gitlab.cern.ch/muon-proton-scattering/generators/epic.git ``` ## 4. Generators ### 4.1 [`esepp`](https://gitlab.cern.ch/muon-proton-scattering/generators/esepp) [`esepp`](https://gitlab.cern.ch/muon-proton-scattering/generators/esepp) is an event generator designed to simulate elastic scattering processes between charged leptons and the protons. - used for proton charge radius measurement #### 4.1.1 To compile and run `esepp`: ```bash cd esepp make ./esepp ``` For parameters configuration, please refer to the `input_output.pdf` document in the `esepp` directory. Beginners are recommendated to use the default values initially. For more details, please refer to the [`esepp` documentation](https://gitlab.cern.ch/muon-proton-scattering/generators/esepp/-/blob/master/README.md?ref_type=heads). #### 4.1.2 Convert `esepp` output to `hepmc` format To convert the output of `esepp` to `hepmc` format, you can use the provided script: ```bash cd env_set/esepp_scripts python convert_esepp_to_hepmc3.py --beam-energy 2 --muon-charge + ``` Where `` is the output file from `esepp` and `` is the desired output file in `hepmc` format. Example: ```bash python convert_esepp_to_hepmc3.py --beam-energy 2 --muon-charge + esepp_output.dat hepmc_output.hepmc ``` #### 4.1.3 Make histogram for `esepp` To make a histogram from the `esepp` output, you can use the provided script: ```bash python make_histogram.py esepp_output.dat --beam-energy 2 ``` ### 4.2 [`DJANGOH`](https://gitlab.cern.ch/muon-proton-scattering/generators/djangoh_tch285) [`DJANGOH`](https://gitlab.cern.ch/muon-proton-scattering/generators/djangoh_tch285) is a generator for Deep-inelastic-scattering (DIS) processes. - used for DIS measurements #### 4.2.1 To compile and run `DJANGOH`: ```bash cd djangoh_tch285 cp ../../DJANGOH_scripts/makefile . make ``` ```bash cd ../../DJANGOH_scripts ../../djangoh_tch285/djangoh < testrun-mup-sample.in | tee djangoh_output.log ``` #### 4.2.2 Convert `DJANGOH` output to `hepmc` format To convert the output of `DJANGOH` to `hepmc` format, you can use the provided script: ```bash cd env_set/DJANGOH_scripts python convert_djangoh_to_hepmc3.py ``` Where `` is the output file from `DJANGOH` and `` is the desired output file in `hepmc` format. Example: ```bash python convert_djangoh_to_hepmc3.py testrun-mup-sample_evt.dat hepmc_output.hepmc ``` #### 4.2.3 Make histogram for `DJANGOH` To make a histogram from the `DJANGOH` output, you can use the provided script: ```bash python DJANGOH_analysis.py ``` ### 4.3 [`epic`](https://gitlab.cern.ch/muon-proton-scattering/generators/epic) [`epic`](https://gitlab.cern.ch/muon-proton-scattering/generators/epic) is a generator for Deep Virtual Compton Scattering (DVCS) processes. - used for DVCS measurements #### 4.3.1 To compile and run `epic`: ```bash cd apfelxx mkdir build && cd build cmake .. make sudo make install cd ../../elementary-utils/build cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release make sudo make install cd ../../numa/build/ cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release make sudo make install cd ../../partons/build/ cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release make sudo make install cd ../../epic/ cp ../../env_setup/epic_scripts/epic_cmake.patch . patch -p1 < epic_cmake.patch cd build/ cmake .. make -j3 cd .. ``` To run `epic`, must be in the `epic` directory: ```bash ./bin/epic --seed=12345 --scenario=../env_setup/epic_scripts/example_scenario_DVCS_mup.xml | tee epic_output.log ``` #### 4.3.2 Convert `epic` output to `hepmc` format The default output format of `epic` is `hepmc3`, no need to convert. #### 4.3.3 Make histogram for `epic` To make a histogram from the `epic` output, you can use the provided script: ```bash python epic_analysis.py ``` ### 4.4 [`HEPGen++`](https://gitlab.cern.ch/muon-proton-scattering/generators/hepgenerator) [`HEPGen++`](https://gitlab.cern.ch/muon-proton-scattering/generators/hepgenerator) is a generator for DVCS in muon-proton processes. - used for DVCS measurements #### 4.4.1 To compile and run `HEPGen++`: ```bash cd hepgenplusplus mkdir build install && cd build cmake ../ -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Release -DCHEPGEN_ENABLE_PYTHON=YES make make install ``` ```bash cd ../../env_setup/HEPGenPlusPlus_scripts source setup.sh ../../hepgenplusplus/install/bin/HEPGen++ hepgen_dvcs.data 12313 ``` #### 4.4.2 Convert `HEPGen++` output to `hepmc` format To convert the output of `HEPGen++` to `hepmc` format, you can use the provided script: ```bash python convert_hepgen_to_hepmc3.py ``` Where `` is the output file from `HEPGen++` and `` is the desired output file in `hepmc` format. Example: ```bash python convert_hepgen_to_hepmc3.py hepgen_dvcs_100_events_bin_output.csv --output test.hepmc3 ``` #### 4.4.3 Make histogram for `HEPGen++` To make a histogram from the `HEPGen++` output, you can use the provided script: ```bash python hepgen_analysis.py ``` ### 4.5 [`calcHEP`](https://theory.sinp.msu.ru/~pukhov/CALCHEP/calchep_3.9.2.tgz) See [README.md](calchep_scripts/README.md) in [calchep_scripts](calchep_scripts/).