Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:38

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 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 http://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 = ViewConfig({0, 180, 240});
0041   viewSensitive.triangulate = triangulate;
0042   ViewConfig viewPassive = ViewConfig({240, 280, 0});
0043   viewPassive.triangulate = triangulate;
0044   ViewConfig viewVolume = ViewConfig({220, 220, 0});
0045   viewVolume.triangulate = triangulate;
0046   ViewConfig viewContainer = ViewConfig({220, 220, 0});
0047   viewContainer.triangulate = triangulate;
0048   ViewConfig viewGrid = ViewConfig({220, 0, 0});
0049   viewGrid.nSegments = 8;
0050   viewGrid.offset = 3.;
0051   viewGrid.triangulate = triangulate;
0052 
0053   const Acts::TrackingVolume& tgVolume = *(tGeometry->highestTrackingVolume());
0054 
0055   GeometryView3D::drawTrackingVolume(helper, tgVolume, tgContext, viewContainer,
0056                                      viewVolume, viewPassive, viewSensitive,
0057                                      viewGrid, true, tag);
0058 
0059   GeometryView3D::drawTrackingVolume(helper, tgVolume, tgContext, viewContainer,
0060                                      viewVolume, viewPassive, viewSensitive,
0061                                      viewGrid, false);
0062   helper.write(cStream);
0063 
0064   return cStream.str();
0065 }
0066 
0067 }  // namespace Acts::TrackingGeometryView3DTest