CMS 3D CMS Logo

DDAlgoArguments.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_DD_ALGO_ARGUMENTS_H
2 #define DETECTOR_DESCRIPTION_DD_ALGO_ARGUMENTS_H
3 
4 #include "XML/XML.h"
5 #include "DD4hep/DetElement.h"
9 
10 #include <map>
11 #include <sstream>
12 
13 namespace cms
14 {
15  using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>>;
16 
17  static constexpr long s_executed = 1l;
18 
19  constexpr unsigned int hash( const char* str, int h = 0 )
20  {
21  return !str[h] ? 5381 : ( hash( str, h+1 )*33 ) ^ str[h];
22  }
23 
24  inline unsigned int hash( const std::string& str )
25  {
26  return hash( str.c_str());
27  }
28 
29  dd4hep::Rotation3D makeRotation3D( double thetaX, double phiX,
30  double thetaY, double phiY,
31  double thetaZ, double phiZ );
32 
33  dd4hep::Rotation3D makeRotReflect( double thetaX, double phiX,
34  double thetaY, double phiY,
35  double thetaZ, double phiZ );
36 
37  dd4hep::Rotation3D makeRotation3D( dd4hep::Rotation3D rotation,
38  const std::string& axis, double angle );
39 
41  {
42  public:
44 
45  DDAlgoArguments() = delete;
46  DDAlgoArguments( const DDAlgoArguments& copy ) = delete;
47  DDAlgoArguments& operator=( const DDAlgoArguments& copy ) = delete;
48  ~DDAlgoArguments() = default;
49 
52  xml_h element;
53 
54  std::string parentName() const;
55  std::string childName() const;
56  bool find( const std::string& name ) const;
57  template<typename T> T value( const std::string& name ) const;
58  std::string str( const std::string& nam ) const;
59  double dble( const std::string& nam ) const;
60  int integer( const std::string& nam ) const;
61  std::vector<double> vecDble( const std::string& nam ) const;
62  std::vector<int> vecInt( const std::string& nam ) const;
63  std::vector<std::string> vecStr( const std::string& nam ) const;
64 
65  private:
66 
67  xml_h rawArgument( const std::string& name ) const;
68  std::string resolved_scalar_arg( const std::string& name ) const;
69  };
70 }
71 
72 #endif
std::string childName() const
Access value of child&#39;name from the xml element.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
def copy(args, dbName)
T value(const std::string &name) const
int integer(const std::string &nam) const
Shortcut to access integer arguments.
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.
static constexpr long s_executed
~DDAlgoArguments()=default
dd4hep::Rotation3D makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
constexpr unsigned int hash(const char *str, int h=0)
Namespace of DDCMS conversion namespace.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
DDAlgoArguments & operator=(const DDAlgoArguments &copy)=delete
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
cms::DDParsingContext & context
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
#define str(s)
bool find(const std::string &name) const
Check the existence of an argument by name.
long double T
std::vector< int > vecInt(const std::string &nam) const
Shortcut to access vector<int> arguments.
std::string resolved_scalar_arg(const std::string &name) const
Access namespace resolved argument as a string by name.
std::string parentName() const
Access value of rParent child node.
#define constexpr
std::string str(const std::string &nam) const
Shortcut to access string arguments.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11