Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Geometry/CylinderVolumeHelper.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/BoundarySurfaceFace.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Geometry/ITrackingVolumeHelper.hpp"
0015 #include "Acts/Utilities/BinningType.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <iosfwd>
0019 #include <memory>
0020 #include <string>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 
0025 class Layer;
0026 class TrackingVolume;
0027 class VolumeBounds;
0028 class CylinderVolumeBounds;
0029 class IVolumeMaterial;
0030 class ILayerArrayCreator;
0031 class ITrackingVolumeArrayCreator;
0032 
0033 /// @class CylinderVolumeHelper
0034 ///
0035 /// The concrete implementation for cylindrical TrackingVolume
0036 /// objects of the ITrackingVolumeCreator interface
0037 ///
0038 class CylinderVolumeHelper : public ITrackingVolumeHelper {
0039  public:
0040   /// @struct Config
0041   /// Nested configuration struct for this CylinderVolumeHelper
0042   struct Config {
0043     /// a tool for coherent LayerArray creation
0044     std::shared_ptr<const ILayerArrayCreator> layerArrayCreator = nullptr;
0045     /// Helper Tool to create TrackingVolume
0046     std::shared_ptr<const ITrackingVolumeArrayCreator>
0047         trackingVolumeArrayCreator = nullptr;
0048     /// thickness of passive layers
0049     double passiveLayerThickness = 1;
0050     /// bins in phi for the passive layer
0051     int passiveLayerPhiBins = 1;
0052     /// bins in r/z for the passive layer
0053     int passiveLayerRzBins = 100;
0054   };
0055 
0056   /// Constructor
0057   /// @param cvhConfig is the configuration struct for this builder
0058   /// @param logger logging instance
0059   CylinderVolumeHelper(const Config& cvhConfig,
0060                        std::unique_ptr<const Logger> logger = getDefaultLogger(
0061                            "CylinderVolumeHelper", Logging::INFO));
0062 
0063   ~CylinderVolumeHelper() override = default;
0064 
0065   /// Create a TrackingVolume* from a set of layers and (optional) parameters
0066   ///
0067   /// @param gctx is the geometry context for witch the volume is built
0068   /// @param layers vector of static layers confined by the TrackingVolume
0069   /// if no bounds or HepTransform is given, they define the size
0070   /// together with the volume enevlope parameters
0071   /// @param volumeMaterial material properties for this TrackingVolume
0072   /// @param volumeBounds: confinement of this TrackingVolume
0073   /// @param mtvVector (optional) Vector of confined TrackingVolumes
0074   /// @param transform (optional) placement of this TrackingVolume
0075   /// @param volumeName  volume name to be given
0076   /// @param bType (optional) BinningType - arbitrary(default) or equidistant
0077   ///
0078   /// @return shared pointer to a new TrackingVolume
0079   MutableTrackingVolumePtr createTrackingVolume(
0080       const GeometryContext& gctx, const LayerVector& layers,
0081       std::shared_ptr<const IVolumeMaterial> volumeMaterial,
0082       std::shared_ptr<VolumeBounds> volumeBounds,
0083       MutableTrackingVolumeVector mtvVector = {},
0084       const Transform3& transform = Transform3::Identity(),
0085       const std::string& volumeName = "UndefinedVolume",
0086       BinningType bType = arbitrary) const override;
0087 
0088   /// Create a TrackingVolume* from a set of layers and (optional) parameters
0089   ///
0090   /// @param gctx is the geometry context for witch the volume is built
0091   /// @param layers vector of static layers confined by the TrackingVolume
0092   /// if no bounds or HepTransform is given, they define the size
0093   /// together with the volume enevlope parameters
0094   /// @param volumeMaterial material properties for this TrackingVolume
0095   /// @param mtvVector Vector of confined TrackingVolumes
0096   /// @param rMin minimum radius
0097   /// @param rMax maximum radius
0098   /// @param zMin minimum z
0099   /// @param zMax maximum z
0100   /// @param volumeName  volume name to be given
0101   /// @param bType (optional) BinningType - arbitrary(default) or equidistant
0102   ///
0103   /// @return shared pointer to a new TrackingVolume
0104   MutableTrackingVolumePtr createTrackingVolume(
0105       const GeometryContext& gctx, const LayerVector& layers,
0106       MutableTrackingVolumeVector mtvVector,
0107       std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin,
0108       double rMax, double zMin, double zMax,
0109       const std::string& volumeName = "UndefinedVolume",
0110       BinningType bType = arbitrary) const override;
0111 
0112   /// Create a gap volume from dimensions and
0113   /// @note this TrackingVolume is restricted to Translation only
0114   ///
0115   /// @param [in] gctx the geometry context for this building
0116   /// @param mtvVector Vector of confined TrackingVolumes
0117   /// @param volumeMaterial dense material properties for this TrackingVolume
0118   /// @param rMin minimum radius
0119   /// @param rMax maximum radius
0120   /// @param zMin minimum z
0121   /// @param zMax maximum z
0122   /// @param materialLayers number of material layers (equidistant binning)
0123   /// @param cylinder type of layers
0124   /// @param volumeName  volume name to be given
0125   ///
0126   /// @return shared pointer to a new TrackingVolume
0127   MutableTrackingVolumePtr createGapTrackingVolume(
0128       const GeometryContext& gctx, MutableTrackingVolumeVector& mtvVector,
0129       std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin,
0130       double rMax, double zMin, double zMax, unsigned int materialLayers,
0131       bool cylinder = true,
0132       const std::string& volumeName = "UndefinedVolume") const override;
0133 
0134   /// Create a gap volume from dimensions and
0135   ///
0136   /// @param [in] gctx the geometry context for this building
0137   /// @param mtvVector Vector of confined TrackingVolumes
0138   /// @param volumeMaterial dense material properties for this TrackingVolume
0139   /// @param rMin minimum radius
0140   /// @param rMax maximum radius
0141   /// @param zMin minimum z
0142   /// @param zMax maximum z
0143   /// @param layerPositions custom layer positions
0144   /// @param cylinder type of layers
0145   /// @param volumeName  : volume name to be given
0146   /// @param bType (optional) BinningType - arbitrary(default) or equidistant
0147   ///
0148   /// @return shared pointer to a new TrackingVolume
0149   MutableTrackingVolumePtr createGapTrackingVolume(
0150       const GeometryContext& gctx, MutableTrackingVolumeVector& mtvVector,
0151       std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin,
0152       double rMax, double zMin, double zMax,
0153       const std::vector<double>& layerPositions, bool cylinder = true,
0154       const std::string& volumeName = "UndefinedVolume",
0155       BinningType bType = arbitrary) const override;
0156 
0157   /// Create a container volumes from sub volumes, input volumes are ordered in
0158   /// R or Z by convention
0159   ///
0160   /// @param [in] gctx the geometry context for this building
0161   /// @param volumes the volumes to be contained
0162   ///
0163   ///
0164   /// @return shared pointer to a new TrackingVolume
0165   MutableTrackingVolumePtr createContainerTrackingVolume(
0166       const GeometryContext& gctx,
0167       const TrackingVolumeVector& volumes) const override;
0168 
0169   /// Set configuration method
0170   ///
0171   /// @param cvhConfig is the configuration struct assigned
0172   void setConfiguration(const Config& cvhConfig);
0173 
0174   /// Get configuration method
0175   Config getConfiguration() const;
0176 
0177   /// Set logging instance
0178   ///
0179   /// @param newLogger is the logger instance to be set
0180   void setLogger(std::unique_ptr<const Logger> newLogger);
0181 
0182  protected:
0183   /// Configuration object
0184   Config m_cfg;
0185 
0186  private:
0187   /// Private access method to the logging instance
0188   const Logger& logger() const { return *m_logger; }
0189 
0190   /// the looging instance
0191   std::unique_ptr<const Logger> m_logger;
0192 
0193   /// Private method - it estimates the CylinderBounds and Translation
0194   /// of layers, these are checked against the layer positions/dimensions.
0195   ///
0196   /// @param gctx [in] the geometry context of this build
0197   /// @param layers the layers for which the dimensions are checked
0198   /// @param cylinderVolumeBounds the cylinder volume bounds needed for wrapping
0199   /// @param transform a transformation of the layers, volume
0200   /// @param rMinClean the smallest radius given by layers
0201   /// @param rMaxClean the maximal radius given by layers
0202   /// @param zMinClean the smallest z extend given by layers
0203   /// @param zMaxClean the maximal z extend given by layers
0204   /// @param bValue the binning value in which the binning works
0205   /// @param bType is the type of binning: equidistant, arbitrary
0206   bool estimateAndCheckDimension(
0207       const GeometryContext& gctx, const LayerVector& layers,
0208       std::shared_ptr<CylinderVolumeBounds>& cylinderVolumeBounds,
0209       const Transform3& transform, double& rMinClean, double& rMaxClean,
0210       double& zMinClean, double& zMaxClean, BinningValue& bValue,
0211       BinningType bType = arbitrary) const;
0212 
0213   /// Private method - interglue all volumes contained by a TrackingVolume
0214   /// and set the outside glue volumes in the descriptor
0215   ///
0216   /// @param gctx [in] the geometry context of this build
0217   /// @param tVolume the tracking volume that is glued together
0218   /// @param rBinned a boolean indicating if it is binned in r
0219   /// @param rMin the minimum radius of the volume
0220   /// @param rGlueMin the minimum glue radius (@todo check and document)
0221   /// @param rMax the maximum radius of the volume
0222   /// @param zMin the minimum z extend of the volume
0223   /// @param zMax the maximum z extend of the volume
0224   bool interGlueTrackingVolume(const GeometryContext& gctx,
0225                                const MutableTrackingVolumePtr& tVolume,
0226                                bool rBinned, double rMin, double rGlueMin,
0227                                double rMax, double zMin, double zMax) const;
0228 
0229   /// Private method - glue volume to the other
0230   ///
0231   /// @param gctx [in] the geometry context of this build
0232   /// @param tvolOne is the first volume in the glue process
0233   /// @param faceOne is the first boundary face of the glue process
0234   /// @param tvolTwo is the second volume in the glue process
0235   /// @param faceTwo is the second boundary face of the glue process
0236   /// @param rMin the minimum radius of the volume
0237   /// @param rGlueMin the minimum glue radius (@todo check and document)
0238   /// @param rMax the maximum radius of the volume
0239   /// @param zMin the minimum z extend of the volume
0240   /// @param zMax the maximum z extend of the volume
0241   void glueTrackingVolumes(const GeometryContext& gctx,
0242                            const MutableTrackingVolumePtr& tvolOne,
0243                            BoundarySurfaceFace faceOne,
0244                            const MutableTrackingVolumePtr& tvolTwo,
0245                            BoundarySurfaceFace faceTwo, double rMin,
0246                            double rGlueMin, double rMax, double zMin,
0247                            double zMax) const;
0248 
0249   /// Private method - helper method not to duplicate code
0250   ///
0251   /// @param tvol is the volume to which faces are added
0252   /// @param glueFace the boundary surface to which faces are added
0253   /// @param vols are the voluems which are added
0254   void addFaceVolumes(const MutableTrackingVolumePtr& tvol,
0255                       BoundarySurfaceFace glueFace,
0256                       TrackingVolumeVector& vols) const;
0257 
0258   /// Private method - helper method to save some code
0259   ///
0260   /// @param z is the z position of the layer (@todo use Transform)
0261   /// @param r is the radius of the layer
0262   /// @param halflengthZ is the half lengthz in z of the cylinder
0263   /// @param thickness is the thickness of the cylinder
0264   /// @param binsPhi are the bins for the material in phi
0265   /// @param binsZ are the bins for the material in z
0266   ///
0267   /// @return shared pointer to newly created cylinder layer
0268   LayerPtr createCylinderLayer(double z, double r, double halflengthZ,
0269                                double thickness, int binsPhi, int binsZ) const;
0270 
0271   /// Private method - helper method to save some code
0272   ///
0273   /// @param z is the z position of the layer (@todo use Transform)
0274   /// @param rMin is the minimum radius of the layer
0275   /// @param rMax is the maximal radius of the layer
0276   /// @param thickness is the thickness of the cylinder
0277   /// @param binsPhi are the bins for the material in phi
0278   /// @param binsR are the bins for the material in R
0279   ///
0280   /// @return shared pointer to newly created cylinder layer
0281   LayerPtr createDiscLayer(double z, double rMin, double rMax, double thickness,
0282                            int binsPhi, int binsR) const;
0283 };
0284 
0285 inline CylinderVolumeHelper::Config CylinderVolumeHelper::getConfiguration()
0286     const {
0287   return m_cfg;
0288 }
0289 }  // namespace Acts