Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
75263a51
Commit
75263a51
authored
1 year ago
by
Eoin Clerkin
Browse files
Options
Downloads
Patches
Plain Diff
Introduce README
uses markdown
parent
67821abc
No related branches found
No related tags found
1 merge request
!1338
CAD conversion tools and procedure
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
macro/geometry/cad2root/README.md
+34
-0
34 additions, 0 deletions
macro/geometry/cad2root/README.md
with
34 additions
and
0 deletions
macro/geometry/cad2root/README.md
0 → 100644
+
34
−
0
View file @
75263a51
Conversion of CAD files to ROOT
==============================
We outline an approach to convert a native CAD geometries to ROOT(GEANT) geometries.
This document will focus on conversion of
[1] STP to STL
Available from any CAD software. Each part, or parts of the same material are written as seperate stl files.
[2] STL to GDML
The python parser available from
[
here
][
https://github.com/tihovav/cad-to-geant4-converter
]
is used:
```
shell
for
file
in
*
.stl
;
do
python /opt/cad-to-geant4-converter/stl_gdml.py noneeded
$file
;
done
```
[3] GDML to ROOT
```
shell
for
file
in
`
ls
*
.gdml
`
;
do
echo
$file
;
root
-q
'make_TGeoVolumeAssembly.C("'
$file
'")'
;
done
;
```
[4] Parsing of the control document allows the introduction of materials, places the ROOT binaries in correct location.
```
shell
awk
-F
'|'
'{gsub("[ ]*$","",$1); gsub(" ","_",$1); gsub("^[ ]*","",$5); gsub("[ ]*$","",$5); gsub(" ","_",$5); printf "add_binary(\\\n\"%s.root\",\\\ntop, gM->GetMedium(\"%s\"), inum++,\\\ncad_matrix(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f)\\\n);\n\n", $1, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15/10, $16/10, $17/10;}'
CONTROL_CAD.txt
>
PARTS.C
```
[5] Stiching together all files into a single detector geometry.
```
shell
root
-q
Create_Geometry.C
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment