Skip to content

Repository files navigation

STAR Environment Tutorial Github Codespace

For successfull running on Github Codespaces one can submit an application for Free Github Education benefits.

This is an example analysis of StPicoDst:

  • St stands for STAR, all classes start from it
  • Pico means the tree data format where only small number of numerous qualities are saved, exist also Micro and Mini,
  • Dst means Data Summary Table)

It is based on Grigory's presentation on PicoDst 2019

Learning Goals

  1. Understand what StRoot is and why STAR code is placed there.
  2. Understand what cons command does and what .sl7X_gccXX means.
  3. Build and run one STAR maker.
  4. Produce one user tree (MyTreeEvent + MyTrack) and read it.

Essential Project Layout

StRoot/StPicoDstAnalysisMaker/      # user STAR package compiled by cons
MyTreeEvent.h / MyTrack.h           # custom classes stored in output TTree
macros/runPicoDstAnalysisMaker.C    # run maker
macros/readMyTreeEvent.C            # read TTree with custom classes (no STAR)

Core Concepts

What is StRoot?

StRoot is the STAR source tree location where analysis packages are expected.

Why do we need StRoot in this project?

cons discovers and builds STAR packages from StRoot/<PackageName>.
If code is outside this structure, your package library is usually not built in the standard STAR way.

What is cons?

cons is STAR's build command (similar role to make): it compiles C++ code and creates shared libraries used by ROOT macros.

What happens during cons?

  1. STAR platform/compiler setup is read.
  2. Build directory .sl7X_gccXX is created or updated.
  3. Code under StRoot/ is compiled.
  4. Shared libraries are written to .sl7X_gccXX/LIB.

What is .sl7X_gccXX?

A STAR build-output directory name:

  • sl7X: Scientific Linux 7 compatible build target.
  • gccXX: compiler tag.

Example: .sl79_gcc485 means SL7.9 target with GCC 4.8.5 toolchain.

What is gcc485 (gcc4.8.5)?

gcc485 is shorthand for GNU C++ compiler version 4.8.5.
STAR uses fixed toolchains for binary compatibility across libraries.

Minimal Workflow

Run from project root:

star-shell #load into star container
cons 
root -l -b -q 'macros/runPicoDstAnalysisMaker.C("st_physics_20069002_raw_1500008.picoDst.root","output_tree.root")'
root -l -b -q macros/readMyTreeEvent.C++

The second part is how to handle the batch scheduler SUMS

For that, on SDCC Alma9 starub node one can run

./submit.sh

for sending an example of 2 jobs to HTCondor system.

Remark: Running on your own laptop

In case you want to enter and run STAR container on your own laptop:

sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer
  • And then run commands:
git clone https://github.com/aprozo/star-tutorial.git
cd star-tutorial
apptainer run docker://ghcr.io/star-bnl/star-sw:main-root5-gcc485 bash -l

Important!

Do not forget to comment in your ~/.bashrc sourcing your local Root installation (source /path/thisroot.sh), otherwise there will be a conflict of 2 ROOT versions: one - from your local installation, another - from STAR container.

  • You may also create a shortcut for star-shell using code below:
mkdir -p ~/.local/bin && cat >~/.local/bin/star-shell <<'EOF'
#!/usr/bin/env bash
apptainer run  docker://ghcr.io/star-bnl/star-sw:main-root5-gcc485 "$@"
EOF
chmod +x ~/.local/bin/star-shell
grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' ~/.bashrc || echo 'export PATH="$HOME/.local/bin:$PATH"' >>~/.bashrc
export PATH="$HOME/.local/bin:$PATH"

MacOS

Install Docker Desktop

brew install --cask docker-desktop

Then start Docker Desktop once (so the Docker daemon is running), and enter the STAR container with your current folder available inside the container:

docker run --rm -it \
  --platform linux/amd64 \
  -v "$PWD":/work -w /work \
  ghcr.io/star-bnl/star-sw:main-root5-gcc485 \
  bash -l

This is the Docker equivalent of your Linux star-shell. It mounts the current directory into /work and drops you into bash -l unless you pass your own command.

mkdir -p ~/.local/bin && cat >~/.local/bin/star-shell <<'EOF'
#!/usr/bin/env bash
IMAGE="ghcr.io/star-bnl/star-sw:main-root5-gcc485"

# If no args provided -> interactive login shell
if [ $# -eq 0 ]; then
  set -- bash -l
fi

docker run -it --rm \
  --platform linux/amd64 \
  -v "$PWD":/work -w /work \
  "$IMAGE" "$@"
EOF

chmod +x ~/.local/bin/star-shell

# Add ~/.local/bin to PATH for zsh (default on macOS)
grep -qxF 'export PATH="$HOME/.local/bin:$PATH"' ~/.zshrc || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"

Now you can do:

star-shell

Some presentation on DST tutorials:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors