Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
solid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
EIC
detectors
solid
Commits
59e2a077
Commit
59e2a077
authored
1 year ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
update vis viewing angle
parent
863cba74
No related branches found
No related tags found
1 merge request
!1
Update
Pipeline
#92848
passed with warnings
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
macro/vis.mac
+1
-1
1 addition, 1 deletion
macro/vis.mac
src/GasCherenkov_geo.cpp
+38
-25
38 additions, 25 deletions
src/GasCherenkov_geo.cpp
with
39 additions
and
26 deletions
macro/vis.mac
+
1
−
1
View file @
59e2a077
/vis/open OGL 800x800-0+0
/vis/open OGL 800x800-0+0
/vis/drawVolume
/vis/drawVolume
/vis/viewer/set/viewpointThetaPhi
30 30
/vis/viewer/set/viewpointThetaPhi
-135 -45
#/vis/viewer/zoom 30.
#/vis/viewer/zoom 30.
#/vis/viewer/set/style wireframe
#/vis/viewer/set/style wireframe
#/vis/scene/add/axes 0 0 0 1 m
#/vis/scene/add/axes 0 0 0 1 m
...
...
This diff is collapsed.
Click to expand it.
src/GasCherenkov_geo.cpp
+
38
−
25
View file @
59e2a077
...
@@ -13,6 +13,41 @@
...
@@ -13,6 +13,41 @@
using
namespace
dd4hep
;
using
namespace
dd4hep
;
using
namespace
dd4hep
::
rec
;
using
namespace
dd4hep
::
rec
;
// A helper function to build stacked cone segments
// set solid and material into <vol>
// return the distance between (in z) the starting point and the volume center
double
stackConeSegments
(
Detector
&
desc
,
xml_comp_t
x_comp
,
Volume
&
vol
)
{
// store solids and their lengths
std
::
vector
<
double
>
lengths
;
std
::
vector
<
ConeSegment
>
conesegs
;
// collect cone segments
for
(
xml_coll_t
il
(
x_comp
,
_Unicode
(
segment
));
il
;
++
il
)
{
xml_dim_t
idim
=
il
;
conesegs
.
emplace_back
(
idim
.
length
()
/
2.
,
idim
.
rmin1
(),
idim
.
rmax1
(),
idim
.
rmin2
(),
idim
.
rmax2
());
lengths
.
push_back
(
idim
.
length
());
}
// make a union solid out of the segments
// 0 size also include and will raise errors
if
(
conesegs
.
size
()
<=
1
)
{
vol
.
setSolid
(
conesegs
[
0
]);
}
else
{
UnionSolid
segs_union
(
conesegs
[
0
],
conesegs
[
1
],
Position
(
0.
,
0.
,
(
lengths
[
0
]
+
lengths
[
1
])
/
2.
));
double
mid_length
=
lengths
[
1
];
for
(
size_t
i
=
2
;
i
<
conesegs
.
size
();
++
i
)
{
segs_union
=
UnionSolid
(
segs_union
,
conesegs
[
i
],
Position
(
0.
,
0.
,
(
lengths
[
0
]
+
lengths
[
i
])
/
2.
+
mid_length
));
mid_length
+=
lengths
[
i
];
}
vol
.
setSolid
(
segs_union
);
}
auto
mat
=
desc
.
material
(
x_comp
.
attr
<
std
::
string
>
(
_U
(
radiator
)));
vol
.
setMaterial
(
mat
);
// we use the first segment as the center solid
return
lengths
[
0
]
/
2.
;
}
// main geometry builder
static
Ref_t
createDetector
(
Detector
&
desc
,
xml
::
Handle_t
handle
,
SensitiveDetector
sens
)
static
Ref_t
createDetector
(
Detector
&
desc
,
xml
::
Handle_t
handle
,
SensitiveDetector
sens
)
{
{
xml
::
DetElement
x_det
=
handle
;
xml
::
DetElement
x_det
=
handle
;
...
@@ -31,35 +66,13 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
...
@@ -31,35 +66,13 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
// --------------
// --------------
// Main tank
// Main tank
// snout first
// build from stacking conesegments
std
::
vector
<
double
>
tank_lengths
;
std
::
vector
<
ConeSegment
>
tank_solids
;
// collect tank segments
auto
x_tank
=
x_det
.
child
(
_Unicode
(
tank
));
auto
x_tank
=
x_det
.
child
(
_Unicode
(
tank
));
for
(
xml_coll_t
il
(
x_tank
,
_Unicode
(
segment
));
il
;
++
il
)
{
Volume
v_tank
(
"v_gas_tank"
);
xml_dim_t
idim
=
il
;
double
shift_z
=
stackConeSegments
(
desc
,
x_tank
,
v_tank
);
tank_solids
.
emplace_back
(
idim
.
length
()
/
2.
,
idim
.
rmin1
(),
idim
.
rmax1
(),
idim
.
rmin2
(),
idim
.
rmax2
());
tank_lengths
.
push_back
(
idim
.
length
());
}
// make a union solid out of the segments
Volume
v_tank
;
auto
rad_mat
=
desc
.
material
(
x_tank
.
attr
<
std
::
string
>
(
_U
(
radiator
)));
// 0 size also include and will raise errors
if
(
tank_solids
.
size
()
<=
1
)
{
v_tank
=
Volume
(
"v_gas_tank"
,
tank_solids
[
0
],
rad_mat
);
}
else
{
UnionSolid
tank_union
(
tank_solids
[
0
],
tank_solids
[
1
],
Position
(
0.
,
0.
,
(
tank_lengths
[
0
]
+
tank_lengths
[
1
])
/
2.
));
double
mid_length
=
tank_lengths
[
1
];
for
(
size_t
i
=
2
;
i
<
tank_solids
.
size
();
++
i
)
{
tank_union
=
UnionSolid
(
tank_union
,
tank_solids
[
i
],
Position
(
0.
,
0.
,
(
tank_lengths
[
0
]
+
tank_lengths
[
i
])
/
2.
+
mid_length
));
mid_length
+=
tank_lengths
[
i
];
}
v_tank
=
Volume
(
"v_gas_tank"
,
tank_union
,
rad_mat
);
}
v_tank
.
setVisAttributes
(
desc
,
x_tank
.
attr
<
std
::
string
>
(
_Unicode
(
vis
)));
v_tank
.
setVisAttributes
(
desc
,
x_tank
.
attr
<
std
::
string
>
(
_Unicode
(
vis
)));
Volume
motherVol
=
desc
.
pickMotherVolume
(
det
);
Volume
motherVol
=
desc
.
pickMotherVolume
(
det
);
// z value to shift the center of the envelope from its first segment's center to the very beginning
// z value to shift the center of the envelope from its first segment's center to the very beginning
double
shift_z
=
tank_lengths
[
0
]
/
2.
;
PlacedVolume
envPV
=
motherVol
.
placeVolume
(
v_tank
,
Position
(
pos_x
,
pos_y
,
pos_z0
+
shift_z
));
PlacedVolume
envPV
=
motherVol
.
placeVolume
(
v_tank
,
Position
(
pos_x
,
pos_y
,
pos_z0
+
shift_z
));
envPV
.
addPhysVolID
(
"system"
,
det_id
);
envPV
.
addPhysVolID
(
"system"
,
det_id
);
det
.
setPlacement
(
envPV
);
det
.
setPlacement
(
envPV
);
...
...
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