Skip to content

Commit

Permalink
feat: export simulation geometry to CAD models (STEP) (#667)
Browse files Browse the repository at this point in the history
### Briefly, what does this PR introduce?
This PR exports the geometry to STEP files for CAD import and
dimensioning. There are no real settings to tweak, but to increase the
level at which volumes are exported, hints can be added to the yaml
file. Detectors can also be removed (currently only the ACTS
subassemblies are removed since they don't do anything).

There are 'issues' that need to be addressed, but they have to be
addressed in npsim:
- units are off (npdet_to_step use the cm value from TGeo and writes
them as inch values in STEP) eic/npsim#20,
- some shapes cannot be exported; not sure yet which ones and it makes
more sense to bypass them in npsim
eic/npsim#21.

### What kind of change does this PR introduce?
- [ ] Bug fix (issue #__)
- [x] New feature (issue #__)
- [ ] Documentation update
- [ ] Other: __

### Please check if this PR fulfills the following:
- [ ] Tests for the changes have been added
- [ ] Documentation has been added / updated
- [ ] Changes have been communicated to collaborators

### Does this PR introduce breaking changes? What changes might users
need to make to their code?
No.

### Does this PR change default behavior?
No.

---------

Co-authored-by: Dmitry Kalinkin <[email protected]>
  • Loading branch information
wdconinc and veprbl authored Mar 24, 2024
1 parent dc00fc3 commit ae2e7e5
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/linux-eic-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,42 @@ jobs:
path: "*.root"
if-no-files-found: error

convert-to-step:
runs-on: ubuntu-latest
needs:
- build
strategy:
matrix:
detector_config: [epic_craterlake_no_bhcal, epic_craterlake_tracking_only, epic_dirc_only, epic_drich_only, epic_imaging_only, epic_ip6, epic_lfhcal_with_insert]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build-gcc-fast-eic-shell
path: install/
- uses: cvmfs-contrib/github-action-cvmfs@v4
- uses: eic/run-cvmfs-osg-eic-shell@main
with:
platform-release: "jug_xl:nightly"
network_types: "none"
setup: install/setup.sh
run: |
# For some reason npdet_to_step really wants a space in IFS
IFS=$' \n\t'
# First get all detectors (except world)
declare -A detectors
while read d ; do detectors[$d]='-l 3' ; done <<< $(npdet_to_step list $DETECTOR_PATH/${{matrix.detector_config}}.xml | sed '/world/d;s/.*(vol: \(.*\)).*/\1/g')
# Then tweak the levels (default is 1)
detectors[LFHCAL]='-l 2'
detectors[OuterBarrelMPGDSubAssembly]='-l 4'
# Export to one STEP file
npdet_to_step $(for d in ${!detectors[@]} ; do echo part ${detectors[$d]} $d ; done) -o ${{matrix.detector_config}} $DETECTOR_PATH/${{matrix.detector_config}}.xml 2>&1 | sed '/TGeoMatrix::dtor/d'
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.detector_config}}.stp
path: ${{matrix.detector_config}}.stp
if-no-files-found: error

dump-constants:
runs-on: ubuntu-latest
needs: build
Expand Down
35 changes: 35 additions & 0 deletions configurations/craterlake_no_bhcal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ebeam: 5
pbeam: 41
features:
beampipe:
tracking:
definitions_craterlake:
vertex_barrel:
silicon_barrel:
mpgd_barrel:
support_service_craterlake:
mpgd_outerbarrel:
mpgd_forward_endcap:
mpgd_backward_endcap:
silicon_disks:
tof_barrel:
tof_endcap:
pid:
dirc:
pfrich:
drich:
ecal:
forward_homogeneous:
forward_insert_homogeneous:
barrel_interlayers:
backward_PbWO4:
solenoid:
hcal:
lfhcal_with_space_for_insert:
forward_insert:
backward:
backward_endcap_flux:
far_forward:
far_forward:
far_backward:
far_backward:

0 comments on commit ae2e7e5

Please sign in to comment.