Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BuildGenericDetector.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BuildGenericDetector.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
33 
34 #include <array>
35 #include <cmath>
36 #include <cstddef>
37 #include <iostream>
38 #include <list>
39 #include <memory>
40 #include <string>
41 #include <utility>
42 #include <vector>
43 
44 namespace Acts {
45 class TrackingGeometry;
46 class HomogeneousSurfaceMaterial;
47 class IMaterialDecorator;
48 class ISurfaceMaterial;
49 class ProtoSurfaceMaterial;
50 } // namespace Acts
51 
52 namespace ActsExamples {
53 namespace Generic {
54 
61 std::vector<Acts::Vector3> modulePositionsCylinder(
62  double radius, double zStagger, double moduleHalfLength, double lOverlap,
63  const std::pair<int, int>& binningSchema);
64 
71 std::vector<Acts::Vector3> modulePositionsRing(double z, double radius,
72  double phiStagger,
73  double phiSubStagger,
74  int nPhiBins);
75 
86 std::vector<std::vector<Acts::Vector3>> modulePositionsDisc(
87  double z, double ringStagger, std::vector<double> phiStagger,
88  std::vector<double> phiSubStagger, double innerRadius, double outerRadius,
89  const std::vector<size_t>& discBinning,
90  const std::vector<double>& moduleHalfLength);
91 
111 template <typename detector_element_t>
112 std::unique_ptr<const Acts::TrackingGeometry> buildDetector(
113  const typename detector_element_t::ContextType& gctxIn,
114  std::vector<std::vector<std::shared_ptr<detector_element_t>>>&
115  detectorStore,
116  size_t level,
117  std::shared_ptr<const Acts::IMaterialDecorator> matDecorator = nullptr,
118  bool protoMaterial = false,
121  Acts::Logging::Level volumeLLevel = Acts::Logging::INFO) {
122  using namespace Acts::UnitLiterals;
123 
124  using ProtoLayerCreator = ProtoLayerCreatorT<detector_element_t>;
125  using LayerBuilder = LayerBuilderT<detector_element_t>;
126 
127  // auto gctx = Acts::GeometryContext::make(gctxIn);
128  Acts::GeometryContext gctx{gctxIn};
129 
130  // configure surface array creator
132  auto surfaceArrayCreator = std::make_shared<const Acts::SurfaceArrayCreator>(
133  sacConfig, Acts::getDefaultLogger("SurfaceArrayCreator", surfaceLLevel));
134  // configure the layer creator that uses the surface array creator
136  lcConfig.surfaceArrayCreator = surfaceArrayCreator;
137  auto layerCreator = std::make_shared<const Acts::LayerCreator>(
138  lcConfig, Acts::getDefaultLogger("LayerCreator", layerLLevel));
139  // configure the layer array creator
141  auto layerArrayCreator = std::make_shared<const Acts::LayerArrayCreator>(
142  lacConfig, Acts::getDefaultLogger("LayerArrayCreator", layerLLevel));
143  // tracking volume array creator
145  auto tVolumeArrayCreator =
146  std::make_shared<const Acts::TrackingVolumeArrayCreator>(
147  tvacConfig,
148  Acts::getDefaultLogger("TrackingVolumeArrayCreator", volumeLLevel));
149  // configure the cylinder volume helper
151  cvhConfig.layerArrayCreator = layerArrayCreator;
152  cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
153  auto cylinderVolumeHelper =
154  std::make_shared<const Acts::CylinderVolumeHelper>(
155  cvhConfig,
156  Acts::getDefaultLogger("CylinderVolumeHelper", volumeLLevel));
157  //-------------------------------------------------------------------------------------
158  // vector of the volume builders
159  std::vector<std::shared_ptr<const Acts::ITrackingVolumeBuilder>>
160  volumeBuilders;
161 
162  // Prepare the proto material - in case it's designed to do so
163  // - cylindrical
164  Acts::BinUtility pCylinderUtility(10, -1, 1, Acts::closed, Acts::binPhi);
165  pCylinderUtility += Acts::BinUtility(10, -1, 1, Acts::open, Acts::binZ);
166  auto pCylinderMaterial =
167  std::make_shared<const Acts::ProtoSurfaceMaterial>(pCylinderUtility);
168  // - disc
169  Acts::BinUtility pDiscUtility(10, 0, 1, Acts::open, Acts::binR);
170  pDiscUtility += Acts::BinUtility(10, -1, 1, Acts::closed, Acts::binPhi);
171  auto pDiscMaterial =
172  std::make_shared<const Acts::ProtoSurfaceMaterial>(pDiscUtility);
173  // - plane
174  Acts::BinUtility pPlaneUtility(1, -1, 1, Acts::open, Acts::binX);
175  auto pPlaneMaterial =
176  std::make_shared<const Acts::ProtoSurfaceMaterial>(pPlaneUtility);
177 
178  //-------------------------------------------------------------------------------------
179  // Beam Pipe
180  //-------------------------------------------------------------------------------------
181  // BeamPipe material
182  const auto beryllium = Acts::Material::fromMassDensity(
183  352.8_mm, 407_mm, 9.012, 4.0, 1.848_g / 1_cm3);
184  std::shared_ptr<const Acts::ISurfaceMaterial> beamPipeMaterial =
185  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
186  Acts::MaterialSlab(beryllium, 0.8_mm));
187  if (protoMaterial) {
188  beamPipeMaterial = pCylinderMaterial;
189  }
190 
191  // configure the beam pipe layer builder
193  bplConfig.layerIdentification = "BeamPipe";
194  bplConfig.centralLayerRadii = std::vector<double>(1, 19.);
195  bplConfig.centralLayerHalflengthZ = std::vector<double>(1, 3000.);
196  bplConfig.centralLayerThickness = std::vector<double>(1, 0.8);
197  bplConfig.centralLayerMaterial = {beamPipeMaterial};
198  auto beamPipeBuilder = std::make_shared<const Acts::PassiveLayerBuilder>(
199  bplConfig, Acts::getDefaultLogger("BeamPipeLayerBuilder", layerLLevel));
200  // create the volume for the beam pipe
202  bpvConfig.trackingVolumeHelper = cylinderVolumeHelper;
203  bpvConfig.volumeName = "BeamPipe";
204  bpvConfig.layerBuilder = beamPipeBuilder;
205  bpvConfig.layerEnvelopeR = {1. * Acts::UnitConstants::mm,
207  bpvConfig.buildToRadiusZero = true;
208  bpvConfig.volumeSignature = 0;
209  auto beamPipeVolumeBuilder =
210  std::make_shared<const Acts::CylinderVolumeBuilder>(
211  bpvConfig,
212  Acts::getDefaultLogger("BeamPipeVolumeBuilder", volumeLLevel));
213  // add to the list of builders
214  volumeBuilders.push_back(beamPipeVolumeBuilder);
215 
216  //-------------------------------------------------------------------------------------
217  //-------------------------------------------------------------------------------------
218  // Pixel detector
219  //-------------------------------------------------------------------------------------
220  // some prep work
221  // envelope for layers
222  std::pair<double, double> pcEnvelope(2., 2.);
223 
224  double pCentralModuleT = 0.15;
225  double pEndcapModuleT = 0.15;
226 
227  // Module material properties - X0, L0, A, Z, Rho
228  // Acts::Material pcMaterial(95.7, 465.2, 28.03, 14., 2.32e-3);
229  const auto silicon = Acts::Material::fromMassDensity(95.7_mm, 465.2_mm, 28.03,
230  14., 2.32_g / 1_cm3);
231  Acts::MaterialSlab pcModuleMaterial(silicon, pCentralModuleT);
232  Acts::MaterialSlab peModuleMaterial(silicon, pEndcapModuleT);
233  // Layer material properties - thickness, X0, L0, A, Z, Rho
234  Acts::MaterialSlab pcmbProperties(silicon, 1.5_mm);
235  Acts::MaterialSlab pcmecProperties(silicon, 1.5_mm);
236 
237  // Module, central and disc material
238  std::shared_ptr<const Acts::ISurfaceMaterial> pCentralMaterial =
239  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(pcmbProperties);
240  std::shared_ptr<const Acts::ISurfaceMaterial> pEndcapMaterial =
241  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(pcmecProperties);
242  std::shared_ptr<const Acts::ISurfaceMaterial> pCentralModuleMaterial =
243  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
244  pcModuleMaterial);
245  std::shared_ptr<const Acts::ISurfaceMaterial> pEndcapModuleMaterial =
246  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
247  peModuleMaterial);
248  if (protoMaterial) {
249  pCentralMaterial = pCylinderMaterial;
250  pCentralModuleMaterial = pPlaneMaterial;
251  pEndcapMaterial = pDiscMaterial;
252  pEndcapModuleMaterial = pPlaneMaterial;
253  }
254 
255  // configure the pixel proto layer builder
256  typename ProtoLayerCreator::Config pplConfig;
257  // standard, an approach envelope
258  pplConfig.approachSurfaceEnvelope = 1.;
259  // BARREL :
260  // 4 pixel layers
261  // configure the central barrel
262  pplConfig.centralLayerBinMultipliers = {1, 1};
263  pplConfig.centralLayerRadii = {32., 72., 116., 172.};
264  pplConfig.centralLayerEnvelopes = {pcEnvelope, pcEnvelope, pcEnvelope,
265  pcEnvelope};
266  pplConfig.centralModuleBinningSchema = {
267  {16, 14}, {32, 14}, {52, 14}, {78, 14}};
268  pplConfig.centralModuleTiltPhi = {0.14, 0.14, 0.14, 0.14};
269  pplConfig.centralModuleHalfX = {8.4, 8.4, 8.4, 8.4};
270  pplConfig.centralModuleHalfY = {36., 36., 36., 36.};
271  pplConfig.centralModuleThickness = {pCentralModuleT, pCentralModuleT,
272  pCentralModuleT, pCentralModuleT};
273  pplConfig.centralModuleMaterial = {
274  pCentralModuleMaterial, pCentralModuleMaterial, pCentralModuleMaterial,
275  pCentralModuleMaterial};
276  // pitch definitions
277  pplConfig.centralModuleReadoutBinsX = {336, 336, 336, 336};
278  pplConfig.centralModuleReadoutBinsY = {1280, 1280, 1280, 1280};
279  pplConfig.centralModuleReadoutSide = {-1, -1, -1, -1};
280  pplConfig.centralModuleLorentzAngle = {0.12, 0.12, 0.12, 0.12};
281 
282  // no frontside/backside
283  pplConfig.centralModuleFrontsideStereo = {};
284  pplConfig.centralModuleBacksideStereo = {};
285  pplConfig.centralModuleBacksideGap = {};
286  // mPositions
287  std::vector<std::vector<Acts::Vector3>> pplCentralModulePositions;
288  for (size_t plb = 0; plb < pplConfig.centralLayerRadii.size(); ++plb) {
289  // call the helper function
290  pplCentralModulePositions.push_back(
291  modulePositionsCylinder(pplConfig.centralLayerRadii[plb],
292  0.5, // 1 mm stagger
293  pplConfig.centralModuleHalfY[plb],
294  2., // 4 mm module overlap in z
295  pplConfig.centralModuleBinningSchema[plb]));
296  }
297  pplConfig.centralModulePositions = pplCentralModulePositions;
298  // ENDCAP :
299  // 7 pixel layers each side
300  // configure the endcaps
301  pplConfig.posnegLayerBinMultipliers = {1, 1};
302 
303  pplConfig.posnegLayerPositionsZ = {
307  1500 * Acts::UnitConstants::mm};
308 
309  pplConfig.posnegLayerEnvelopeR = {
314  std::vector<double> perHX = {8.4, 8.4}; // half length x
315  std::vector<double> perHY = {36., 36.}; // half length y
316  std::vector<size_t> perBP = {40, 68}; // bins in phi
317  std::vector<double> perT = {pEndcapModuleT,
318  pEndcapModuleT}; // module thickness
319  std::vector<size_t> perBX = {336, 336}; // bins in x
320  std::vector<size_t> perBY = {1280, 1280}; // bins in y
321  std::vector<int> perRS = {-1, -1}; // readout side
322  std::vector<double> perLA = {0., 0.}; // lorentz angle
323  std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>> perM = {
324  pEndcapModuleMaterial, pEndcapModuleMaterial}; // material
325 
326  pplConfig.posnegModuleMinHalfX = std::vector<std::vector<double>>(7, perHX);
327  pplConfig.posnegModuleMaxHalfX = {};
328  pplConfig.posnegModuleHalfY = std::vector<std::vector<double>>(7, perHY);
329  pplConfig.posnegModulePhiBins = std::vector<std::vector<size_t>>(7, perBP);
330  pplConfig.posnegModuleThickness = std::vector<std::vector<double>>(7, perT);
331  pplConfig.posnegModuleReadoutBinsX =
332  std::vector<std::vector<size_t>>(7, perBX);
333  pplConfig.posnegModuleReadoutBinsY =
334  std::vector<std::vector<size_t>>(7, perBY);
335  pplConfig.posnegModuleReadoutSide = std::vector<std::vector<int>>(7, perRS);
336  pplConfig.posnegModuleLorentzAngle =
337  std::vector<std::vector<double>>(7, perLA);
338  pplConfig.posnegModuleMaterial =
339  std::vector<std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>>(
340  7, perM);
341 
342  // no frontside/backside
343  pplConfig.posnegModuleFrontsideStereo = {};
344  pplConfig.posnegModuleBacksideStereo = {};
345  pplConfig.posnegModuleBacksideGap = {};
346  // mPositions
347  std::vector<std::vector<std::vector<Acts::Vector3>>> pplPosnegModulePositions;
348  for (size_t id = 0; id < pplConfig.posnegLayerPositionsZ.size(); ++id) {
349  pplPosnegModulePositions.push_back(modulePositionsDisc(
350  pplConfig.posnegLayerPositionsZ[id], 0.0, {4.0, 4.0}, {0.5, 0.}, 30.,
351  176., pplConfig.posnegModulePhiBins[id],
352  pplConfig.posnegModuleHalfY[id]));
353  }
354  pplConfig.posnegModulePositions = pplPosnegModulePositions;
355 
357  ProtoLayerCreator pplCreator(
358  pplConfig, Acts::getDefaultLogger("PixelProtoLayerCreator", layerLLevel));
359 
360  // configure pixel layer builder
361  typename LayerBuilder::Config plbConfig;
362  plbConfig.layerCreator = layerCreator;
363  plbConfig.layerIdentification = "Pixel";
364  // material concentration alsways outside the modules
365  plbConfig.centralProtoLayers =
366  pplCreator.centralProtoLayers(gctx, detectorStore);
367  plbConfig.centralLayerMaterialConcentration = {1, 1, 1, 1};
368  plbConfig.centralLayerMaterial = {pCentralMaterial, pCentralMaterial,
369  pCentralMaterial, pCentralMaterial};
370  if (level > 0) {
371  // material concentration is always behind the layer in the pixels
372  plbConfig.posnegLayerMaterialConcentration = std::vector<int>(7, 0);
373  // layer structure surface has pixel material properties
374  plbConfig.posnegLayerMaterial = {
375  pEndcapMaterial, pEndcapMaterial, pEndcapMaterial, pEndcapMaterial,
376  pEndcapMaterial, pEndcapMaterial, pEndcapMaterial};
377  // negative proto layers
378  plbConfig.negativeProtoLayers =
379  pplCreator.negativeProtoLayers(gctx, detectorStore);
380  plbConfig.positiveProtoLayers =
381  pplCreator.positiveProtoLayers(gctx, detectorStore);
382  }
383  // define the builder
384  auto pixelLayerBuilder = std::make_shared<const LayerBuilder>(
385  plbConfig, Acts::getDefaultLogger("PixelLayerBuilder", layerLLevel));
386  //-------------------------------------------------------------------------------------
387  // build the pixel volume
389  pvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
390  pvbConfig.volumeName = "Pixel";
391  pvbConfig.buildToRadiusZero = false;
392  pvbConfig.layerEnvelopeR = {1. * Acts::UnitConstants::mm,
394  pvbConfig.layerBuilder = pixelLayerBuilder;
395  pvbConfig.volumeSignature = 0;
396  auto pixelVolumeBuilder = std::make_shared<const Acts::CylinderVolumeBuilder>(
397  pvbConfig, Acts::getDefaultLogger("PixelVolumeBuilder", volumeLLevel));
398  // add to the list of builders
399  volumeBuilders.push_back(pixelVolumeBuilder);
400 
401  if (level > 1) {
402  //-------------------------------------------------------------------------------------
403  //-------------------------------------------------------------------------------------
404  // Pixel Support Tybe (PST)
405  //-------------------------------------------------------------------------------------
406  // Material
407  std::shared_ptr<const Acts::ISurfaceMaterial> pstMaterial =
408  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
409  Acts::MaterialSlab(beryllium, 1.8_mm));
410  if (protoMaterial) {
411  pstMaterial = pCylinderMaterial;
412  }
413 
414  // Configuration
416  pstConfig.layerIdentification = "PST";
417  pstConfig.centralLayerRadii = std::vector<double>(1, 200.);
418  pstConfig.centralLayerHalflengthZ = std::vector<double>(1, 2800.);
419  pstConfig.centralLayerThickness = std::vector<double>(1, 1.8);
420  pstConfig.centralLayerMaterial = {pstMaterial};
421  auto pstBuilder = std::make_shared<const Acts::PassiveLayerBuilder>(
422  pstConfig, Acts::getDefaultLogger("PSTBuilder", layerLLevel));
423  // create the volume for the beam pipe
425  pstvolConfig.trackingVolumeHelper = cylinderVolumeHelper;
426  pstvolConfig.volumeName = "PST";
427  pstvolConfig.buildToRadiusZero = false;
428  pstvolConfig.layerBuilder = pstBuilder;
429  pstvolConfig.volumeSignature = 0;
430  auto pstVolumeBuilder = std::make_shared<const Acts::CylinderVolumeBuilder>(
431  pstvolConfig, Acts::getDefaultLogger("PSTVolumeBuilder", volumeLLevel));
432  // add to the detector builds
433  volumeBuilders.push_back(pstVolumeBuilder);
434 
435  //-------------------------------------------------------------------------------------
436  // SHORT strip detector
437  //-------------------------------------------------------------------------------------
438  // first add a Pixel Support Tube
439  // STRIPS
440  //
441  // fill necessary vectors for configuration
442  //-------------------------------------------------------------------------------------
443  // some prep work
444 
445  double ssCentralModuleT = 0.25;
446  double ssEndcapModuleT = 0.25;
447  // envelope double
448  std::pair<double, double> ssEnvelope(2., 2.);
449 
450  // Module material properties - X0, L0, A, Z, Rho
451  // Acts::Material sscMaterial(95.7, 465.2, 28.03, 14., 2.32e-3);
452  Acts::MaterialSlab sscModuleMaterial(silicon, ssCentralModuleT);
453  Acts::MaterialSlab sseModuleMaterial(silicon, ssEndcapModuleT);
454 
455  // Layer material properties - thickness, X0, L0, A, Z, Rho
456  Acts::MaterialSlab ssbmProperties(silicon, 2_mm);
457  Acts::MaterialSlab ssecmProperties(silicon, 2.5_mm);
458 
459  // Module, central and disc material
460  std::shared_ptr<const Acts::ISurfaceMaterial> ssCentralMaterial =
461  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
462  ssbmProperties);
463  std::shared_ptr<const Acts::ISurfaceMaterial> ssEndcapMaterial =
464  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
465  ssecmProperties);
466  std::shared_ptr<const Acts::ISurfaceMaterial> ssCentralModuleMaterial =
467  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
468  sscModuleMaterial);
469  std::shared_ptr<const Acts::ISurfaceMaterial> ssEndcapModuleMaterial =
470  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
471  sseModuleMaterial);
472  if (protoMaterial) {
473  ssCentralMaterial = pCylinderMaterial;
474  ssCentralModuleMaterial = pPlaneMaterial;
475  ssEndcapMaterial = pDiscMaterial;
476  ssEndcapModuleMaterial = pPlaneMaterial;
477  }
478 
479  // ----------------------------------------------------------------------------
480  // Configure the short strip proto layer builder
481  typename ProtoLayerCreator::Config ssplConfig;
482  // configure the central barrel
483  ssplConfig.centralLayerBinMultipliers = {1, 1};
484  ssplConfig.centralLayerRadii = {260., 360., 500., 660.};
485  ssplConfig.centralLayerEnvelopes = {ssEnvelope, ssEnvelope, ssEnvelope,
486  ssEnvelope};
487 
488  ssplConfig.centralModuleBinningSchema = {
489  {40, 21}, {56, 21}, {78, 21}, {102, 21}};
490  ssplConfig.centralModuleTiltPhi = {-0.15, -0.15, -0.15, -0.15};
491  ssplConfig.centralModuleHalfX = {24., 24., 24., 24.};
492  ssplConfig.centralModuleHalfY = {54., 54., 54., 54.};
493  ssplConfig.centralModuleThickness = {ssCentralModuleT, ssCentralModuleT,
494  ssCentralModuleT, ssCentralModuleT};
495 
496  ssplConfig.centralModuleReadoutBinsX = {600, 600, 600, 600}; // 80 um pitch
497  ssplConfig.centralModuleReadoutBinsY = {90, 90, 90, 90}; // 1.2 mm strixels
498  ssplConfig.centralModuleReadoutSide = {1, 1, 1, 1};
499  ssplConfig.centralModuleLorentzAngle = {0.12, 0.12, 0.12, 0.12};
500 
501  ssplConfig.centralModuleMaterial = {
502  ssCentralModuleMaterial, ssCentralModuleMaterial,
503  ssCentralModuleMaterial, ssCentralModuleMaterial};
504  ssplConfig.centralModuleFrontsideStereo = {};
505  ssplConfig.centralModuleBacksideStereo = {};
506  ssplConfig.centralModuleBacksideGap = {};
507  // mPositions
508  std::vector<std::vector<Acts::Vector3>> ssplCentralModulePositions;
509  for (size_t sslb = 0; sslb < ssplConfig.centralLayerRadii.size(); ++sslb) {
510  // call the helper function
511  ssplCentralModulePositions.push_back(
512  modulePositionsCylinder(ssplConfig.centralLayerRadii[sslb],
513  3., // 3 mm stagger
514  ssplConfig.centralModuleHalfY[sslb],
515  5., // 5 mm module overlap
516  ssplConfig.centralModuleBinningSchema[sslb]));
517  }
518  ssplConfig.centralModulePositions = ssplCentralModulePositions;
519 
520  // configure the endcaps
521  std::vector<double> mrMinHx = {16.4, 24.2, 32.2};
522  std::vector<double> mrMaxHx = {24.2, 32.2, 40.0};
523  std::vector<double> mrHy = {78., 78., 78.};
524 
525  // simplified strixels readout
526  std::vector<size_t> mrReadoutBinsX = {605, 805, 1000}; // 80 um pitch
527  std::vector<size_t> mrReadoutBinsY = {130, 130, 130}; // 1.2 mm strixels
528  std::vector<int> mrReadoutSide = {1, 1, 1};
529  std::vector<double> mrLorentzAngle = {0., 0., 0.};
530 
531  std::vector<size_t> mPhiBins = {54, 56, 60};
532  std::vector<double> mThickness = {ssEndcapModuleT, ssEndcapModuleT,
533  ssEndcapModuleT};
534  std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>> mMaterial = {
535  ssEndcapModuleMaterial, ssEndcapModuleMaterial, ssEndcapModuleMaterial};
536 
537  ssplConfig.posnegLayerBinMultipliers = {1, 2};
538 
539  ssplConfig.posnegLayerPositionsZ = {1220., 1500., 1800.,
540  2150., 2550., 2950.};
541  size_t nposnegs = ssplConfig.posnegLayerPositionsZ.size();
542  ssplConfig.posnegLayerEnvelopeR = std::vector<double>(nposnegs, 5.);
543 
544  ssplConfig.posnegModuleMinHalfX =
545  std::vector<std::vector<double>>(nposnegs, mrMinHx);
546  ssplConfig.posnegModuleMaxHalfX =
547  std::vector<std::vector<double>>(nposnegs, mrMaxHx);
548  ssplConfig.posnegModuleHalfY =
549  std::vector<std::vector<double>>(nposnegs, mrHy);
550  ssplConfig.posnegModulePhiBins =
551  std::vector<std::vector<size_t>>(nposnegs, mPhiBins);
552  ssplConfig.posnegModuleThickness =
553  std::vector<std::vector<double>>(nposnegs, mThickness);
554 
555  ssplConfig.posnegModuleReadoutBinsX =
556  std::vector<std::vector<size_t>>(nposnegs, mrReadoutBinsX);
557  ssplConfig.posnegModuleReadoutBinsY =
558  std::vector<std::vector<size_t>>(nposnegs, mrReadoutBinsY);
559  ssplConfig.posnegModuleReadoutSide =
560  std::vector<std::vector<int>>(nposnegs, mrReadoutSide);
561  ssplConfig.posnegModuleLorentzAngle =
562  std::vector<std::vector<double>>(nposnegs, mrLorentzAngle);
563 
564  ssplConfig.posnegModuleMaterial =
565  std::vector<std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>>(
566  nposnegs, mMaterial);
567 
568  ssplConfig.posnegModuleFrontsideStereo = {};
569  ssplConfig.posnegModuleBacksideStereo = {};
570  ssplConfig.posnegModuleBacksideGap = {};
571 
572  // mPositions
573  std::vector<std::vector<std::vector<Acts::Vector3>>>
574  ssplPosnegModulePositions;
575  for (size_t id = 0; id < ssplConfig.posnegLayerPositionsZ.size(); ++id) {
576  ssplPosnegModulePositions.push_back(modulePositionsDisc(
577  ssplConfig.posnegLayerPositionsZ[id], 6.0, {3., 3., 3.}, {0., 0., 0.},
578  240., 700., ssplConfig.posnegModulePhiBins[id],
579  ssplConfig.posnegModuleHalfY[id]));
580  }
581  ssplConfig.posnegModulePositions = ssplPosnegModulePositions;
582 
583  // The ProtoLayer creator
584  ProtoLayerCreator ssplCreator(
585  ssplConfig,
586  Acts::getDefaultLogger("SStripProtoLayerCreator", layerLLevel));
587 
588  // configure short strip layer builder
589  typename LayerBuilder::Config sslbConfig;
590  sslbConfig.layerCreator = layerCreator;
591  sslbConfig.layerIdentification = "SStrip";
592 
593  sslbConfig.centralProtoLayers =
594  ssplCreator.centralProtoLayers(gctx, detectorStore);
595  sslbConfig.centralLayerMaterialConcentration = {-1, -1, -1, -1};
596  sslbConfig.centralLayerMaterial = {ssCentralMaterial, ssCentralMaterial,
597  ssCentralMaterial, ssCentralMaterial};
598 
599  if (level > 2) {
600  sslbConfig.negativeProtoLayers =
601  ssplCreator.negativeProtoLayers(gctx, detectorStore);
602  sslbConfig.positiveProtoLayers =
603  ssplCreator.positiveProtoLayers(gctx, detectorStore);
604 
605  sslbConfig.posnegLayerMaterialConcentration =
606  std::vector<int>(nposnegs, 0);
607  sslbConfig.posnegLayerMaterial =
608  std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>(
609  nposnegs, ssEndcapMaterial);
610  }
611 
612  // define the builder
613  auto sstripLayerBuilder = std::make_shared<const LayerBuilder>(
614  sslbConfig, Acts::getDefaultLogger("SStripLayerBuilder", layerLLevel));
615  //-------------------------------------------------------------------------------------
616  // build the pixel volume
618  ssvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
619  ssvbConfig.volumeName = "SStrip";
620  ssvbConfig.buildToRadiusZero = false;
621  ssvbConfig.layerBuilder = sstripLayerBuilder;
622  ssvbConfig.volumeSignature = 0;
623  auto sstripVolumeBuilder =
624  std::make_shared<const Acts::CylinderVolumeBuilder>(
625  ssvbConfig,
626  Acts::getDefaultLogger("SStripVolumeBuilder", volumeLLevel));
627 
628  //-------------------------------------------------------------------------------------
629  // add to the list of builders
630  volumeBuilders.push_back(sstripVolumeBuilder);
631  //-------------------------------------------------------------------------------------
632  //-------------------------------------------------------------------------------------
633  // LONG strip detector
634  //-------------------------------------------------------------------------------------
635  // fill necessary vectors for configuration
636  //-------------------------------------------------------------------------------------
637 
638  // some prep work
639  // envelope double
640  std::pair<double, double> lsEnvelope(2., 2.);
641 
642  double lsCentralModuleT = 0.35;
643  double lsEndcapModuleT = 0.35;
644 
645  // Module material properties - X0, L0, A, Z, Rho
646  // Acts::Material lsMaterial(95.7, 465.2, 28.03, 14., 2.32e-3);
647  Acts::MaterialSlab lscModuleMaterial(silicon, lsCentralModuleT);
648  Acts::MaterialSlab lseModuleMaterial(silicon, lsEndcapModuleT);
649 
650  // Layer material properties - thickness, X0, L0, A, Z, Rho - barrel
651  Acts::MaterialSlab lsbmProperties(silicon, 2.5_mm);
652  Acts::MaterialSlab lsecmProperties(silicon, 3.5_mm);
653 
654  // Module, central and disc material
655  std::shared_ptr<const Acts::ISurfaceMaterial> lsCentralMaterial =
656  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
657  lsbmProperties);
658  std::shared_ptr<const Acts::ISurfaceMaterial> lsEndcapMaterial =
659  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
660  lsecmProperties);
661  std::shared_ptr<const Acts::ISurfaceMaterial> lsCentralModuleMaterial =
662  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
663  lscModuleMaterial);
664  std::shared_ptr<const Acts::ISurfaceMaterial> lsEndcapModuleMaterial =
665  std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
666  lseModuleMaterial);
667  if (protoMaterial) {
668  lsCentralMaterial = pCylinderMaterial;
669  lsCentralModuleMaterial = pPlaneMaterial;
670  lsEndcapMaterial = pDiscMaterial;
671  lsEndcapModuleMaterial = pPlaneMaterial;
672  }
673 
674  // The proto layer creator
675  typename ProtoLayerCreator::Config lsplConfig;
676 
677  // configure the central barrel
678  lsplConfig.centralLayerBinMultipliers = {1, 1};
679  lsplConfig.centralLayerRadii = {820., 1020.};
680  lsplConfig.centralLayerEnvelopes = {lsEnvelope, lsEnvelope};
681 
682  lsplConfig.centralModuleBinningSchema = {{120, 21}, {152, 21}};
683  lsplConfig.centralModuleTiltPhi = {-0.15, -0.15};
684  lsplConfig.centralModuleHalfX = {24., 24.};
685  lsplConfig.centralModuleHalfY = {54., 54.};
686  lsplConfig.centralModuleThickness = {lsCentralModuleT, lsCentralModuleT};
687  lsplConfig.centralModuleMaterial = {lsCentralModuleMaterial,
688  lsCentralModuleMaterial};
689 
690  lsplConfig.centralModuleReadoutBinsX = {400, 400}; // 120 um pitch
691  lsplConfig.centralModuleReadoutBinsY = {10, 10}; // 10 strips = 10.8 mm
692  lsplConfig.centralModuleReadoutSide = {1, 1};
693  lsplConfig.centralModuleLorentzAngle = {0.08, 0.08};
694 
695  lsplConfig.centralModuleFrontsideStereo = {};
696  lsplConfig.centralModuleBacksideStereo = {};
697  lsplConfig.centralModuleBacksideGap = {};
698  // mPositions
699  std::vector<std::vector<Acts::Vector3>> lslbCentralModulePositions;
700  for (size_t lslb = 0; lslb < lsplConfig.centralLayerRadii.size(); ++lslb) {
701  // call the helper function
702  lslbCentralModulePositions.push_back(
703  modulePositionsCylinder(lsplConfig.centralLayerRadii[lslb],
704  3., // 3 mm stagger
705  lsplConfig.centralModuleHalfY[lslb],
706  5., // 5 mm module overlap
707  lsplConfig.centralModuleBinningSchema[lslb]));
708  }
709 
710  lsplConfig.centralModulePositions = lslbCentralModulePositions;
711  // configure the endcaps
712  mrMinHx = {54., 66.};
713  mrMaxHx = {64.2, 72.};
714  mrHy = {78., 78.};
715  mPhiBins = {48, 50};
716  mThickness = {lsEndcapModuleT, lsEndcapModuleT};
717  mMaterial = {lsEndcapModuleMaterial, lsEndcapModuleMaterial};
718 
719  mrReadoutBinsX = {1070, 1200}; // 120 um pitch
720  mrReadoutBinsY = {15, 15}; // 15 strips - 10.2 mm
721  mrReadoutSide = {1, 1};
722  mrLorentzAngle = {0., 0.};
723 
724  // endcap
725  lsplConfig.posnegLayerBinMultipliers = {1, 2};
726  lsplConfig.posnegLayerPositionsZ = {1220., 1500., 1800.,
727  2150., 2550., 2950.};
728  nposnegs = lsplConfig.posnegLayerPositionsZ.size();
729  lsplConfig.posnegLayerEnvelopeR = std::vector<double>(nposnegs, 5.);
730 
731  lsplConfig.posnegModuleMinHalfX =
732  std::vector<std::vector<double>>(nposnegs, mrMinHx);
733  lsplConfig.posnegModuleMaxHalfX =
734  std::vector<std::vector<double>>(nposnegs, mrMaxHx);
735  lsplConfig.posnegModuleHalfY =
736  std::vector<std::vector<double>>(nposnegs, mrHy);
737  lsplConfig.posnegModulePhiBins =
738  std::vector<std::vector<size_t>>(nposnegs, mPhiBins);
739  lsplConfig.posnegModuleThickness =
740  std::vector<std::vector<double>>(nposnegs, mThickness);
741 
742  lsplConfig.posnegModuleReadoutBinsX =
743  std::vector<std::vector<size_t>>(nposnegs, mrReadoutBinsX);
744  lsplConfig.posnegModuleReadoutBinsY =
745  std::vector<std::vector<size_t>>(nposnegs, mrReadoutBinsY);
746  lsplConfig.posnegModuleReadoutSide =
747  std::vector<std::vector<int>>(nposnegs, mrReadoutSide);
748  lsplConfig.posnegModuleLorentzAngle =
749  std::vector<std::vector<double>>(nposnegs, mrLorentzAngle);
750 
751  lsplConfig.posnegModuleMaterial =
752  std::vector<std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>>(
753  nposnegs, mMaterial);
754  lsplConfig.posnegModuleFrontsideStereo = {};
755  lsplConfig.posnegModuleBacksideStereo = {};
756  lsplConfig.posnegModuleBacksideGap = {};
757 
758  // mPositions
759  std::vector<std::vector<std::vector<Acts::Vector3>>>
760  lssbPosnegModulePositions;
761  for (size_t id = 0; id < lsplConfig.posnegLayerPositionsZ.size(); ++id) {
762  lssbPosnegModulePositions.push_back(modulePositionsDisc(
763  lsplConfig.posnegLayerPositionsZ[id],
764  8.0, // staggering of rings, we put the disk structure in between
765  {3., 3.}, {0., 0.}, 750., 1020., lsplConfig.posnegModulePhiBins[id],
766  lsplConfig.posnegModuleHalfY[id]));
767  }
768  lsplConfig.posnegModulePositions = lssbPosnegModulePositions;
769 
770  // The ProtoLayer creator
771  ProtoLayerCreator lsplCreator(
772  lsplConfig,
773  Acts::getDefaultLogger("LStripProtoLayerCreator", layerLLevel));
774 
775  // configure short strip layer builder
776  typename LayerBuilder::Config lslbConfig;
777  lslbConfig.layerCreator = layerCreator;
778  lslbConfig.layerIdentification = "LStrip";
779  lslbConfig.centralLayerMaterialConcentration = {-1, -1};
780  lslbConfig.centralLayerMaterial = {lsCentralMaterial, lsCentralMaterial};
781  lslbConfig.centralProtoLayers =
782  lsplCreator.centralProtoLayers(gctx, detectorStore);
783 
784  if (level > 2) {
785  lslbConfig.posnegLayerMaterialConcentration =
786  std::vector<int>(nposnegs, 0);
787  lslbConfig.posnegLayerMaterial =
788  std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>(
789  nposnegs, lsEndcapMaterial);
790  lslbConfig.negativeProtoLayers =
791  lsplCreator.negativeProtoLayers(gctx, detectorStore);
792  lslbConfig.positiveProtoLayers =
793  lsplCreator.positiveProtoLayers(gctx, detectorStore);
794  }
795 
796  // define the builder
797  auto lstripLayerBuilder = std::make_shared<const LayerBuilder>(
798  lslbConfig, Acts::getDefaultLogger("LStripLayerBuilder", layerLLevel));
799  //-------------------------------------------------------------------------------------
800  // build the pixel volume
802  lsvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
803  lsvbConfig.volumeName = "LStrip";
804  lsvbConfig.buildToRadiusZero = false;
805  lsvbConfig.layerBuilder = lstripLayerBuilder;
806  lsvbConfig.volumeSignature = 0;
807  auto lstripVolumeBuilder =
808  std::make_shared<const Acts::CylinderVolumeBuilder>(
809  lsvbConfig,
810  Acts::getDefaultLogger("LStripVolumeBuilder", volumeLLevel));
811  // add to the list of builders
812  volumeBuilders.push_back(lstripVolumeBuilder);
813  }
814 
815  //-------------------------------------------------------------------------------------
816  // create the tracking geometry
818  // Add the build call functions
819  for (auto& vb : volumeBuilders) {
820  tgConfig.trackingVolumeBuilders.push_back(
821  [=](const auto& context, const auto& inner, const auto&) {
822  return vb->trackingVolume(context, inner);
823  });
824  }
825  tgConfig.trackingVolumeHelper = cylinderVolumeHelper;
826  tgConfig.materialDecorator = std::move(matDecorator);
827 
828  auto cylinderGeometryBuilder =
829  std::make_shared<const Acts::TrackingGeometryBuilder>(
830  tgConfig,
831  Acts::getDefaultLogger("TrackerGeometryBuilder", volumeLLevel));
832  // get the geometry
833  auto trackingGeometry = cylinderGeometryBuilder->trackingGeometry(gctx);
835  return trackingGeometry;
836 }
837 
838 } // end of namespace Generic
839 } // end of namespace ActsExamples