Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-17 07:46:02

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Geometry/GeometryIdentifier.hpp"
0014 #include "Acts/Utilities/AxisDefinitions.hpp"
0015 #include "Acts/Utilities/VectorHelpers.hpp"
0016 
0017 namespace Acts {
0018 
0019 /// Base class to provide GeometryIdentifier interface:
0020 /// - simple set and get
0021 ///
0022 /// It also provides the referencePosition method for
0023 /// Geometry geometrical object to be binned in BinnedArrays
0024 ///
0025 class GeometryObject {
0026  public:
0027   /// Defaulted constructor
0028   GeometryObject() = default;
0029 
0030   /// Defaulted copy constructor
0031   GeometryObject(const GeometryObject&) = default;
0032 
0033   /// Constructor from a value
0034   ///
0035   /// @param geometryId the geometry identifier of the object
0036   explicit GeometryObject(const GeometryIdentifier& geometryId)
0037       : m_geometryId(geometryId) {}
0038 
0039   virtual ~GeometryObject() noexcept = default;
0040 
0041   /// @return the geometry id by reference
0042   GeometryIdentifier geometryId() const;
0043 
0044   /// Force a binning position method
0045   ///
0046   /// @param gctx The current geometry context object, e.g. alignment
0047   /// @param aDir is the value for which the reference position is requested
0048   ///
0049   /// @return vector 3D used for the binning schema
0050   virtual Vector3 referencePosition(const GeometryContext& gctx,
0051                                     AxisDirection aDir) const = 0;
0052 
0053   /// Implement the binningValue
0054   ///
0055   /// @param gctx The current geometry context object, e.g. alignment
0056   /// @param aDir is the dobule in which you want to bin
0057   ///
0058   /// @return float to be used for the binning schema
0059   virtual double referencePositionValue(const GeometryContext& gctx,
0060                                         AxisDirection aDir) const;
0061 
0062   /// Set the value
0063   ///
0064   /// @param geometryId the geometry identifier to be assigned
0065   void assignGeometryId(const GeometryIdentifier& geometryId);
0066 
0067  protected:
0068   /// Unique geometry identifier for this object
0069   GeometryIdentifier m_geometryId;
0070 };
0071 
0072 inline GeometryIdentifier GeometryObject::geometryId() const {
0073   return m_geometryId;
0074 }
0075 
0076 inline void GeometryObject::assignGeometryId(
0077     const GeometryIdentifier& geometryId) {
0078   m_geometryId = geometryId;
0079 }
0080 
0081 inline double GeometryObject::referencePositionValue(
0082     const GeometryContext& gctx, AxisDirection aDir) const {
0083   return VectorHelpers::cast(referencePosition(gctx, aDir), aDir);
0084 }
0085 
0086 }  // namespace Acts