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
Merge requests
!1338
CAD conversion tools and procedure
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
CAD conversion tools and procedure
e.clerkin/cbmroot:CAD2ROOT
into
master
Overview
11
Commits
9
Pipelines
8
Changes
8
Merged
Eoin Clerkin
requested to merge
e.clerkin/cbmroot:CAD2ROOT
into
master
1 year ago
Overview
11
Commits
9
Pipelines
8
Changes
8
Expand
Geometry utils with Readme to faciltate conversion of CAD models into CBMROOT geometries.
0
0
Merge request reports
Compare
master
version 7
b7ebfdcd
1 year ago
version 6
9fd32f7c
1 year ago
version 5
6314ccc2
1 year ago
version 4
26a93ef1
1 year ago
version 3
83ef82dd
1 year ago
version 2
e3255deb
1 year ago
version 1
26dbc816
1 year ago
master (base)
and
version 5
latest version
4f921362
9 commits,
1 year ago
version 7
b7ebfdcd
9 commits,
1 year ago
version 6
9fd32f7c
8 commits,
1 year ago
version 5
6314ccc2
8 commits,
1 year ago
version 4
26a93ef1
8 commits,
1 year ago
version 3
83ef82dd
7 commits,
1 year ago
version 2
e3255deb
7 commits,
1 year ago
version 1
26dbc816
6 commits,
1 year ago
8 files
+
247
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
core/base/utils/CbmGeometryUtils.cxx
+
78
−
3
Options
/* Copyright (C) 2018-202
1
GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
/* Copyright (C) 2018-202
3
GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig [committer] */
Authors: Florian Uhlig [committer]
, Eoin Clerkin
*/
#include
"CbmGeometryUtils.h"
@@ -26,13 +26,13 @@
#include
<TObjArray.h>
// for TObjArray
#include
<TObject.h>
// for TObject
#include
<TString.h>
// for TString, operator<, operator<<
#include
<TSystem.h>
// for gSystem
#include
<climits>
#include
<map>
// for map
#include
<string.h>
// for strcmp
namespace
Cbm
{
namespace
GeometryUtils
@@ -408,5 +408,80 @@ namespace Cbm
covYY
=
rc10
*
r10
+
rc11
*
r11
;
}
/* Populate a GeoManager with the full media and materials defined to return */
TGeoManager
*
pop_TGeoManager
(
const
char
*
name
)
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader
*
geoLoad
=
new
FairGeoLoader
(
"TGeo"
,
"FairGeoLoader"
);
FairGeoInterface
*
geoFace
=
geoLoad
->
getGeoInterface
();
TString
geoPath
=
gSystem
->
Getenv
(
"VMCWORKDIR"
);
TString
geoFile
=
geoPath
+
"/geometry/media.geo"
;
geoFace
->
setMediaFile
(
geoFile
);
geoFace
->
readMedia
();
// Read the required media and create them in the GeoManager
FairGeoMedia
*
geoMedia
=
geoFace
->
getMedia
();
FairGeoBuilder
*
geoBuild
=
geoLoad
->
getGeoBuilder
();
int
num
=
geoMedia
->
getListOfMedia
()
->
GetSize
();
FairGeoMedium
*
med
=
new
FairGeoMedium
();
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
med
=
geoMedia
->
getMedium
(
geoMedia
->
getListOfMedia
()
->
At
(
i
)
->
GetName
());
geoBuild
->
createMedium
(
med
);
};
gGeoManager
->
SetTitle
(
name
);
return
gGeoManager
;
}
/* Open root file geometry and add it to parent */
bool
add_binary
(
const
char
rootFile
[],
TGeoVolume
*
top
,
TGeoMedium
*
med
,
Int_t
inum
,
TGeoMatrix
*
mat
)
{
TFile
*
file
=
TFile
::
Open
(
rootFile
,
"OPEN"
);
if
(
file
==
NULL
)
{
LOG
(
info
)
<<
"Error file "
<<
rootFile
<<
" not opened"
;
return
false
;
}
else
{
((
TGeoVolume
*
)
file
->
Get
(
file
->
GetListOfKeys
()
->
First
()
->
GetName
()))
->
SetMedium
(
med
);
top
->
AddNode
((
TGeoVolume
*
)
(
file
->
Get
(
file
->
GetListOfKeys
()
->
First
()
->
GetName
()))
->
Clone
(),
inum
,
mat
);
};
(
top
->
GetNode
(
top
->
GetNodes
()
->
Last
()
->
GetName
()))
->
GetVolume
()
->
SetMedium
(
med
);
file
->
Close
();
return
true
;
}
/* Take in the positional matrix and return it in TGeo format */
TGeoMatrix
*
cad_matrix
(
double
XX
,
double
XY
,
double
XZ
,
double
YX
,
double
YY
,
double
YZ
,
double
ZX
,
double
ZY
,
double
ZZ
,
double
TX
,
double
TY
,
double
TZ
)
{
TGeoHMatrix
*
hmat
=
new
TGeoHMatrix
();
(
hmat
->
GetRotationMatrix
())[
0
]
=
XX
;
(
hmat
->
GetRotationMatrix
())[
3
]
=
XY
;
(
hmat
->
GetRotationMatrix
())[
6
]
=
XZ
;
(
hmat
->
GetRotationMatrix
())[
1
]
=
YX
;
(
hmat
->
GetRotationMatrix
())[
4
]
=
YY
;
(
hmat
->
GetRotationMatrix
())[
7
]
=
YZ
;
(
hmat
->
GetRotationMatrix
())[
2
]
=
ZX
;
(
hmat
->
GetRotationMatrix
())[
5
]
=
ZY
;
(
hmat
->
GetRotationMatrix
())[
8
]
=
ZZ
;
TGeoRotation
*
rot
=
new
TGeoRotation
();
rot
->
SetRotation
(
*
hmat
);
TGeoCombiTrans
*
mat
=
new
TGeoCombiTrans
(
TX
/
1
,
TY
/
1
,
TZ
/
1
,
rot
);
return
mat
;
};
}
// namespace GeometryUtils
}
// namespace Cbm
Loading