221 {
222 if (debug_) {
223 std::cout << "Building layout for the " << pvol->GetName() << " tracker"
224 << std::endl;
225 getAllDaughters(pvol);
226 }
227
228
229 Acts::Transform3 tracker_transform = GetTransform(*pvol);
230
231 G4LogicalVolume* l_vol = pvol->GetLogicalVolume();
232 for (G4int i = 0; i < l_vol->GetNoDaughters(); i++) {
233 std::string sln = l_vol->GetDaughter(i)->GetName();
234 if (sln.find(surfacename) != std::string::npos) {
235 G4VPhysicalVolume* _Component0Volume{nullptr};
236 G4VPhysicalVolume* _ActiveSensor{nullptr};
237 Acts::Transform3 ref1_transform = GetTransform(*(l_vol->GetDaughter(i)));
238 int SensorCopyNr = -999;
239
240
241
242 if (sln.find("axial") != std::string::npos ||
243 sln.find("stereo") != std::string::npos) {
244 _Component0Volume =
245 findDaughterByName(l_vol->GetDaughter(i),
246 "LDMXRecoilL14ModuleVolume_component0_physvol");
247 if (!_Component0Volume)
248 throw std::runtime_error(
249 "Could not find component0 volume for L14 Recoil");
250 _ActiveSensor = findDaughterByName(
251 _Component0Volume,
252 "LDMXRecoilL14ModuleVolume_component0Sensor0_physvol");
253
254 }
255
256
257
258 else if (sln.find("l5_sensor") != std::string::npos ||
259 sln.find("l6_sensor") != std::string::npos) {
260 _Component0Volume =
261 findDaughterByName(l_vol->GetDaughter(i),
262 "LDMXRecoilL56ModuleVolume_component0_physvol");
263 if (!_Component0Volume)
264 throw std::runtime_error(
265 "Could not find component0 volume for L56 Recoil");
266 _ActiveSensor = findDaughterByName(
267 _Component0Volume,
268 "LDMXRecoilL56ModuleVolume_component0Sensor0_physvol");
269 }
270
271
272
273 else if (sln.find("sensor_vol")) {
274 _ActiveSensor =
275 findDaughterByName(l_vol->GetDaughter(i), "active_sensor");
276 SensorCopyNr = l_vol->GetDaughter(i)->GetCopyNo();
277 }
278
279 else
280 throw std::runtime_error("Could not build recoil layout");
281
282 if (!_ActiveSensor)
283 throw std::runtime_error(
284 "Could not find ActiveSensor for recoil volume");
285
286 Acts::Transform3 ref2_transform = Acts::Transform3::Identity();
287
288 if (_Component0Volume)
289 ref2_transform = GetTransform(*(_Component0Volume));
290
291 std::shared_ptr<Acts::PlaneSurface> sensorSurface = GetSurface(
292 _ActiveSensor, tracker_transform * ref1_transform * ref2_transform);
293
294
295 if (sln == "recoil_l1_axial" || sln == "recoil_l1_stereo" ||
296 SensorCopyNr == 10 || SensorCopyNr == 20)
297 recoil_layout["recoil_tracker_L1"].push_back(sensorSurface);
298
299 if (sln == "recoil_l2_axial" || sln == "recoil_l2_stereo" ||
300 SensorCopyNr == 30 || SensorCopyNr == 40)
301 recoil_layout["recoil_tracker_L2"].push_back(sensorSurface);
302
303 if (sln == "recoil_l3_axial" || sln == "recoil_l3_stereo" ||
304 SensorCopyNr == 50 || SensorCopyNr == 60)
305 recoil_layout["recoil_tracker_L3"].push_back(sensorSurface);
306
307 if (sln == "recoil_l4_axial" || sln == "recoil_l4_stereo" ||
308 SensorCopyNr == 70 || SensorCopyNr == 80)
309 recoil_layout["recoil_tracker_L4"].push_back(sensorSurface);
310
311 if (sln == "recoil_l5_sensor1" || sln == "recoil_l5_sensor2" ||
312 sln == "recoil_l5_sensor3" || sln == "recoil_l5_sensor4" ||
313 sln == "recoil_l5_sensor5" || sln == "recoil_l5_sensor6" ||
314 sln == "recoil_l5_sensor7" || sln == "recoil_l5_sensor8" ||
315 sln == "recoil_l5_sensor9" || sln == "recoil_l5_sensor10" ||
316 (SensorCopyNr >= 90 && SensorCopyNr <= 99))
317
318 recoil_layout["recoil_tracker_L5"].push_back(sensorSurface);
319
320 if (sln == "recoil_l6_sensor1" || sln == "recoil_l6_sensor2" ||
321 sln == "recoil_l6_sensor3" || sln == "recoil_l6_sensor4" ||
322 sln == "recoil_l6_sensor5" || sln == "recoil_l6_sensor6" ||
323 sln == "recoil_l6_sensor7" || sln == "recoil_l6_sensor8" ||
324 sln == "recoil_l6_sensor9" || sln == "recoil_l6_sensor10" ||
325 (SensorCopyNr >= 100 && SensorCopyNr <= 109))
326 recoil_layout["recoil_tracker_L6"].push_back(sensorSurface);
327
328 }
329 }
330}