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

refactor: updates for new PDU geometry #83

Merged
merged 17 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
136 changes: 119 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ jobs:
echo "[CI] RUN SIMULATION:"
simulate.py ${{matrix.options}} -m ${{matrix.momentum}} -p ${{matrix.particle}}
# echo "[CI] EVENT DISPLAY SINGLES:"
# event_display d s out/sim.edm4hep.root 0 0
# event_display d s out/sim.edm4hep.root n 0 0
# mv out/ev out/ev.singles
echo "[CI] EVENT DISPLAY INTEGRATED:"
event_display d s out/sim.edm4hep.root
event_display d s out/sim.edm4hep.root n
mv out/ev out/ev.all_events
echo "[CI] DRAW HITS:"
draw_hits d
Expand Down Expand Up @@ -237,9 +237,70 @@ jobs:
retention-days: 1
path: geo*/

irt_auxfiles:
needs:
- build_3
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- { det: d, detector: DRICH }
- { det: p, detector: PFRICH }
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build_3
- name: untar_artifacts
run: |
tar xvf build.tar
rm -v build.tar
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: eic/run-cvmfs-osg-eic-shell@main
with:
platform-release: "jug_xl:nightly"
setup: environ.sh
run: |
scripts/configure_CI.sh none
echo "[CI] CREATE IRT AUXFILE:"
create_irt_auxfile ${{matrix.det}} geo/${{matrix.detector}}_irt_auxfile.root
- uses: actions/upload-artifact@v3
with:
name: geometry
retention-days: 1
path: geo*/

sensor_table:
needs:
- build_3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build_3
- name: untar_artifacts
run: |
tar xvf build.tar
rm -v build.tar
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: eic/run-cvmfs-osg-eic-shell@main
with:
platform-release: "jug_xl:nightly"
setup: environ.sh
run: |
scripts/configure_CI.sh none
echo "[CI] MAKE SENSOR TABLE:"
scripts/make_sensor_table.sh
- uses: actions/upload-artifact@v3
with:
name: geometry
retention-days: 1
path: geo/sensor_table.*

# EVENT VISUALIZATION -------------------------------------------------------------

###
### FIXME: not sure how to make these work on CI runners
### - locally:
### run `xvfb-run eic-shell` (to suppress graphics)
Expand Down Expand Up @@ -316,19 +377,12 @@ jobs:
# retention-days: 1
# path: out.*/

# GENERATE IRT AUXFILES -----------------------------------------------------------
# - to test it is still possbile
# MISCELLANEOUS TESTS -------------------------------------------------------------

irt_auxfiles:
test_pixel_gaps:
needs:
- build_3
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- { det: d, detector: DRICH }
- { det: p, detector: PFRICH }
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
Expand All @@ -345,13 +399,57 @@ jobs:
setup: environ.sh
run: |
scripts/configure_CI.sh none
echo "[CI] CREATE IRT AUXFILE:"
create_irt_auxfile ${{matrix.det}} geo/${{matrix.detector}}_irt_auxfile.root
echo "[CI] RUN SIMULATION:"
simulate.py -s -t4 -n500
echo "[CI] RUN RECONSTRUCTION:"
recon.rb -c config/recon_digi_only.yaml
echo "[CI] DRAW PIXEL HITS:"
test_pixel_gap_cuts n
- name: tree_artifacts
run: tree out
- name: rename_artifacts
run: mv -v out tests
- uses: actions/upload-artifact@v3
with:
name: irt_auxfiles
name: tests
retention-days: 1
path: geo*/
path: tests*/

test_track_propagation:
needs:
- build_3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build_3
- name: untar_artifacts
run: |
tar xvf build.tar
rm -v build.tar
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: eic/run-cvmfs-osg-eic-shell@main
with:
platform-release: "jug_xl:nightly"
setup: environ.sh
run: |
scripts/configure_CI.sh none
echo "[CI] RUN SIMULATION:"
simulate.py -t4 -k10 -n1
echo "[CI] RUN RECONSTRUCTION:"
recon.rb
echo "[CI] DRAW PIXEL HITS:"
root -b -q scripts/test_tracks.C
- name: tree_artifacts
run: tree out
- name: rename_artifacts
run: mv -v out tests
- uses: actions/upload-artifact@v3
with:
name: tests
retention-days: 1
path: tests*/

# ARTIFACT COLLECTION -------------------------------------------------------------

