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