ECCE @ 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 
13 #include <functional>
14 
21 
24  std::unique_ptr<const Logger> logger)
25  : m_cfg(), m_logger(std::move(logger)) {
26  setConfiguration(cgbConfig);
27 }
28 
30  const Acts::TrackingGeometryBuilder::Config& cgbConfig) {
31  // @todo check consistency
32  // copy the configuration
33  m_cfg = cgbConfig;
34 }
35 
37  std::unique_ptr<const Logger> newLogger) {
38  m_logger = std::move(newLogger);
39 }
40 
41 std::unique_ptr<const Acts::TrackingGeometry>
43  const GeometryContext& gctx) const {
44  // the return geometry with the highest volume
45  std::unique_ptr<const TrackingGeometry> trackingGeometry;
46  MutableTrackingVolumePtr highestVolume = nullptr;
47  // loop over the builders and wrap one around the other
48  // -----------------------------
49  for (auto& volumeBuilder : m_cfg.trackingVolumeBuilders) {
50  // assign a new highest volume (and potentially wrap around the given
51  // highest volume so far)
52  highestVolume = volumeBuilder(gctx, highestVolume, nullptr);
53  } // --------------------------------------------------------------------------------
54 
55  // create the TrackingGeometry & decorate it with the material
56  if (highestVolume) {
57  // first check if we have material to get
58  const IMaterialDecorator* materialDecorator =
59  m_cfg.materialDecorator ? m_cfg.materialDecorator.get() : nullptr;
60  // build and set the TrackingGeometry
61  trackingGeometry.reset(
62  new TrackingGeometry(highestVolume, materialDecorator));
63  }
64  // return the geometry to the service
65  return (trackingGeometry);
66 }