Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:03

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Geometry/TrackingGeometry.hpp"
0012 #include "Acts/Geometry/TrackingVolume.hpp"
0013 #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0014 #include "Acts/Visualization/GeometryView3D.hpp"
0015 #include "Acts/Visualization/IVisualization3D.hpp"
0016 
0017 #include <fstream>
0018 #include <sstream>
0019 #include <string>
0020 
0021 namespace Acts::TrackingGeometryView3DTest {
0022 
0023 GeometryContext tgContext = GeometryContext();
0024 
0025 Test::CylindricalTrackingGeometry cGeometry(tgContext);
0026 auto tGeometry = cGeometry();
0027 
0028 /// Helper method to visualize all types of surfaces
0029 ///
0030 /// @param helper The visualization helper
0031 /// @param triangulate The directive whether to create triangular meshes
0032 /// @param tag The test tag (mode) identification
0033 ///
0034 /// @return a string containing all written characters
0035 
0036 static inline std::string run(IVisualization3D& helper, bool triangulate,
0037                               const std::string& tag) {
0038   std::stringstream cStream;
0039 
0040   ViewConfig viewSensitive = {.color = {0, 180, 240},
0041                               .quarterSegments = 72,
0042                               .triangulate = triangulate};
0043   ViewConfig viewPassive = {.color = {240, 280, 0},
0044                             .quarterSegments = 72,
0045                             .triangulate = triangulate};
0046   ViewConfig viewVolume = {.color = {220, 220, 0},
0047                            .quarterSegments = 72,
0048                            .triangulate = triangulate};
0049   ViewConfig viewContainer = {.color = {220, 220, 0},
0050                               .quarterSegments = 72,
0051                               .triangulate = triangulate};
0052   ViewConfig viewGrid = {.color = {220, 0, 0},
0053                          .offset = 3.,
0054                          .quarterSegments = 8,
0055                          .triangulate = triangulate};
0056 
0057   const Acts::TrackingVolume& tgVolume = *(tGeometry->highestTrackingVolume());
0058 
0059   GeometryView3D::drawTrackingVolume(helper, tgVolume, tgContext, viewContainer,
0060                                      viewVolume, viewPassive, viewSensitive,
0061                                      viewGrid, true, tag);
0062 
0063   GeometryView3D::drawTrackingVolume(helper, tgVolume, tgContext, viewContainer,
0064                                      viewVolume, viewPassive, viewSensitive,
0065                                      viewGrid, false);
0066   helper.write(cStream);
0067 
0068   return cStream.str();
0069 }
0070 
0071 }  // namespace Acts::TrackingGeometryView3DTest