Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:11:27

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/GeometryContext.hpp"
0012 #include "Acts/Geometry/TrackingGeometryVisitor.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 
0015 #include <sstream>
0016 
0017 namespace Acts::detail {
0018 /// @brief  Visitor class which prints the content of the tracking geometry (volumes, surfaces, portals) in an
0019 ///         indented list. The indentation reflects the position of a volume
0020 ///         inside the overall tracking geometry
0021 class TrackingGeometryPrintVisitor : public Acts::TrackingGeometryVisitor {
0022  public:
0023   /// @brief Constructor
0024   /// @param gctx: Reference to the geometry context needed to align the surfaces inside the detector
0025   /// @param indentation: How many spaces indicate a new step inside the volume hierarchy.
0026   explicit TrackingGeometryPrintVisitor(const Acts::GeometryContext& gctx,
0027                                         std::size_t indentation = 4);
0028   ~TrackingGeometryPrintVisitor() override;
0029 
0030   /// @brief Visit a tracking volume in the geometry
0031   /// @param volume The tracking volume being visited
0032   /// @note Called for each volume in the geometry hierarchy during traversal
0033   void visitVolume(const Acts::TrackingVolume& volume) override;
0034 
0035   /// @brief Visit and potentially modify a portal
0036   /// @param portal The portal being visited
0037   /// @note Called for each portal encountered during geometry traversal
0038   void visitPortal(const Portal& portal) override;
0039 
0040   /// @brief Visit and potentially modify a surface
0041   /// @param surface The surface being visited
0042   /// @note Called for each surface encountered during geometry traversal
0043   void visitSurface(const Surface& surface) override;
0044   /// @brief Return the reference to the underlying stream containing the printout
0045   std::stringstream& stream();
0046   /// @brief Return the reference to the underlying stream containing the printout
0047   const std::stringstream& stream() const;
0048 
0049  private:
0050   /// @brief Calculates the depth of the volume in the hierarchy tree
0051   void updateDepth(const TrackingVolume& trkVol);
0052   /// @brief Returns the position of the volume in the parent tree
0053   std::size_t volNumber(const TrackingVolume& trkVol) const;
0054   /// @brief Geometry context to fetch the center positions of the surface
0055   Acts::GeometryContext m_gctx;
0056   /// @brief Stream into which all print-out is piped
0057   std::stringstream m_printStream;
0058   /// @brief Current depth in the volume hierarchy
0059   std::size_t m_currentDepth{0};
0060   /// @brief Indentiation size
0061   std::size_t m_indentation{4};
0062 };
0063 }  // namespace Acts::detail