Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepTestsHelper.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepTestsHelper.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 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 
13 
14 #include <string>
15 
16 #include <DD4hep/DetFactoryHelper.h>
17 #include <DD4hep/Objects.h>
18 #include <XML/Utilities.h>
19 
20 using namespace std;
21 using namespace dd4hep;
22 
23 namespace Acts {
24 class Surface;
25 } // namespace Acts
26 
27 namespace DD4hepTestsHelper {
28 
35 template <typename T>
36 T& ensureExtension(dd4hep::DetElement& elt) {
37  T* ext = elt.extension<T>(false);
38  if (ext == nullptr) {
39  ext = new T();
40  }
41  elt.addExtension<T>(ext);
42  return *ext;
43 }
44 
51 Transform3D createTransform(const xml_comp_t& x_det_comp);
52 
60  const std::array<int, 2u>& axes = {0, 1});
61 
70  const Acts::Surface& surface,
71  const Acts::Transform3& ref);
72 
73 } // namespace DD4hepTestsHelper