11#include "Acts/Material/ISurfaceMaterial.hpp"
12#include "Acts/Material/MaterialSlab.hpp"
14#include "TGeoManager.h"
15#include "TGeoMaterial.h"
16#include "TGeoMatrix.h"
17#include "TGeoMedium.h"
19#include "TGeoVolume.h"
24constexpr double kOuterRadius = 1.;
25constexpr double kWall = 0.0036;
26constexpr double kWireRadius = 0.0015;
27constexpr double kEps = 0.0001;
31void check(
bool condition,
const char* what) {
33 std::cout <<
"FAIL: " << what << std::endl;
40double meanX0(
double rmin,
double rmax,
const TGeoMaterial& material) {
41 return M_PI * (rmax * rmax - rmin * rmin) / (2. * kOuterRadius) /
45void testStrawMaterial() {
46 auto* manager =
new TGeoManager(
"strawGeometry",
"straws");
48 auto* mylar =
new TGeoMixture(
"mylar", 3, 1.39);
49 mylar->AddElement(1.008, 1., 0.042);
50 mylar->AddElement(12.01, 6., 0.625);
51 mylar->AddElement(16., 8., 0.333);
52 auto* gasMix =
new TGeoMixture(
"STTmix8020_1bar", 3, 0.001698);
53 gasMix->AddElement(39.948, 18., 0.78);
54 gasMix->AddElement(12.01, 6., 0.06);
55 gasMix->AddElement(15.9994, 8., 0.16);
56 auto* tungsten =
new TGeoMaterial(
"tungsten", 183.84, 74., 19.3);
57 auto* vacuum =
new TGeoMaterial(
"vacuum", 0., 0., 0.);
59 auto*
top = manager->MakeBox(
"cave",
new TGeoMedium(
"vacuum", 1, vacuum),
61 manager->SetTopVolume(top);
62 auto* layer = manager->MakeBox(
"layer",
new TGeoMedium(
"air", 2, vacuum),
63 300., 10., kOuterRadius + kEps);
64 auto* straw =
new TGeoVolume(
65 "straw",
new TGeoTube(kOuterRadius - kWall, kOuterRadius, 250.),
66 new TGeoMedium(
"mylar", 3, mylar));
67 auto* gas =
new TGeoVolume(
69 new TGeoTube(kWireRadius + kEps, kOuterRadius - kWall - kEps, 250.),
70 new TGeoMedium(
"STTmix8020_1bar", 4, gasMix));
71 auto* wire =
new TGeoVolume(
"wire",
new TGeoTube(0., kWireRadius, 250.),
72 new TGeoMedium(
"tungsten", 5, tungsten));
74 for (
int number = 1; number <= 2; ++number) {
76 new TGeoCombiTrans(0., 2. * kOuterRadius * (number - 1.5), 0.,
77 new TGeoRotation(
"r", 90., 90., 0.));
78 layer->AddNode(straw, 1001000 + number, placement);
79 layer->AddNode(gas, 1002000 + number, placement);
80 layer->AddNode(wire, 1003000 + number, placement);
82 top->AddNode(layer, 1,
new TGeoTranslation(0., 0., 8400.));
83 manager->CloseGeometry();
86 check(geometry.size() == 2,
"two straws");
87 const Acts::Surface* surface = geometry.surface(1002001);
88 check(surface !=
nullptr,
"straw surface found by detector ID");
89 if (surface ==
nullptr || surface->surfaceMaterial() ==
nullptr) {
90 check(
false,
"straw surface has material");
94 const double x0 = surface->surfaceMaterial()
95 ->materialSlab(Acts::Vector2::Zero())
97 const double expected =
98 meanX0(kOuterRadius - kWall, kOuterRadius, *mylar) +
99 meanX0(kWireRadius + kEps, kOuterRadius - kWall - kEps, *gasMix) +
100 meanX0(0., kWireRadius, *tungsten);
101 if (std::abs(x0 - expected) > 1e-3 * expected) {
102 std::cout <<
"straw material " << x0 <<
" X0, expected " << expected
105 check(std::abs(x0 - expected) < 1e-3 * expected,
106 "straw material is the mean path through wall, gas and wire");
108 check(x0 > 5.0e-4 && x0 < 5.5e-4,
"straw material is about 5.3e-4 X0");
117 std::cout <<
"All ACTS straw geometry tests passed" << std::endl;
119 return failures == 0 ? 0 : 1;