Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding docker part and isolated muon example #68

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
FROM rootproject/root:6.24.00-conda

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get update && apt-get -y install cmake vim git

ENV HOME /home/ilc
WORKDIR ${HOME}

RUN conda create -n root_env root -c conda-forge

SHELL ["conda", "run", "-n", "root_env", "/bin/bash", "-c"]


RUN git clone https://github.com/iLCSoft/LCIO.git \
&& cd LCIO \
&& git checkout v02-16-01 \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_ROOTDICT=ON -D CMAKE_CXX_STANDARD=17 .. \
&& make -j 8 install && cd .. ; rm -rf ./build


WORKDIR ${HOME}

## Delphes installation from local (unfortunate) due to TF1.h error in ROOT 6.22
## details : https://cp3.irmp.ucl.ac.be/projects/delphes/ticket/1449
EnginEren marked this conversation as resolved.
Show resolved Hide resolved

RUN wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.5.0.tar.gz \
EnginEren marked this conversation as resolved.
Show resolved Hide resolved
&& tar -zxf Delphes-3.5.0.tar.gz \
&& cd Delphes-3.5.0 \
&& make

#COPY Delphes-3.4.2 ${HOME}/Delphes-3.4.2
#RUN cd ${HOME}/Delphes-3.4.2 \
# && make

ENV DELPHES_DIR /home/ilc/Delphes-3.5.0
ENV LCIO /home/ilc/LCIO

COPY requirements.txt requirements.txt
RUN pip install --upgrade pip \
&& pip install --upgrade --no-cache-dir -r requirements.txt \
&& rm requirements.txt


SHELL ["conda", "run", "-n", "root_env", "/bin/bash", "-c"]

### PODIO
RUN git clone https://github.com/AIDASoft/podio.git \
&& cd podio && source ./init.sh && source ./env.sh && mkdir build && mkdir install \
&& cd build && cmake -DCMAKE_INSTALL_PREFIX=../install -DBUILD_TESTING=OFF .. \
&& make -j 4 install && cd .. ; rm -rf ./build

### EDM4HEP


WORKDIR ${HOME}

SHELL ["conda", "run", "-n", "root_env", "/bin/bash", "-c"]

RUN git clone https://github.com/key4hep/EDM4hep; cd EDM4hep; mkdir build; mkdir install; cd build \
&& podio_DIR=/home/ilc/podio/install cmake -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../install .. \
&& make -j 4 install && cd .. ; rm -rf ./build

### k4SIM
WORKDIR ${HOME}
SHELL ["conda", "run", "-n", "root_env", "/bin/bash", "-c"]

RUN git clone https://github.com/key4hep/k4SimDelphes.git; cd k4SimDelphes; mkdir build; cd build \
&& podio_DIR=/home/ilc/podio/install EDM4HEP_DIR=/home/ilc/EDM4hep/install cmake \
-DBUILD_TESTING=OFF -DBUILD_PYTHIA_READER=OFF \
-DBUILD_EVTGEN_READER=OFF -DBUILD_HEPMC_READER=OFF -DBUILD_FRAMEWORK=OFF -DCMAKE_INSTALL_PREFIX=../install .. \
&& make -j 4 install && cd .. ; rm -rf ./build


COPY init_env.sh ${HOME}







EnginEren marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 21 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Docker Image for k4SimDelphes

This image contains:

1. ROOT (6.24/06)
2. LCIO (v02-16-01)
3. Delphes (3.5.0)
4. Podio
5. EDM4HEP
6. k4SimDelphes
EnginEren marked this conversation as resolved.
Show resolved Hide resolved


if you want to build the image yourself,
```bash
docker build .
```

