ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LayerCreator.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file LayerCreator.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 
10 // LayerCreator.h, Acts project
12 
13 #pragma once
14 
21 
22 #include <optional>
23 
24 #ifndef ACTS_LAYERCREATOR_TAKESMALLERBIGGER
25 #define ACTS_LAYERCREATOR_TAKESMALLERBIGGER
26 #define takeSmaller(current, test) current = current < test ? current : test
27 #define takeBigger(current, test) current = current > test ? current : test
28 #define takeSmallerBigger(cSmallest, cBiggest, test) \
29  takeSmaller(cSmallest, test); \
30  takeBigger(cBiggest, test)
31 #endif
32 
33 namespace Acts {
34 
35 namespace Test {
36 struct LayerCreatorFixture;
37 }
38 class Surface;
39 class Layer;
40 using MutableLayerPtr = std::shared_ptr<Layer>;
41 
47 class LayerCreator {
48  public:
53  struct Config {
55  std::shared_ptr<const SurfaceArrayCreator> surfaceArrayCreator = nullptr;
57  double cylinderZtolerance{10.};
59  double cylinderPhiTolerance{0.1};
61  Config() = default;
62  };
63 
68  LayerCreator(const Config& lcConfig,
69  std::unique_ptr<const Logger> logger =
70  getDefaultLogger("LayerCreator", Logging::INFO));
71 
73  ~LayerCreator() = default;
74 
93  const GeometryContext& gctx,
94  std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi,
95  size_t binsZ, std::optional<ProtoLayer> _protoLayer = std::nullopt,
96  std::shared_ptr<const Transform3D> transform = nullptr,
97  std::unique_ptr<ApproachDescriptor> ad = nullptr) const;
98 
117  const GeometryContext& gctx,
118  std::vector<std::shared_ptr<const Surface>> surfaces,
119  BinningType bTypePhi, BinningType bTypeZ,
120  std::optional<ProtoLayer> _protoLayer = std::nullopt,
121  std::shared_ptr<const Transform3D> transform = nullptr,
122  std::unique_ptr<ApproachDescriptor> ad = nullptr) const;
123 
142  const GeometryContext& gctx,
143  std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR,
144  size_t binsPhi, std::optional<ProtoLayer> _protoLayer = std::nullopt,
145  std::shared_ptr<const Transform3D> transform = nullptr,
146  std::unique_ptr<ApproachDescriptor> ad = nullptr) const;
147 
166  const GeometryContext& gctx,
167  std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR,
168  BinningType bTypePhi,
169  std::optional<ProtoLayer> _protoLayer = std::nullopt,
170  std::shared_ptr<const Transform3D> transform = nullptr,
171  std::unique_ptr<ApproachDescriptor> ad = nullptr) const;
172 
195  const GeometryContext& gctx,
196  std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1,
197  size_t bins2, BinningValue bValue,
198  std::optional<ProtoLayer> _protoLayer = std::nullopt,
199  std::shared_ptr<const Transform3D> transform = nullptr,
200  std::unique_ptr<ApproachDescriptor> ad = nullptr) const;
201 
204  void setConfiguration(const Config& lcConfig);
205 
207  Config getConfiguration() const;
208 
211  void setLogger(std::unique_ptr<const Logger> newLogger);
212 
213  // associate surfaces contained by this layer to this layer
214  void associateSurfacesToLayer(Layer& layer) const;
215 
216  private:
222  bool checkBinning(const GeometryContext& gctx,
223  const SurfaceArray& sArray) const;
224 
227 
229  const Logger& logger() const { return *m_logger; }
230 
232  std::unique_ptr<const Logger> m_logger;
233 };
234 
236  return m_cfg;
237 }
238 
239 } // namespace Acts