---
# System prepended metadata

title: Setup guidance

---

# Setup guidance

First make a `<work_dir>`. And cd into it.

## singularity

```bash
cd <work_dir>
singularity pull pioneer_april2023.sif docker://jlabounty/pioneer:april2023
```
The above cmd may fail due to not enough disk space [[ref](/ryB9RU-lh)].
Pioneer Docker Hub: https://hub.docker.com/r/jlabounty/pioneer/tags

Get some utility scripts [[ref](https://github.com/HaiwangYu/pioneer-utilities/tree/master/container)].

```bash
cd <work_dir>
wget https://raw.githubusercontent.com/HaiwangYu/pioneer-utilities/master/container/login.rc
wget https://raw.githubusercontent.com/HaiwangYu/pioneer-utilities/master/container/run_singularity.sh
```

Run singularity container. All following sections are performed inside the container.
```bash
cd <work_dir>
./run_singularity.sh
```
## Inside the container
### checkout pioneer/main

```bash
cd /pioneer
git clone git@github.com:PIONEER-Experiment/main.git
cd main
git checkout -b yuhw_ress remotes/origin/yuhw_ress
git submodule init
git submodule update
```

Need to use right branches for sub-repos
```
./checkout-branches.sh
```


<!-- ### setup wire-cell-ress
Ref: https://github.com/BNLIF/wire-cell-ress/tree/pioneer -->

### setup eigen if not available

In the [PIONEER april2023 container](https://hub.docker.com/layers/jlabounty/pioneer/april2023/images/sha256-b76552aed81dbb10308136e7d3aa4b66912ca868146e9637e13fb4cb2a636c31?context=explore), Eigen was already installed at `/software/eigen`. If use outside the container or one wants to use a different installation, an example setup is given below. **Note, `Eigen` is used as a header only library in `ress`, so  'installation' here only means setup some directory structures.**

```bash
mkdir -p /pioneer/opt/
cd /pioneer/opt/
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2
tar -xf eigen-3.4.0.tar.bz2
mkdir eigen
cd eigen
ln -s /pioneer/opt/eigen-3.4.0 ./include
export EIGEN_DIR=/pioneer/opt/eigen # if you want ress to use this one
```

<!-- setup wire-cell-ress
```bash
cd /pioneer
git clone https://github.com/BNLIF/wire-cell-ress.git
cd wire-cell-ress
git checkout -b pioneer remotes/origin/pioneer
./wcb configure --prefix=$PIONEERSYS/install/ --with-eigen=$EIGEN_DIR/
./wcb -p build install
``` -->

<!-- add some env var, these are also in the `login.rc` for now
```
export EIGEN_DIR=/pioneer/opt/eigen
``` -->

### build and set env

gen `setenv.sh` for the future, can be skipped if already done
```bash
cd /pioneer/main
./setup.sh -e
```

build `shared` and `MonteCarlo`
```bash
cd /pioneer/main
./setup.sh -b
```
build `DetResponse`
```bash
cd /pioneer/main
./setup.sh -bd

```
build `Reco` (**note: this will build `ress` as a prerequisite**)
```bash
cd /pioneer/main
./setup.sh -bo

```

**note, this multi-step building is just for now**


Set env, this is in `login.rc` for now
```bash
source setenv.sh
```

### run example
Ref: https://github.com/HaiwangYu/pioneer-example

```bash
cd /pioneer
git clone https://github.com/HaiwangYu/pioneer-example.git
cd pioneer-example
```

plot gdml

```bash
root -l check_gdml.C
```

simulation

```bash
g4pienux test_sim.mac
```

detector response

**The file generated above seems to break the DER. Use the pre-generated sim.root for now.**
```bash
run Gaudi test_der.cfg
```

check DER
```bash
root -l check_der.C
```


REC
```bash
run Gaudi test_rec.cfg
```


