DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
SpecParRegistry.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : Ianna Osborne
11 //
12 //==========================================================================
13 #ifndef DD4HEP_SPECPARREGISTRY_H
14 #define DD4HEP_SPECPARREGISTRY_H
15 
16 #include <string>
17 #include <string_view>
18 #include <unordered_map>
19 #include <vector>
20 
21 namespace dd4hep {
22  using Paths = std::vector<std::string>;
23  using PartSelectionMap = std::unordered_map<std::string, std::vector<std::string>>;
24  using VectorsMap = std::unordered_map<std::string, std::vector<double>>;
25 
26  struct SpecPar {
27  std::string_view strValue(const std::string&) const;
28  bool hasValue(const std::string&) const;
29  bool hasPath(const std::string&) const;
30  double dblValue(const std::string&) const;
31 
32  template <typename T>
33  T value(const std::string&) const;
34 
38  };
39 
40  using SpecParMap = std::unordered_map<std::string, SpecPar>;
41  using SpecParRefs = std::vector<std::pair<std::string, const SpecPar*>>;
42 
43  struct SpecParRegistry {
44  void filter(SpecParRefs&, const std::string&, const std::string&) const;
45  void filter(SpecParRefs&, const std::string&) const;
46  std::vector<std::string_view> names() const;
47  std::vector<std::string_view> names(const std::string& path) const;
48  bool hasSpecPar(std::string_view) const;
49  const SpecPar* specPar(std::string_view) const;
50 
52  };
53 } // namespace dd4hep
54 
55 #endif
dd4hep::SpecParMap
std::unordered_map< std::string, SpecPar > SpecParMap
Definition: SpecParRegistry.h:40
dd4hep::SpecPar::numpars
VectorsMap numpars
Definition: SpecParRegistry.h:37
dd4hep::SpecParRegistry::filter
void filter(SpecParRefs &, const std::string &, const std::string &) const
Definition: SpecParRegistry.cpp:111
dd4hep::VectorsMap
std::unordered_map< std::string, std::vector< double > > VectorsMap
Definition: SpecParRegistry.h:24
dd4hep::SpecPar::spars
PartSelectionMap spars
Definition: SpecParRegistry.h:36
dd4hep::SpecParRegistry::names
std::vector< std::string_view > names() const
Definition: SpecParRegistry.cpp:151
dd4hep::SpecParRegistry::specPar
const SpecPar * specPar(std::string_view) const
Definition: SpecParRegistry.cpp:166
dd4hep::SpecPar::paths
Paths paths
Definition: SpecParRegistry.h:35
dd4hep::SpecPar::hasValue
bool hasValue(const std::string &) const
Definition: SpecParRegistry.cpp:30
dd4hep::SpecParRegistry::specpars
SpecParMap specpars
Definition: SpecParRegistry.h:51
dd4hep::SpecPar::strValue
std::string_view strValue(const std::string &) const
Definition: SpecParRegistry.cpp:23
dd4hep::SpecParRegistry
Definition: SpecParRegistry.h:43
dd4hep::PartSelectionMap
std::unordered_map< std::string, std::vector< std::string > > PartSelectionMap
Definition: SpecParRegistry.h:23
dd4hep::SpecParRefs
std::vector< std::pair< std::string, const SpecPar * > > SpecParRefs
Definition: SpecParRegistry.h:41
dd4hep::SpecPar::dblValue
double dblValue(const std::string &) const
Definition: SpecParRegistry.cpp:104
dd4hep::SpecPar::value
T value(const std::string &) const
dd4hep::SpecPar::hasPath
bool hasPath(const std::string &) const
Definition: SpecParRegistry.cpp:37
dd4hep::Paths
std::vector< std::string > Paths
Definition: SpecParRegistry.h:22
dd4hep::SpecPar
Definition: SpecParRegistry.h:26
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::SpecParRegistry::hasSpecPar
bool hasSpecPar(std::string_view) const
Definition: SpecParRegistry.cpp:157