Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:21

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 #include "Acts/Plugins/TGeo/TGeoMaterialConverter.hpp"
0010 
0011 #include "Acts/Material/Material.hpp"
0012 
0013 #include "TGeoMaterial.h"
0014 
0015 Acts::MaterialSlab Acts::TGeoMaterialConverter::materialSlab(
0016     const TGeoMaterial& tgMaterial, ActsScalar thicknessIn,
0017     ActsScalar thicknessOut, const Options& options) {
0018   // Scalable properties
0019   ActsScalar matX0 = tgMaterial.GetRadLen();
0020   ActsScalar matL0 = tgMaterial.GetIntLen();
0021   ActsScalar matRho = tgMaterial.GetDensity();
0022 
0023   // X0, L0, rho scale with the thickness
0024   ActsScalar cFactor = thicknessIn / thicknessOut;
0025   ActsScalar uScalor = options.unitLengthScalor;
0026   ActsScalar rScalar =
0027       options.unitMassScalor / pow(options.unitLengthScalor, 3);
0028 
0029   auto material = Material::fromMassDensity(
0030       matX0 * uScalor / cFactor, matL0 * uScalor / cFactor, tgMaterial.GetA(),
0031       tgMaterial.GetZ(), matRho * rScalar * cFactor);
0032 
0033   return MaterialSlab(material, thicknessOut);
0034 }