EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingGeometryBuilder.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackingGeometryBuilder.cpp
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 
10 // TrackingGeometryBuilder.cpp, Acts project
12 
14 
20 
21 #include <functional>
22 
25  std::unique_ptr<const Logger> logger)
26  : m_cfg(), m_logger(std::move(logger)) {
27  setConfiguration(cgbConfig);
28 }
29 
31  const Acts::TrackingGeometryBuilder::Config& cgbConfig) {
32  // @todo check consistency
33  // copy the configuration
34  m_cfg = cgbConfig;
35 }
36 
38  std::unique_ptr<const Logger> newLogger) {
39  m_logger = std::move(newLogger);
40 }
41 
42 std::unique_ptr<const Acts::TrackingGeometry>
44  const GeometryContext& gctx) const {
45  // the return geometry with the highest volume
46  std::unique_ptr<const TrackingGeometry> trackingGeometry;
47  MutableTrackingVolumePtr highestVolume = nullptr;
48  // loop over the builders and wrap one around the other
49  // -----------------------------
50  for (auto& volumeBuilder : m_cfg.trackingVolumeBuilders) {
51  // assign a new highest volume (and potentially wrap around the given
52  // highest volume so far)
53  highestVolume = volumeBuilder(gctx, highestVolume, nullptr);
54  } // --------------------------------------------------------------------------------
55 
56  // create the TrackingGeometry & decorate it with the material
57  if (highestVolume) {
58  // first check if we have material to get
59  const IMaterialDecorator* materialDecorator =
60  m_cfg.materialDecorator ? m_cfg.materialDecorator.get() : nullptr;
61  // build and set the TrackingGeometry
62  trackingGeometry.reset(
63  new TrackingGeometry(highestVolume, materialDecorator));
64  }
65  // return the geometry to the service
66  return (trackingGeometry);
67 }