Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-24 09:41:54

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/Polyhedron.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 #include "Acts/Utilities/BinningData.hpp"
0016 
0017 #include <ranges>
0018 #include <vector>
0019 
0020 namespace Acts::Experimental::detail {
0021 
0022 enum class ReferenceGeneratorType {
0023   Center,
0024   AxisDirection,
0025   Polyhedron,
0026   Projected
0027 };
0028 
0029 struct IReferenceGenerator {
0030   virtual ~IReferenceGenerator() = default;
0031 
0032   /// Helper to access reference positions for filling the grid
0033   ///
0034   /// @param gctx the geometry context of this operation
0035   /// @param surface the surface for which the reference points are to be accessed
0036   ///
0037   /// @return a vector of reference points for filling
0038   virtual const std::vector<Vector3> references(
0039       const GeometryContext& gctx, const Surface& surface) const = 0;
0040 
0041   /// Access the type of the reference generator
0042   virtual ReferenceGeneratorType type() const = 0;
0043 };
0044 
0045 /// A struct to access the center position
0046 ///
0047 /// This generator will provide only one filling point and hence
0048 /// only a single bin in the indexed grid.
0049 struct CenterReferenceGenerator : public IReferenceGenerator {
0050   /// Helper to access the Center point of for filling the grid
0051   ///
0052   /// @param gctx the geometry context of this operation
0053   /// @param surface the surface for which the reference point is to be accessed
0054   ///
0055   /// @return a vector of reference points for filling
0056   const std::vector<Vector3> references(const GeometryContext& gctx,
0057                                         const Surface& surface) const override {
0058     return {surface.center(gctx)};
0059   }
0060 
0061   /// Access the type of the reference generator
0062   ReferenceGeneratorType type() const override {
0063     return ReferenceGeneratorType::Center;
0064   }
0065 };
0066 
0067 /// A struct to access reference positions based on bin values
0068 ///
0069 /// @tparam bVAL the binning value to be used for the binning position call
0070 ///
0071 /// This generator will provide only one filling point and hence
0072 /// only a single bin in the indexed grid.
0073 template <AxisDirection bVAL>
0074 struct AxisDirectionReferenceGenerator : public IReferenceGenerator {
0075   /// Helper to access a reference position based on binning value
0076   ///
0077   /// @param gctx the geometry context of this operation
0078   /// @param surface the surface for which the reference point is to be accessed
0079   ///
0080   /// @return a vector of reference points for filling
0081   const std::vector<Vector3> references(const GeometryContext& gctx,
0082                                         const Surface& surface) const override {
0083     return {surface.referencePosition(gctx, bVAL)};
0084   }
0085 
0086   /// Access the type of the reference generator
0087   ReferenceGeneratorType type() const override {
0088     return ReferenceGeneratorType::AxisDirection;
0089   }
0090 };
0091 
0092 /// A struct to access generated vertices from surface polyhedrons
0093 /// These vertices are then used to find the bin boundary box for the
0094 /// indexed grid.
0095 ///
0096 ///
0097 /// The grid filling then completes the empty bins in between and
0098 /// expands if necessary.
0099 struct PolyhedronReferenceGenerator : public IReferenceGenerator {
0100   /// This is for the barycenter addition
0101   bool addBarycenter = false;
0102 
0103   /// @brief  The number of segments for the polyhedron approximation
0104   int nSegements = 1;
0105 
0106   /// Absolute expansion value for the reference points
0107   double expansionValue = 0.0;
0108 
0109   /// Helper to access the Center point of for filling the grid
0110   ///
0111   /// @param gctx the geometry context of this operation
0112   /// @param surface the surface for which the reference point is to be accessed
0113   ///
0114   /// @return a vector of reference points for filling
0115   const std::vector<Vector3> references(const GeometryContext& gctx,
0116                                         const Surface& surface) const override;
0117 
0118   /// Access the type of the reference generator
0119   ReferenceGeneratorType type() const override {
0120     return ReferenceGeneratorType::Polyhedron;
0121   }
0122 };
0123 
0124 /// A Projected reference generator which projects the polyhedron vertices onto
0125 /// a given reference surface.
0126 ///
0127 struct ProjectedReferenceGenerator : public IReferenceGenerator {
0128   /// The reference surface onto which to project
0129   std::shared_ptr<Surface> referenceSurface = nullptr;
0130 
0131   /// @brief  The number of segments for the polyhedron approximation
0132   int nSegements = 1;
0133 
0134   /// Absolute expansion value for the reference points
0135   double expansionValue = 0.0;
0136 
0137   /// Luminous region sampling points for the projection - beam spot
0138   std::vector<Vector3> luminousRegion = {Vector3(0., 0., -200.),
0139                                          Vector3(0., 0., 200.0)};
0140 
0141   /// Helper to access the Center point of for filling the grid
0142   ///
0143   /// @param gctx the geometry context of this operation
0144   /// @param surface the surface for which the reference point is to be accessed
0145   ///
0146   /// @return a vector of reference points for filling
0147   const std::vector<Vector3> references(const GeometryContext& gctx,
0148                                         const Surface& surface) const override;
0149 
0150   /// Access the type of the reference generator
0151   ReferenceGeneratorType type() const override {
0152     return ReferenceGeneratorType::Projected;
0153   }
0154 };
0155 
0156 }  // namespace Acts::Experimental::detail