Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:01

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 
0010 inline Acts::ActsExtension::ActsExtension(const std::string& axes) {
0011   addType("axes", "definitions", axes);
0012 }
0013 
0014 inline Acts::ActsExtension::ActsExtension(const ActsExtension& ext,
0015                                    const dd4hep::DetElement& /*elem*/)
0016     : m_flagStore(ext.m_flagStore), m_values(ext.m_values) {}
0017 
0018 inline double Acts::ActsExtension::getValue(const std::string& tag,
0019                                      const std::string& category) const
0020     noexcept(false) {
0021   return getT(m_values, tag, category);
0022 }
0023 
0024 inline void Acts::ActsExtension::addValue(double value, const std::string& tag,
0025                                    const std::string& category) {
0026   addT(m_values, value, tag, category, 0.0);
0027 }
0028 
0029 inline bool Acts::ActsExtension::hasCategory(const std::string& category) const {
0030   for (auto [key, value] : m_values) {
0031     if (key.find(category) != std::string::npos) {
0032       return true;
0033     }
0034   }
0035   return false;
0036 }
0037 
0038 inline bool Acts::ActsExtension::hasValue(const std::string& tag,
0039                                    const std::string& category) const {
0040   return hasT(m_values, tag, category);
0041 }
0042 
0043 inline bool Acts::ActsExtension::hasType(const std::string& type,
0044                                   const std::string& category) const {
0045   return hasT(m_flagStore, type, category);
0046 }
0047 
0048 inline void Acts::ActsExtension::addType(const std::string& type,
0049                                   const std::string& category,
0050                                   const std::string& word) {
0051   std::string catDec = "<-- category -->";
0052   addT(m_flagStore, word, type, category, catDec);
0053 }
0054 
0055 inline const std::string Acts::ActsExtension::getType(
0056     const std::string& type, const std::string& category) const
0057     noexcept(false) {
0058   return getT(m_flagStore, type, category);
0059 }
0060 
0061 inline std::string Acts::ActsExtension::toString() const {
0062   std::string rString = "--------------- Acts::ActsExtension --------------- ";
0063   rString += '\n';
0064   rString += "- flag store: ";
0065   rString += '\n';
0066   for (auto const& [key, value] : m_flagStore) {
0067     rString += key;
0068     rString += " : ";
0069     rString += value;
0070     rString += '\n';
0071   }
0072   rString += "- value store: ";
0073   rString += '\n';
0074   for (auto const& [key, value] : m_values) {
0075     rString += key;
0076     rString += " : ";
0077     rString += std::to_string(value);
0078     rString += '\n';
0079   }
0080   return rString;
0081 }