45 if (not transform.isApprox(Transform3D::Identity())) {
46 surfaceHedron.
move(transform);
48 drawPolyhedron(helper, surfaceHedron, ViewConfig);
60 for (
const auto& sf : surfaceArray.
surfaces()) {
61 ViewConfig vConfig = sf->associatedDetectorElement() !=
nullptr
64 drawSurface(helper, *sf, gctx, transform, vConfig);
65 auto sfExtent = sf->polyhedronRepresentation(gctx, 1).extent();
66 arrayExtent.
extend(sfExtent);
77 auto axes = surfaceArray.
getAxes();
78 if (not binning.empty() and binning.size() == 2 and axes.size() == 2) {
80 if (binning[0] ==
binPhi and binning[1] ==
binZ) {
83 auto zValues = axes[1]->getBinEdges();
89 double sphi = std::sin(
phi);
90 Vector3D p1(R * cphi, R * sphi, axes[1]->getMin());
91 Vector3D p0(R * cphi, R * sphi, axes[1]->getMax());
92 drawSegment(helper, transform * p0, transform * p1, gridConfig);
97 for (
auto z : zValues) {
98 for (
auto cvbSf : cvbOrientedSurfaces) {
99 drawSurface(helper, *cvbSf.first, gctx,
104 }
else if (binning[0] ==
binR and binning[1] ==
binPhi) {
106 auto rValues = axes[0]->getBinEdges();
110 for (
auto r : rValues) {
114 for (
auto cvbSf : cvbOrientedSurfaces) {
115 drawSurface(helper, *cvbSf.first, gctx,
119 double rMin = axes[0]->getMin();
120 double rMax = axes[0]->getMax();
123 double sphi = std::sin(
phi);
124 Vector3D p1(rMax * cphi, rMax * sphi, z);
125 Vector3D p0(rMin * cphi, rMin * sphi, z);
126 drawSegment(helper, transform * p0, transform * p1, gridConfig);
143 for (
const auto& bs : bSurfaces) {
144 drawSurface(helper, bs->surfaceRepresentation(),
gctx,
transform,
157 if (layerVolume !=
nullptr) {
158 drawVolume(helper, *layerVolume, gctx, Transform3D::Identity(),
162 drawSurface(helper, layerSurface, gctx, Transform3D::Identity(),
173 if (surfaceArray !=
nullptr) {
174 drawSurfaceArray(helper, *surfaceArray, gctx, Transform3D::Identity(),
175 sensitiveConfig, layerConfig, gridConfig);
185 const std::string&
tag) {
188 for (
const auto& tv : subVolumes) {
189 drawTrackingVolume(helper, *tv, gctx, containerView, volumeView,
190 layerView, sensitiveView, gridView, writeIt, tag);
204 std::vector<std::string> repChar = {
":",
"|",
" ",
"{",
"}"};
205 for (
auto rchar : repChar) {
206 while (vname.find(rchar) != std::string::npos) {
207 vname.replace(vname.find(rchar), rchar.size(), std::string(
"_"));
212 vcConfig.
outputName = vname + std::string(
"_boundaries") +
tag;
215 std::string(
"Container-") + vname + std::string(
"_boundaries") +
tag;
220 for (
const auto& bs : bSurfaces) {
221 drawSurface(helper, bs->surfaceRepresentation(),
gctx,
222 Transform3D::Identity(), vcConfig);
232 for (
const auto& tl : layers) {
241 drawLayer(helper, *tl, gctx, lConfig, sConfig, gConfig);
256 auto direction =
Vector3D(end - start).normalized();
257 double hlength = 0.5 *
Vector3D(end - start).norm();
261 lrotation.col(0) = unitVectors.first;
262 lrotation.col(1) = unitVectors.second;
263 lrotation.col(2) = direction;
265 Vector3D lcenter = 0.5 * (start + end);
266 double alength = (thickness > 0.) ? arrowLength * thickness : 2.;
267 if (alength > hlength) {
273 }
else if (arrows != 0) {
274 hlength -= 0.5 * alength;
275 lcenter -=
Vector3D(arrows * 0.5 * alength * direction);
279 if (thickness > 0.) {
280 auto ltransform = Transform3D::Identity();
281 ltransform.prerotate(lrotation);
282 ltransform.pretranslate(lcenter);
284 auto lbounds = std::make_shared<CylinderBounds>(
thickness, hlength);
285 auto line = Surface::makeShared<CylinderSurface>(ltransform, lbounds);
290 helper.
line(start, end, viewConfig.
color);
295 double awith = thickness * arrowWidth;
296 double alpha = atan2(thickness * arrowWidth, alength);
297 auto plateBounds = std::make_shared<RadialBounds>(
thickness, awith);
300 auto aetransform = Transform3D::Identity();
301 aetransform.prerotate(lrotation);
302 aetransform.pretranslate(end);
304 auto coneBounds = std::make_shared<ConeBounds>(
alpha, -alength, 0.);
305 auto cone = Surface::makeShared<ConeSurface>(aetransform, coneBounds);
309 auto aptransform = Transform3D::Identity();
310 aptransform.prerotate(lrotation);
311 aptransform.pretranslate(
Vector3D(end - alength * direction));
313 auto plate = Surface::makeShared<DiscSurface>(aptransform, plateBounds);
314 drawSurface(helper, *plate,
GeometryContext(), Transform3D::Identity(),
317 if (arrows < 0 or arrows == 2) {
318 auto astransform = Transform3D::Identity();
319 astransform.prerotate(lrotation);
320 astransform.pretranslate(start);
323 auto coneBounds = std::make_shared<ConeBounds>(
alpha, 0., alength);
324 auto cone = Surface::makeShared<ConeSurface>(astransform, coneBounds);
328 auto aptransform = Transform3D::Identity();
329 aptransform.prerotate(lrotation);
330 aptransform.pretranslate(
Vector3D(start + alength * direction));
332 auto plate = Surface::makeShared<DiscSurface>(aptransform, plateBounds);
333 drawSurface(helper, *plate,
GeometryContext(), Transform3D::Identity(),
343 drawSegmentBase(helper, start, end, 0, 0., 0., viewConfig);
348 double arrowLength,
double arrowWidth,
const ViewConfig& viewConfig) {
349 drawSegmentBase(helper, start, end, -1, arrowLength, arrowWidth, viewConfig);
354 double arrowLength,
double arrowWidth,
const ViewConfig& viewConfig) {
355 drawSegmentBase(helper, start, end, 1, arrowLength, arrowWidth, viewConfig);
361 double arrowLength,
double arrowWidth,
363 drawSegmentBase(helper, start, end, 2, arrowLength, arrowWidth, viewConfig);