File indexing completed on 2025-01-18 09:13:13
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/Plugins/TGeo/TGeoMaterialConverter.hpp"
0013 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0014
0015 #include <string>
0016 #include <vector>
0017
0018 #include "TGeoManager.h"
0019 #include "TGeoMaterial.h"
0020
0021 using namespace Acts::UnitLiterals;
0022
0023 namespace Acts::Test {
0024
0025 BOOST_AUTO_TEST_CASE(TGeoMaterialConverter_materialSlab) {
0026 new TGeoManager("gm", "garbage collector");
0027
0028 double A = 26.98;
0029 double Z = 13.;
0030 TGeoMaterial *mat = new TGeoMaterial("Al", A, Z, 2.7);
0031
0032
0033
0034 CHECK_CLOSE_ABS(mat->GetRadLen(), 8.85, 0.1_mm);
0035 CHECK_CLOSE_ABS(mat->GetIntLen(), 38.8, 0.1_mm);
0036
0037 Acts::TGeoMaterialConverter::Options options;
0038 options.unitLengthScalor = 1_cm;
0039 options.unitMassScalor = 1.;
0040
0041
0042 double tInX0 = 10_mm / (mat->GetRadLen() * options.unitLengthScalor);
0043 double tInL0 = 10_mm / (mat->GetIntLen() * options.unitLengthScalor);
0044 double rho = 2.7 * options.unitMassScalor / pow(options.unitLengthScalor, 3);
0045
0046 Acts::MaterialSlab slab_10_10 =
0047 Acts::TGeoMaterialConverter::materialSlab(*mat, 10_mm, 10_mm, options);
0048 CHECK_CLOSE_ABS(88.7_mm, slab_10_10.material().X0(), 0.1_mm);
0049 CHECK_CLOSE_ABS(388_mm, slab_10_10.material().L0(), 1_mm);
0050 CHECK_CLOSE_ABS(A, slab_10_10.material().Ar(), 1e-5);
0051 CHECK_CLOSE_ABS(Z, slab_10_10.material().Z(), 1e-5);
0052 CHECK_CLOSE_ABS(tInX0, slab_10_10.thicknessInX0(), 1e-5);
0053 CHECK_CLOSE_ABS(tInL0, slab_10_10.thicknessInL0(), 1e-5);
0054 CHECK_CLOSE_ABS(rho, slab_10_10.material().massDensity(), 1e-5);
0055
0056
0057 Acts::MaterialSlab slab_10_1 =
0058 Acts::TGeoMaterialConverter::materialSlab(*mat, 10_mm, 1_mm, options);
0059
0060 CHECK_CLOSE_ABS(8.87_mm, slab_10_1.material().X0(), 0.1_mm);
0061 CHECK_CLOSE_ABS(38.8_mm, slab_10_1.material().L0(), 1_mm);
0062
0063 CHECK_CLOSE_ABS(10 * rho, slab_10_1.material().massDensity(), 1e-5);
0064
0065 CHECK_CLOSE_ABS(A, slab_10_1.material().Ar(), 1e-5);
0066 CHECK_CLOSE_ABS(Z, slab_10_1.material().Z(), 1e-5);
0067
0068
0069 CHECK_CLOSE_ABS(tInX0, slab_10_1.thicknessInX0(), 1e-5);
0070 CHECK_CLOSE_ABS(tInL0, slab_10_1.thicknessInL0(), 1e-5);
0071
0072 CHECK_CLOSE_ABS(slab_10_10.material().massDensity() * slab_10_10.thickness(),
0073 slab_10_1.material().massDensity() * slab_10_1.thickness(),
0074 1e-5);
0075 }
0076
0077 }