Expand All @@ -363,6 +461,9 @@ jobs:
# - visual
# - optics
- irt_auxfiles
- sensor_table
- test_pixel_gaps
- test_track_propagation
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand All @@ -382,7 +483,7 @@ jobs:
# name: optics
- uses: actions/download-artifact@v3
with:
name: irt_auxfiles
name: tests
- name: cull
run: |
find -name .keep | xargs rm -v
Expand All @@ -393,3 +494,4 @@ jobs:
path: |
pipeline*/
geo*/
tests*/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lib
macro
!macro/.keep
out
geo/*.txt
!out/.keep
tmp
!tmp/.keep
Expand Down
40 changes: 28 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@ EICRECON_DIR = ${DRICH_DEV}/EICrecon/src/services/geometry/richgeo
DEPS += -I$(EICRECON_DIR)

LIB_TARGET = lib
IRTGEO_LIB_NAME = IrtGeo
IRTGEO_LIB = $(LIB_TARGET)/lib$(IRTGEO_LIB_NAME).so
IRTGEO_ROOT = $(EICRECON_DIR)
IRTGEO_SOURCES := $(wildcard $(IRTGEO_ROOT)/IrtGeo*.cc)
IRTGEO_HEADERS := $(wildcard $(IRTGEO_ROOT)/IrtGeo*.h) $(IRTGEO_ROOT)/RichGeo.h
RICHGEO_LIB_NAME = RichGeo
RICHGEO_LIB = $(LIB_TARGET)/lib$(RICHGEO_LIB_NAME).so
RICHGEO_ROOT = $(EICRECON_DIR)
RICHGEO_SOURCES := $(wildcard $(RICHGEO_ROOT)/IrtGeo*.cc) $(RICHGEO_ROOT)/ReadoutGeo.cc
RICHGEO_HEADERS := $(wildcard $(RICHGEO_ROOT)/IrtGeo*.h) $(RICHGEO_ROOT)/ReadoutGeo.h $(RICHGEO_ROOT)/RichGeo.h

IRT_AUXFILE_SOURCE = src/create_irt_auxfile.cpp
IRT_AUXFILE_EXECUTABLE = $(BIN_TARGET)/create_irt_auxfile
SOURCES := $(filter-out $(IRT_AUXFILE_SOURCE), $(SOURCES))
EXECUTABLES := $(filter-out $(IRT_AUXFILE_EXECUTABLE), $(EXECUTABLES))

PIXEL_GAP_SOURCE = src/test_pixel_gap_cuts.cpp
PIXEL_GAP_EXECUTABLE = $(BIN_TARGET)/test_pixel_gap_cuts
SOURCES := $(filter-out $(PIXEL_GAP_SOURCE), $(SOURCES))
EXECUTABLES := $(filter-out $(PIXEL_GAP_EXECUTABLE), $(EXECUTABLES))

#--------------------------------------------

all: $(EXECUTABLES) $(IRTGEO_LIB) $(IRT_AUXFILE_EXECUTABLE)
all: $(EXECUTABLES) $(RICHGEO_LIB) $(IRT_AUXFILE_EXECUTABLE) $(PIXEL_GAP_EXECUTABLE)

$(EXECUTABLES): $(BIN_TARGET)/%: src/%.cpp
mkdir -p $(BIN_TARGET)
Expand All @@ -54,28 +59,39 @@ $(EXECUTABLES): $(BIN_TARGET)/%: src/%.cpp
$(CXX) -o $@ [email protected] $(LIBS)
$(RM) [email protected]

$(IRTGEO_LIB): $(IRTGEO_HEADERS) $(IRTGEO_SOURCES)
$(RICHGEO_LIB): $(RICHGEO_HEADERS) $(RICHGEO_SOURCES)
ifeq ($(IRT_ROOT_DICT_FOUND),1)
mkdir -p $(LIB_TARGET)
@echo "----- build $@ -----"
$(CXX) $(IRTGEO_SOURCES) -shared -o $@ $(FLAGS) $(DEPS) $(LIBS)
$(CXX) $(RICHGEO_SOURCES) -shared -o $@ $(FLAGS) $(DEPS) $(LIBS)
else
@echo "WARNING: skip building $@ since IRT ROOT dict not found"
endif

$(IRT_AUXFILE_EXECUTABLE): $(IRT_AUXFILE_SOURCE) $(RICHGEO_LIB)
ifeq ($(IRT_ROOT_DICT_FOUND),1)
mkdir -p $(BIN_TARGET)
@echo "----- build [email protected] -----"
$(CXX) -c $< -o [email protected] $(FLAGS) $(DEPS)
@echo "--- make executable $@"
$(CXX) -o $@ [email protected] $(LIBS) -L$(LIB_TARGET) -l$(RICHGEO_LIB_NAME)
$(RM) [email protected]
else
@echo "WARNING: skip building $@ since IRT ROOT dict not found"
endif

$(IRT_AUXFILE_EXECUTABLE): $(IRT_AUXFILE_SOURCE) $(IRTGEO_LIB)
$(PIXEL_GAP_EXECUTABLE): $(PIXEL_GAP_SOURCE) $(RICHGEO_LIB)
ifeq ($(IRT_ROOT_DICT_FOUND),1)
mkdir -p $(BIN_TARGET)
@echo "----- build [email protected] -----"
$(CXX) -c $< -o [email protected] $(FLAGS) $(DEPS)
@echo "--- make executable $@"
$(CXX) -o $@ [email protected] $(LIBS) -L$(LIB_TARGET) -l$(IRTGEO_LIB_NAME)
$(CXX) -o $@ [email protected] $(LIBS) -L$(LIB_TARGET) -l$(RICHGEO_LIB_NAME)
$(RM) [email protected]
else
@echo "WARNING: skip building $@ since IRT ROOT dict not found"
endif

clean:
@echo "CLEAN ======================================================"
$(RM) $(EXECUTABLES) $(IRT_AUXFILE_EXECUTABLE) $(IRTGEO_LIB)

$(RM) $(EXECUTABLES) $(IRT_AUXFILE_EXECUTABLE) $(PIXEL_GAP_EXECUTABLE) $(RICHGEO_LIB)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ flowchart TB
- [CERN host](https://root.cern/js/) (recommended)
- Local host (advanced, but offers better control) - see [setup guide](doc/jsroot.md)
- [ANL hosted](https://eic.phy.anl.gov/geoviewer/)
- alternatively, run `view.py` to use a `ROOT` `TGeoManager`
- browse the ROOT file geometry tree in the sidebar on the left:
```
detector_geometry.root
Expand Down
33 changes: 33 additions & 0 deletions config/recon_digi_only.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
################################################################################
# CONFIGURATION FILE FOR DRICH EICrecon USAGE
# - use with EICrecon `git` branch `irt-algo` or `irt-algo-stable`
################################################################################

### PODIO collections to include in the output
podio:
output_include_collections:
### simulation
- DRICHHits
- MCParticles
### digitization
- DRICHRawHits
- DRICHRawHitsAssociations

### DRICH Configuration Overrides
DRICH:
DRICHRawHits:
enablePixelGaps: true

### EICrecon log levels
log_levels:
eicrecon: info
richgeo: info
DRICH:
DRICHRawHits: info

### common settings
jana:
nevents: 0
debug_plugin_loading: 1
acts:
MaterialMap: calibrations/materials-map.cbor
16 changes: 6 additions & 10 deletions doc/tutorials/1-setup-and-running-simulations.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ Add the following script, named `jsroot` to your `$PATH`:
#!/bin/bash
pushd ${HOME}/jsroot # change this to wherever you unpacked the jsroot release
echo "FOR FULL DETECTOR:"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark\n\n"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark&opt=ctrl;\n\n"
echo "FOR DRICH ONLY:"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark&item=default/world_volume/DRICH_0/DRICH_gas_0&opt=ctrl;\n\n"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark&item=default/world_volume/DRICH_0/DRICH_gas_0&opt=ctrl;vislvl8;more\n\n"
echo "FOR PFRICH ONLY:"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark&item=default/world_volume/PFRICH_0/PFRICH_gas_0&opt=ctrl;\n\n"
printf "\nhttp://localhost:8000/?file=geo/detector_geometry.root&dark&item=default/world_volume/PFRICH_0/PFRICH_gas_0&opt=ctrl;vislvl8;more\n\n"
echo "============================================"
python -m http.server
popd
Expand Down Expand Up @@ -278,17 +278,13 @@ View the image in `out/ev/`.

You may also draw one event at a time (see the usage guide)
```bash
event_display d s out/sim.edm4hep.root 0 0
event_display d s out/sim.edm4hep.root n 0 0
```
View the images in `out/ev/`.

Each green box is a single SiPM, and each histogram bin is a single SiPM pixel (8x8 pixels per SiPM). If you want to zoom in, edit `src/event_display.cpp` and uncomment the line
```cpp
#define INTERACTIVE_USE
```
Then re-compile (`make`) and rerun. This will keep the `TCanvas` open and allow you to zoom in. For example, here is a closeup of the gas ring from a single event, by running
Each green box is a single SiPM, and each histogram bin is a single SiPM pixel (8x8 pixels per SiPM). If you want to zoom in, use interactive mode by changing `n` to `i`, which will keep the `TCanvas` open and allow you to zoom in. For example, here is a closeup of the gas ring from a single event, by running
```bash
event_display d s out/sim.edm4hep.root 0
event_display d s out/sim.edm4hep.root i 0
```

![sim-ev-all-zoom](img/sim-ev-all-zoom.png)
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure_CI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for repo in $repo_list; do
git clone https://github.com/eic/irt.git --branch main
;;
EICrecon)
git clone https://github.com/eic/EICrecon.git --branch irt-algo
git clone https://github.com/eic/EICrecon.git --branch main
;;
reconstruction_benchmarks)
git clone https://eicweb.phy.anl.gov/EIC/benchmarks/reconstruction_benchmarks.git --branch irt-algo
Expand Down
Loading