Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Geometry/GeometryObject.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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