Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConvertDD4hepDetector.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ConvertDD4hepDetector.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-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 
20 
21 #include <algorithm>
22 #include <functional>
23 #include <memory>
24 #include <vector>
25 
26 #include <DD4hep/DetElement.h>
27 
28 namespace Acts {
29 class CylinderVolumeBuilder;
30 class CylinderVolumeHelper;
31 class IMaterialDecorator;
32 class Logger;
33 class TrackingGeometry;
34 
37 inline void sortDetElementsByID(std::vector<dd4hep::DetElement>& det) {
38  sort(det.begin(), det.end(),
39  [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) {
40  return (a.id() < b.id());
41  });
42 }
43 
96 
102 
103 std::unique_ptr<const TrackingGeometry> convertDD4hepDetector(
104  dd4hep::DetElement worldDetElement, const Logger& logger,
105  BinningType bTypePhi = equidistant, BinningType bTypeR = equidistant,
106  BinningType bTypeZ = equidistant, double layerEnvelopeR = UnitConstants::mm,
107  double layerEnvelopeZ = UnitConstants::mm,
108  double defaultLayerThickness = UnitConstants::fm,
109  const std::function<void(std::vector<dd4hep::DetElement>& detectors)>&
110  sortSubDetectors = sortDetElementsByID,
112  std::shared_ptr<const IMaterialDecorator> matDecorator = nullptr,
113  std::shared_ptr<const GeometryIdentifierHook> geometryIdentifierHook =
114  std::make_shared<GeometryIdentifierHook>());
115 
154 std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep(
155  dd4hep::DetElement subDetector, const Logger& logger,
156  BinningType bTypePhi = equidistant, BinningType bTypeR = equidistant,
157  BinningType bTypeZ = equidistant, double layerEnvelopeR = UnitConstants::mm,
158  double layerEnvelopeZ = UnitConstants::mm,
159  double defaultLayerThickness = UnitConstants::fm);
160 
163 std::shared_ptr<const CylinderVolumeHelper> cylinderVolumeHelper_dd4hep(
164  const Logger& logger);
165 
174 void collectSubDetectors_dd4hep(dd4hep::DetElement& detElement,
175  std::vector<dd4hep::DetElement>& subdetectors,
176  const Logger& logger);
177 
184 void collectCompounds_dd4hep(dd4hep::DetElement& detElement,
185  std::vector<dd4hep::DetElement>& compounds);
186 
193 void collectLayers_dd4hep(dd4hep::DetElement& detElement,
194  std::vector<dd4hep::DetElement>& layers,
195  const Logger& logger);
196 
197 } // namespace Acts