Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:03

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : Ianna Osborne
0011 //
0012 //==========================================================================
0013 #ifndef DD4HEP_SPECPARREGISTRY_H
0014 #define DD4HEP_SPECPARREGISTRY_H
0015 
0016 #include <string>
0017 #include <string_view>
0018 #include <unordered_map>
0019 #include <vector>
0020 
0021 namespace dd4hep {
0022   using Paths = std::vector<std::string>;
0023   using PartSelectionMap = std::unordered_map<std::string, std::vector<std::string>>;
0024   using VectorsMap = std::unordered_map<std::string, std::vector<double>>;
0025 
0026   struct SpecPar {
0027     std::string_view strValue(const std::string&) const;
0028     bool hasValue(const std::string&) const;
0029     bool hasPath(const std::string&) const;
0030     double dblValue(const std::string&) const;
0031 
0032     template <typename T>
0033     T value(const std::string&) const;
0034 
0035     Paths paths;
0036     PartSelectionMap spars;
0037     VectorsMap numpars;
0038   };
0039 
0040   using SpecParMap = std::unordered_map<std::string, SpecPar>;
0041   using SpecParRefs = std::vector<std::pair<std::string, const SpecPar*>>;
0042 
0043   struct SpecParRegistry {
0044     void filter(SpecParRefs&, const std::string&, const std::string&) const;
0045     void filter(SpecParRefs&, const std::string&) const;
0046     std::vector<std::string_view> names() const;
0047     std::vector<std::string_view> names(const std::string& path) const;
0048     bool hasSpecPar(std::string_view) const;
0049     const SpecPar* specPar(std::string_view) const;
0050 
0051     SpecParMap specpars;
0052   };
0053 }  // namespace dd4hep
0054 
0055 #endif