Otherwise, the image is here:
```bash
docker pull ilcsoft/k4simdelphes:latest
```
10 changes: 10 additions & 0 deletions docker/init_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
export DELPHES_DIR=/home/ilc/Delphes-3.5.0
export LCIO=/home/ilc/LCIO
export PODIO=/home/ilc/podio/install
export EDM4HEP=/home/ilc/EDM4hep/install
export K4SIM=/home/ilc/k4SimDelphes/install
export LD_LIBRARY_PATH=:/home/ilc/LCIO/lib:/home/ilc/Delphes-3.5.0:$PODIO/lib:$EDM4HEP/lib:$K4SIM/lib
export PATH=/opt/conda/envs/root_env/bin:/opt/conda/condabin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/ilc/delphes2lcio/build/:$K4SIM/bin/
export PYTHONPATH=/home/ilc/LCIO/src/python:/home/ilc/podio/install/python
cd /home/ilc/LCIO; source setup.sh; cd ..
12 changes: 12 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
scikit-learn
uproot
matplotlib
pandas
notebook
metakernel
awkward
mplhep
scipy
h5py
pyyaml
jinja2
91 changes: 91 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,94 @@ After this the files `histograms_delphes.root` and `histograms_edm4hep.root`
should be present and filled with some histograms that can be compared. The
differences in the Jet energy and momentum are caused by a potential double
counting of tracks and towers (see [known issues](../README.md#known-issues)).


# Another example: Invariant Mass of Isolated Muons in ILD

First of all, we need to download a `stdhep` file [`here`](https://syncandshare.desy.de/index.php/s/Kx7ygmgejpmnSwE) and put it into `data` folder.

Now, we are ready to launch our container;

```console
engin@local:$ pwd
~/k4SimDelphes/examples
```
```bash
docker run -it -p 8888:8888 -v $PWD:/home/ilc/wdir ilcsoft/k4simdelphes:latest bash
## you're inside the container now
conda init bash
```


```console
no change /opt/conda/condabin/conda
...
...
no change /opt/conda/etc/profile.d/conda.csh
modified /home/ilc/.bashrc
...
```
```bash
source .bashrc
conda activate root_env
source init_env.sh
```
Ready to generate output file
```bash
DelphesSTDHEP_EDM4HEP $DELPHES_DIR/cards/delphes_card_ILD.tcl \
./edm4hep_output_config.tcl \
edm4hep_output.root \
./data/E250-TDR_ws.P4f_zzorww_l.Gwhizard-1_95.eL.pR.I106721.003.stdhep

```
```console
...
** Reading ./data/E250-TDR_ws.P4f_zzorww_l.Gwhizard-1_95.eL.pR.I106721.003.stdhep
...
** 179910 events processed
** Exiting ...

```

Now we have output root file.. Let us open jupyter-notebook from our container:
```console
(root_env) root@a19e37608dbf::~/wdir# jupyter notebook --port=8888 --ip=0.0.0.0 --allow-root
...
To access the notebook, open this file in a browser:
file:///home/ilc/.local/share/jupyter/runtime/nbserver-2220-open.html
Or copy and paste one of these URLs:
http://c5a7dd737b14:8888/?token=daaea35f4d34fcc7206035d94a677474f6294d1ba95b886e
or http://127.0.0.1:8888/?token=daaea35f4d34fcc7206035d94a677474f6294d1ba95b886e
...
```

Copy paste `http://127.0.0.1:8888/?token` to your browser. You may have a look at the notebook `edm4hep_IsoM.ipynb`


## Working Group Servers with Singularity via cvmfs

The docker image for this example was also deployed to `unpacked.cern.ch`, where images are unpacked. Then, it is easy for singularity to use this images via cvmfs.

As usual; pull the repo, place the data folder, go to example folder
```console
-bash-4.2$ pwd
/your-working-directory/k4SimDelphes/examples
```

Now ready to go inside the container
```bash
singularity shell -H $PWD --bind $(pwd):/home/ilc/data /cvmfs/unpacked.cern.ch/registry.hub.docker.com/ilcsoft/k4simdelphes:latest bash
conda init bash
source .bashrc
conda activate root_env
source /home/ilc/init_env.sh
cd $home
```
After this stage, commands are the same. Just watch out: You might need to tunnel working groups server's network (i.e cern.ch)







EnginEren marked this conversation as resolved.
Show resolved Hide resolved
Loading