Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 07:59:51

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 // Set the Geometry Context PLUGIN
0012 #ifdef ACTS_CORE_GEOMETRYCONTEXT_PLUGIN
0013 #include ACTS_CORE_GEOMETRYCONTEXT_PLUGIN
0014 #else
0015 
0016 #include "Acts/Utilities/detail/ContextType.hpp"
0017 
0018 #include <ostream>
0019 
0020 namespace Acts {
0021 
0022 /// @brief This is the central definition of the Acts
0023 /// payload object regarding detector geometry status (e.g. alignment)
0024 ///
0025 /// It is propagated through the code to allow for event/thread
0026 /// dependent geometry changes
0027 
0028 class GeometryContext : public ContextType {
0029  public:
0030   /// Inherit all constructors
0031   using ContextType::ContextType;
0032   using ContextType::operator=;
0033 };
0034 
0035 /// Helper struct that stores an object and a context, and will print it to
0036 /// an outstream.
0037 /// This allows you to write
0038 /// ```cpp
0039 /// std::cout << surface->toStream(geoContext) << std::endl;
0040 /// ```
0041 template <typename T>
0042 struct GeometryContextOstreamWrapper {
0043   /// Constructor wrapping an object with geometry context for output streaming
0044   /// @param object The object to wrap for streaming
0045   /// @param gctx The geometry context to associate with the object
0046   GeometryContextOstreamWrapper(const T& object, const GeometryContext& gctx)
0047       : m_object(object), m_gctx(gctx) {}
0048 
0049   GeometryContextOstreamWrapper(const GeometryContextOstreamWrapper&) = delete;
0050   GeometryContextOstreamWrapper(GeometryContextOstreamWrapper&&) = delete;
0051   GeometryContextOstreamWrapper& operator=(
0052       const GeometryContextOstreamWrapper&) = delete;
0053   GeometryContextOstreamWrapper& operator=(GeometryContextOstreamWrapper&&) =
0054       delete;
0055 
0056   friend std::ostream& operator<<(
0057       std::ostream& os, const GeometryContextOstreamWrapper& osWrapper) {
0058     osWrapper.toStream(os);
0059     return os;
0060   }
0061 
0062  private:
0063   void toStream(std::ostream& os) const { m_object.toStreamImpl(m_gctx, os); }
0064 
0065   const T& m_object;
0066   const GeometryContext& m_gctx;
0067 };
0068 
0069 }  // namespace Acts
0070 
0071 #endif