ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActsExtension.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ActsExtension.cpp
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 
10 
11 Acts::ActsExtension::ActsExtension(const std::string& axes) {
12  addType("axes", "definitions", axes);
13 }
14 
16  const dd4hep::DetElement& /*elem*/)
17  : m_flagStore(ext.m_flagStore), m_values(ext.m_values) {}
18 
19 double Acts::ActsExtension::getValue(const std::string& tag,
20  const std::string& category) const
21  noexcept(false) {
22  return getT(m_values, tag, category);
23 }
24 
25 void Acts::ActsExtension::addValue(double value, const std::string& tag,
26  const std::string& category) {
27  addT(m_values, value, tag, category, 0.0);
28 }
29 
30 bool Acts::ActsExtension::hasValue(const std::string& tag,
31  const std::string& category) const {
32  return hasT(m_values, tag, category);
33 }
34 
35 bool Acts::ActsExtension::hasType(const std::string& type,
36  const std::string& category) const {
37  return hasT(m_flagStore, type, category);
38 }
39 
40 void Acts::ActsExtension::addType(const std::string& type,
41  const std::string& category,
42  const std::string& word) {
43  std::string catDec = "<-- category -->";
44  addT(m_flagStore, word, type, category, catDec);
45 }
46 
47 const std::string Acts::ActsExtension::getType(
48  const std::string& type, const std::string& category) const
49  noexcept(false) {
50  return getT(m_flagStore, type, category);
51 }
52 
53 std::string Acts::ActsExtension::toString() const {
54  std::string rString = "--------------- Acts::ActsExtension --------------- ";
55  rString += '\n';
56  rString += "- flag store: ";
57  rString += '\n';
58  for (auto const& [key, value] : m_flagStore) {
59  rString += key;
60  rString += " : ";
61  rString += value;
62  rString += '\n';
63  }
64  rString += "- value store: ";
65  rString += '\n';
66  for (auto const& [key, value] : m_values) {
67  rString += key;
68  rString += " : ";
69  rString += std::to_string(value);
70  rString += '\n';
71  }
72  return rString;
73 }