Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-21 08:09:55

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/Plugins/Root/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, double thicknessIn, double thicknessOut,
0017     const Options& options) {
0018   // Scalable properties
0019   double matX0 = tgMaterial.GetRadLen();
0020   double matL0 = tgMaterial.GetIntLen();
0021   double matRho = tgMaterial.GetDensity();
0022 
0023   // X0, L0, rho scale with the thickness
0024   double cFactor = thicknessIn / thicknessOut;
0025   double uScalor = options.unitLengthScalor;
0026   double rScalar = options.unitMassScalor / pow(options.unitLengthScalor, 3);
0027 
0028   auto material =
0029       Material::fromMassDensity(static_cast<float>(matX0 * uScalor / cFactor),
0030                                 static_cast<float>(matL0 * uScalor / cFactor),
0031                                 static_cast<float>(tgMaterial.GetA()),
0032                                 static_cast<float>(tgMaterial.GetZ()),
0033                                 static_cast<float>(matRho * rScalar * cFactor));
0034 
0035   return MaterialSlab(material, static_cast<float>(thicknessOut));
0036 }