Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:45:39

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 #include "Acts/Material/ISurfaceMaterial.hpp"
0010 
0011 #include "Acts/Definitions/Common.hpp"
0012 
0013 #include <stdexcept>
0014 
0015 namespace Acts {
0016 
0017 double ISurfaceMaterial::factor(Direction pDir, MaterialUpdateMode mode) const {
0018   if (mode == MaterialUpdateMode::NoUpdate) {
0019     return 0.;
0020   } else if (mode == MaterialUpdateMode::FullUpdate) {
0021     return 1.;
0022   } else if (mode == MaterialUpdateMode::PreUpdate) {
0023     return pDir == Direction::Negative() ? m_splitFactor : 1 - m_splitFactor;
0024   } else if (mode == MaterialUpdateMode::PostUpdate) {
0025     return pDir == Direction::Positive() ? m_splitFactor : 1 - m_splitFactor;
0026   }
0027 
0028   throw std::logic_error(
0029       "ISurfaceMaterial::factor: Unknown MaterialUpdateMode");
0030 }
0031 
0032 MaterialSlab ISurfaceMaterial::materialSlab(const Vector2& lp, Direction pDir,
0033                                             MaterialUpdateMode mode) const {
0034   // The plain material properties associated to this bin
0035   MaterialSlab plainMatProp = materialSlab(lp);
0036   // Scale if you have material to scale
0037   if (!plainMatProp.isVacuum()) {
0038     double scaleFactor = factor(pDir, mode);
0039     if (scaleFactor == 0.) {
0040       return MaterialSlab::Nothing();
0041     }
0042     plainMatProp.scaleThickness(scaleFactor);
0043   }
0044   return plainMatProp;
0045 }
0046 
0047 MaterialSlab ISurfaceMaterial::materialSlab(const Vector3& gp, Direction pDir,
0048                                             MaterialUpdateMode mode) const {
0049   // The plain material properties associated to this bin
0050   MaterialSlab plainMatProp = materialSlab(gp);
0051   // Scale if you have material to scale
0052   if (!plainMatProp.isVacuum()) {
0053     double scaleFactor = factor(pDir, mode);
0054     if (scaleFactor == 0.) {
0055       return MaterialSlab::Nothing();
0056     }
0057     plainMatProp.scaleThickness(scaleFactor);
0058   }
0059   return plainMatProp;
0060 }
0061 
0062 }  // namespace Acts