Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:53

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/Extent.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014 #include "Acts/Utilities/AxisDefinitions.hpp"
0015 
0016 #include <iostream>
0017 #include <memory>
0018 #include <utility>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 /// @struct ProtoLayer
0024 ///
0025 /// Encapsulates min/max boundaries that will be turned into a layer.
0026 /// The struct allows this information to be obtained in a consistent
0027 /// way, or be caller provided.
0028 
0029 struct ProtoLayer {
0030  public:
0031   /// The extent of the ProtoLayer
0032   Extent extent;
0033 
0034   /// The envelope parameters
0035   ExtentEnvelope envelope = ExtentEnvelope::Zero();
0036 
0037   /// The local transform
0038   Transform3 transform = Transform3::Identity();
0039 
0040   /// Constructor
0041   ///
0042   /// Loops over a provided vector of surface and calculates the various
0043   /// min/max values in one go. Also takes into account the thickness
0044   /// of an associated DetectorElement, if it exists.
0045   ///
0046   /// @param gctx The current geometry context object, e.g. alignment
0047   /// @param surfaces The vector of surfaces to consider
0048   /// @param transformIn The local transform to evaluate the sizing in
0049   ProtoLayer(const GeometryContext& gctx,
0050              const std::vector<const Surface*>& surfaces,
0051              const Transform3& transformIn = Transform3::Identity());
0052 
0053   /// Constructor
0054   ///
0055   /// Loops over a provided vector of surface and calculates the various
0056   /// min/max values in one go. Also takes into account the thickness
0057   /// of an associated DetectorElement, if it exists.
0058   ///
0059   /// @param gctx The current geometry context object, e.g. alignment
0060   /// @param surfaces The vector of surfaces to consider
0061   /// @param transformIn The local transform to evaluate the sizing in
0062   ProtoLayer(const GeometryContext& gctx,
0063              const std::vector<std::shared_ptr<const Surface>>& surfaces,
0064              const Transform3& transformIn = Transform3::Identity());
0065 
0066   /// Constructor
0067   ///
0068   /// Loops over a provided vector of surface and calculates the various
0069   /// min/max values in one go. Also takes into account the thickness
0070   /// of an associated DetectorElement, if it exists.
0071   ///
0072   /// @param gctx The current geometry context object, e.g. alignment
0073   /// @param surfaces The vector of surfaces to consider
0074   /// @param transformIn The local transform to evaluate the sizing in
0075   ProtoLayer(const GeometryContext& gctx,
0076              const std::vector<std::shared_ptr<Surface>>& surfaces,
0077              const Transform3& transformIn = Transform3::Identity());
0078 
0079   ProtoLayer() = default;
0080 
0081   /// Get the parameters : min
0082   /// @param aDir The accessed axis direction
0083   /// @param addenv The steering if enevlope is added or not
0084   double min(AxisDirection aDir, bool addenv = true) const;
0085 
0086   // Get the  parameters : max
0087   /// @param aDir The accessed axis direction
0088   /// @param addenv The steering if enevlope is added or not
0089   double max(AxisDirection aDir, bool addenv = true) const;
0090 
0091   // Get the  parameters : max
0092   /// @param aDir The accessed axis direction
0093   /// @param addenv The steering if enevlope is added or not
0094   double medium(AxisDirection aDir, bool addenv = true) const;
0095 
0096   // Get the  parameters : max
0097   /// @param aDir The accessed axis direction
0098   /// @param addenv The steering if enevlope is added or not
0099   double range(AxisDirection aDir, bool addenv = true) const;
0100 
0101   /// Output to ostream
0102   /// @param sl the input ostream
0103   std::ostream& toStream(std::ostream& sl) const;
0104 
0105   /// Output stream operator
0106   /// @param sl the input ostream
0107   /// @param pl the ProtoLayer to be printed
0108   /// @return the output ostream
0109   friend std::ostream& operator<<(std::ostream& sl, const ProtoLayer& pl) {
0110     return pl.toStream(sl);
0111   }
0112 
0113   /// Give access to the surfaces used/assigned to the ProtoLayer
0114   const std::vector<const Surface*>& surfaces() const;
0115 
0116   /// Add a surface, this will also increase the extent
0117   /// @param gctx The current geometry context object, e.g. alignment
0118   /// @param surface The surface which is added to the ProtoLayer
0119   void add(const GeometryContext& gctx, const Surface& surface);
0120 
0121  private:
0122   /// Helper method which performs the actual min/max calculation
0123   ///
0124   /// @param gctx The current geometry context object, e.g. alignment
0125   /// @param surfaces The surfaces to build this protolayer out of
0126   void measure(const GeometryContext& gctx,
0127                const std::vector<const Surface*>& surfaces);
0128 
0129   /// Store the list of surfaces used for this proto layer
0130   std::vector<const Surface*> m_surfaces = {};
0131 };
0132 
0133 inline const std::vector<const Surface*>& ProtoLayer::surfaces() const {
0134   return m_surfaces;
0135 }
0136 
0137 }  // namespace Acts