Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Core/include/Acts/Material/AccumulatedSurfaceMaterial.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 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/Material/AccumulatedMaterialSlab.hpp"
0013 #include "Acts/Material/MaterialSlab.hpp"
0014 #include "Acts/Utilities/BinUtility.hpp"
0015 
0016 #include <array>
0017 #include <cstddef>
0018 #include <memory>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 class ISurfaceMaterial;
0024 
0025 /// @class AccumulatedSurfaceMaterial
0026 ///
0027 /// This class is used by the SurfaceMaterialMapper in order to
0028 /// accumulate/collect material information during the mapping process.
0029 ///
0030 /// It performs event- and run-average when called, and returns
0031 /// a new SurfaceMaterial object as a unique_ptr after finalisation
0032 class AccumulatedSurfaceMaterial {
0033  public:
0034   /// Type alias for vector of accumulated material slabs
0035   using AccumulatedVector = std::vector<AccumulatedMaterialSlab>;
0036   /// Type alias for matrix (vector of vectors) of accumulated material slabs
0037   using AccumulatedMatrix = std::vector<AccumulatedVector>;
0038 
0039   /// Default Constructor - for homogeneous material
0040   ///
0041   /// @param splitFactor is the pre/post splitting directive
0042   explicit AccumulatedSurfaceMaterial(double splitFactor = 0.);
0043 
0044   /// Explicit constructor with only full MaterialSlab,
0045   /// for one-dimensional binning.
0046   ///
0047   /// The split factors:
0048   ///    - 1. : oppositePre
0049   ///    - 0. : alongPre
0050   ///  ===> 1 Dimensional array
0051   ///
0052   /// @param binUtility defines the binning structure on the surface
0053   /// @param splitFactor is the pre/post splitting directive
0054   explicit AccumulatedSurfaceMaterial(const BinUtility& binUtility,
0055                                       double splitFactor = 0.);
0056 
0057   /// Copy Constructor
0058   ///
0059   /// @param asma is the source object to be copied
0060   AccumulatedSurfaceMaterial(const AccumulatedSurfaceMaterial& asma) = default;
0061 
0062   /// Copy Move Constructor
0063   ///
0064   /// @param asma is the source object to be copied
0065   AccumulatedSurfaceMaterial(AccumulatedSurfaceMaterial&& asma) = default;
0066 
0067   /// Assignment Move operator
0068   ///
0069   /// @param asma is the source object to be copied
0070   /// @return Reference to this object after move assignment
0071   AccumulatedSurfaceMaterial& operator=(AccumulatedSurfaceMaterial&& asma) =
0072       default;
0073 
0074   /// Assignment operator
0075   ///
0076   /// @param asma is the source object to be copied
0077   /// @return Reference to this object after copy assignment
0078   AccumulatedSurfaceMaterial& operator=(
0079       const AccumulatedSurfaceMaterial& asma) = default;
0080 
0081   /// Destructor
0082   ~AccumulatedSurfaceMaterial() = default;
0083 
0084   /// Return the BinUtility
0085   /// @return Reference to the bin utility used for material binning
0086   const BinUtility& binUtility() const;
0087 
0088   /// Assign a material properties object
0089   ///
0090   /// @param lp local position for the bin assignment
0091   /// @param mp material properties to be assigned
0092   /// @param pathCorrection Correction factor for the effective path length
0093   ///
0094   /// @return the bin triple to which the material was assigned
0095   std::array<std::size_t, 3> accumulate(const Vector2& lp,
0096                                         const MaterialSlab& mp,
0097                                         double pathCorrection = 1.);
0098 
0099   /// Assign a material properties object
0100   ///
0101   /// @param gp global position for the bin assignment
0102   /// @param mp material properties to be assigned
0103   /// @param pathCorrection Correction factor for the effective path length
0104   ///
0105   /// @return the bin triple to which the material was assigned
0106   std::array<std::size_t, 3> accumulate(const Vector3& gp,
0107                                         const MaterialSlab& mp,
0108                                         double pathCorrection = 1.);
0109 
0110   /// Use the accumulated material to update the material variance
0111   ///
0112   /// @param trackBins The bins that were touched by this event
0113   /// @param emptyHit indicator if this is an empty assignment
0114   /// @param slabReference reference slab (from the map) used to compute the variance
0115   /// If none is given, the average runs over all bins in the surface map
0116   void trackVariance(const std::vector<std::array<std::size_t, 3>>& trackBins,
0117                      MaterialSlab slabReference, bool emptyHit = false);
0118 
0119   /// Use the accumulated material to update the material variance
0120   ///
0121   /// @param gp global position for the bin assignment
0122   /// @param emptyHit indicator if this is an empty assignment
0123   /// @param slabReference indicator if this is an empty assignment
0124   void trackVariance(const Vector3& gp, MaterialSlab slabReference,
0125                      bool emptyHit = false);
0126 
0127   /// Average the information accumulated from one mapped track
0128   ///
0129   /// @param trackBins The bins that were touched by this event
0130   /// @param emptyHit indicator if this is an empty assignment
0131   /// If none is given, the average runs over all bins in the surface map
0132   void trackAverage(
0133       const std::vector<std::array<std::size_t, 3>>& trackBins = {},
0134       bool emptyHit = false);
0135 
0136   /// Average the information accumulated from one mapped track
0137   ///
0138   /// @param gp global position for the bin assignment
0139   /// @param emptyHit indicator if this is an empty assignment
0140   void trackAverage(const Vector3& gp, bool emptyHit = false);
0141 
0142   /// Total average creates SurfaceMaterial
0143   /// @return Unique pointer to the averaged surface material
0144   std::unique_ptr<const ISurfaceMaterial> totalAverage();
0145 
0146   /// Access to the accumulated material
0147   /// @return Reference to the matrix of accumulated material data
0148   const AccumulatedMatrix& accumulatedMaterial() const;
0149 
0150   /// Access to the split factor
0151   /// @return The split factor used for material averaging
0152   double splitFactor() const;
0153 
0154  private:
0155   /// The helper for the bin finding
0156   BinUtility m_binUtility{};
0157 
0158   /// the split factor
0159   double m_splitFactor{0.};
0160 
0161   /// The stored accumulated material matrix
0162   AccumulatedMatrix m_accumulatedMaterial;
0163 };
0164 
0165 inline const BinUtility& AccumulatedSurfaceMaterial::binUtility() const {
0166   return (m_binUtility);
0167 }
0168 
0169 inline const AccumulatedSurfaceMaterial::AccumulatedMatrix&
0170 AccumulatedSurfaceMaterial::accumulatedMaterial() const {
0171   return (m_accumulatedMaterial);
0172 }
0173 
0174 inline double AccumulatedSurfaceMaterial::splitFactor() const {
0175   return m_splitFactor;
0176 }
0177 }  // namespace Acts