3 from helpers
import dd4hepEnabled
5 from common
import getOpenDataDetectorDirectory
12 __tracebackhide__ =
True
19 geo.visitSurfaces(visit)
25 if srf.geometryId().volume()
in [28, 30, 23, 25, 16, 18]:
26 assert srf.geometryId().extra() != 0
31 detector, geo, contextDecorators = acts.examples.GenericDetector.create()
32 assert detector
is not None
33 assert geo
is not None
34 assert contextDecorators
is not None
42 detector, geo, contextDecorators = acts.examples.TelescopeDetector.create(
44 positions=[10 * i
for i
in range(n_surfaces)],
45 stereos=[0] * n_surfaces,
49 assert detector
is not None
50 assert geo
is not None
51 assert contextDecorators
is not None
56 @pytest.mark.skipif(
not dd4hepEnabled, reason=
"DD4hep is not set up")
58 config = acts.MaterialMapJsonConverter.Config()
59 matDeco = acts.JsonMaterialDecorator(
64 level=acts.logging.WARNING,
69 geo.visitSurfaces(check_extra_odd)
75 detector, geo, deco = acts.examples.AlignedDetector.create()
77 assert detector
is not None
78 assert geo
is not None
79 assert deco
is not None
92 return self.lower == other.lower
and self.upper == other.upper
94 monkeypatch.setattr(Interval,
"__eq__", eq)
96 LayerTriplet = TGeoDetector.Config.LayerTriplet
97 c = TGeoDetector.Config
99 def assert_combinations(value, _type):
100 t = LayerTriplet(value)
101 assert t.negative == value
and t.central == value
and t.positive == value
102 assert isinstance(t, _type)
104 keys = [
"negative",
"central",
"positive"]
107 [(k,)
for k
in keys] + list(itertools.combinations(keys, 2)) + [keys]
110 for c
in combinations:
111 d = {k: value
for k
in c}
113 t = LayerTriplet(**d)
114 assert isinstance(t, _type)
116 assert getattr(t, k) == value
118 v = [
"Some::SensorName"]
119 assert_combinations(v, c.LayerTripletVectorString)
121 with pytest.raises(TypeError):
122 LayerTriplet([
"Some::SensorName", 848])
124 with pytest.raises(TypeError):
125 LayerTriplet((
"Some::SensorName", 848))
127 for v
in (
True,
False):
128 assert_combinations(v, c.LayerTripletBool)
130 assert_combinations(
"hallo", c.LayerTripletString)
132 assert_combinations(5.3, c.LayerTripletDouble)
134 assert_combinations(
Interval(5.0, 9.0), c.LayerTripletInterval)
136 with pytest.raises(TypeError):
137 LayerTriplet((
"a", 9))
151 return self.lower == other.lower
and self.upper == other.upper
153 monkeypatch.setattr(Interval,
"__eq__", eq)
155 Volume = TGeoDetector.Config.Volume
157 v = Volume(name=
"blubb")
160 for key
in (
"binToleranceR",
"binToleranceZ",
"binTolerancePhi"):
162 assert getattr(v, key) ==
Interval(4, 5)
164 v = Volume(**{key: (4, 5)})
165 assert getattr(v, key) ==
Interval(4, 5)
167 v = Volume(**{key: (
None, 5)})
168 assert getattr(v, key) ==
Interval(
None, 5)
170 v = Volume(**{key: (4,
None)})
171 assert getattr(v, key) ==
Interval(4,
None)