81{
82
84
85
86 double enclosedInnerSectorHalflength = std::numeric_limits<float>::max();
87 double enclosedOuterRadius = 0.;
88 double enclosedInnerRadius = 0.;
89
90 if (innerVol) {
93
94
95 const Trk::CylinderVolumeBounds* innerDetectorBounds
96 =
dynamic_cast<const Trk::CylinderVolumeBounds*
>(&(innerVol->
volumeBounds()));
97 if (!innerDetectorBounds) std::abort();
98
99 enclosedInnerSectorHalflength = innerDetectorBounds->
halflengthZ();
100 enclosedOuterRadius = innerDetectorBounds->
outerRadius();
101 enclosedInnerRadius = innerDetectorBounds->
innerRadius();
102 }
103
104 float enclosedOuterSectorHalflength = std::numeric_limits<float>::max();
105
107 if (std::abs(bounds.second) < enclosedOuterSectorHalflength) {
108 enclosedOuterSectorHalflength = std::abs(bounds.second);
109 }
110 }
111
112
113
114 if (not innerVol) {
115
117 if (std::abs(bounds.second) < enclosedInnerSectorHalflength) {
118 enclosedInnerSectorHalflength = std::abs(bounds.second);
119 }
120 }
121
123 if (std::abs(bounds.second) == enclosedOuterSectorHalflength) {
124 if (bounds.first>enclosedOuterRadius)
125 enclosedOuterRadius=bounds.first;
126 }
127 }
128 }
129
131 << enclosedInnerSectorHalflength << "/" << enclosedInnerRadius
132 << " - " << enclosedOuterSectorHalflength << "/"
133 << enclosedOuterRadius);
134
135
136 std::vector<Trk::Layer*> negativeLayers;
137 std::vector<Trk::Layer*> positiveLayers;
138
139 std::unique_ptr<const std::vector<Trk::DiscLayer*> > discLayers =
m_layerBuilder->discLayers(ctx, whandle);
140
141 float maxZ = -9999.;
142 float minZ = 9999.;
143 float thickness = -9999;
144
145
146 if (discLayers && !discLayers->empty()){
147
148 for (const auto & discLayer : (*discLayers) ){
149
150 float zpos = discLayer->surfaceRepresentation().center().z();
151 if (zpos > 0) {
152 positiveLayers.push_back(discLayer);
153
154
155 maxZ = std::max(maxZ, zpos);
156 minZ = std::min(minZ, zpos);
157 thickness = std::max(thickness, float(discLayer->thickness()));
158 }
159 else {
160 negativeLayers.push_back(discLayer);
161 }
162 }
163 }
164
165 float envelope = thickness*0.5;
166 float minZ_HGTD = minZ-envelope;
167 float maxZ_HGTD = maxZ+envelope;
168 float maxZ_HGTDEnclosure = enclosedOuterSectorHalflength;
169
170
171 auto materialProperties = std::make_unique<Trk::Material>();
172
173 float zGapPos = 0.5*(minZ_HGTD+enclosedInnerSectorHalflength);
174 float gapHalfLengthZ = 0.5*(minZ_HGTD-enclosedInnerSectorHalflength);
175
176
178 auto negativeInnerGapBounds = std::make_shared<Trk::CylinderVolumeBounds>(enclosedInnerRadius,enclosedOuterRadius,gapHalfLengthZ);
179
180 Trk::TrackingVolume * negativeInnerGapVolume =
181 new Trk::TrackingVolume(std::move(negativeInnerGapTrans),
182 negativeInnerGapBounds,
183 *materialProperties,
184 nullptr, nullptr,
186
188 auto positiveInnerGapBounds = std::make_shared<Trk::CylinderVolumeBounds>(enclosedInnerRadius,enclosedOuterRadius,gapHalfLengthZ);
189
190 Trk::TrackingVolume * positiveInnerGapVolume =
191 new Trk::TrackingVolume(std::move(positiveInnerGapTrans),
192 std::move(positiveInnerGapBounds),
193 *materialProperties,
194 nullptr, nullptr,
196
197
198 if (not innerVol) {
199 auto idBounds = std::make_shared<Trk::CylinderVolumeBounds>(enclosedInnerRadius,
200 enclosedInnerSectorHalflength);
202
203 innerVol = new Trk::TrackingVolume(std::move(idTr), std::move(idBounds), *materialProperties,
204 nullptr, nullptr,
205 "HGTD::GapVolumes::DummyID");
206 }
207
208 std::vector<Trk::TrackingVolume*> inBufferVolumes;
209 inBufferVolumes.push_back(negativeInnerGapVolume);
210 inBufferVolumes.push_back(innerVol);
211 inBufferVolumes.push_back(positiveInnerGapVolume);
212
213 Trk::TrackingVolume* inDetEnclosed =
215 *materialProperties,
216 "HGTD::Container::EnclosedInnerDetector");
217
218
219
220 Trk::TrackingVolume* negativeVolume =
222 *materialProperties,
223 enclosedInnerRadius, enclosedOuterRadius,
224 -maxZ_HGTD, -minZ_HGTD,
227
228
229 Trk::TrackingVolume* positiveVolume =
231 *materialProperties,
232 enclosedInnerRadius, enclosedOuterRadius,
233 minZ_HGTD, maxZ_HGTD,
236
237
238 ATH_MSG_VERBOSE(
'\t' <<
'\t'<<
"Volumes have been created, now pack them into a triple.");
242
243
244 std::vector<Trk::TrackingVolume*> tripleVolumes;
245 tripleVolumes.push_back(negativeVolume);
246 tripleVolumes.push_back(inDetEnclosed);
247 tripleVolumes.push_back(positiveVolume);
248
249
250 Trk::TrackingVolume* tripleContainer =
252 *materialProperties,
256
258
259
261 *materialProperties,
262 enclosedInnerRadius,
263 enclosedOuterRadius,
264 -maxZ_HGTDEnclosure,
265 -maxZ_HGTD,
266 1,
267 false,
268 "HGTD::Gaps::NegativeEnclosure" +
m_layerBuilder->identification());
269
270
272 *materialProperties,
273 enclosedInnerRadius,
274 enclosedOuterRadius,
275 maxZ_HGTD,
276 maxZ_HGTDEnclosure,
277 1,
278 false,
279 "HGTD::Gaps::PositiveEnclosure" +
m_layerBuilder->identification());
280
281 std::vector<Trk::TrackingVolume*> enclosedVolumes;
282 enclosedVolumes.push_back(negativeEnclosure);
283 enclosedVolumes.push_back(tripleContainer);
284 enclosedVolumes.push_back(positiveEnclosure);
285
286 Trk::TrackingVolume* enclosedDetector =
288 *materialProperties,
292
294
295
296 auto hgtdTrackingGeometry = std::make_unique<Trk::TrackingGeometry>(enclosedDetector);
297
300 if (msgLvl(MSG::VERBOSE) && hgtdTrackingGeometry)
301 hgtdTrackingGeometry->printVolumeHierarchy(
msg(MSG::VERBOSE));
302
303 return hgtdTrackingGeometry;
304}
#define ATH_MSG_VERBOSE(x)
virtual Trk::GeometrySignature geometrySignature() const override
The unique signature.
double innerRadius() const
This method returns the inner radius.
double halflengthZ() const
This method returns the halflengthZ.
double outerRadius() const
This method returns the outer radius.
void registerColorCode(unsigned int icolor)
Register the color code.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
void screenDump(MsgStream &msg) const
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
static const Amg::Transform3D s_idTransform
idendity transformation
BinningType
, BinningOption & BinningAccess