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  using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>>;
15 
16  static constexpr long s_executed = 1l;
17 
18  constexpr unsigned int hash(const char* str, int h = 0) { return !str[h] ? 5381 : (hash(str, h + 1) * 33) ^ str[h]; }
19 
20  inline unsigned int hash(const std::string& str) { return hash(str.c_str()); }
21 
22  dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
23 
24  dd4hep::Rotation3D makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
25 
26  dd4hep::Rotation3D makeRotation3D(dd4hep::Rotation3D rotation, const std::string& axis, double angle);
27 
29  public:
31 
32  DDAlgoArguments() = delete;
33  DDAlgoArguments(const DDAlgoArguments& copy) = delete;
35  ~DDAlgoArguments() = default;
36 
39  xml_h element;
40 
41  std::string parentName() const;
42  std::string childName() const;
43  bool find(const std::string& name) const;
44  template <typename T>
45  T value(const std::string& name) const;
46  std::string str(const std::string& nam) const;
47  double dble(const std::string& nam) const;
48  int integer(const std::string& nam) const;
49  std::vector<double> vecDble(const std::string& nam) const;
50  std::vector<int> vecInt(const std::string& nam) const;
51  std::vector<std::string> vecStr(const std::string& nam) const;
53 
54  private:
55  xml_h rawArgument(const std::string& name) const;
57  };
58 } // namespace cms
59 
60 #endif
cms::DDAlgoArguments::find
bool find(const std::string &name) const
Check the existence of an argument by name.
Definition: DDAlgoArguments.cc:118
cms::DDAlgoArguments::resolved_scalar_arg
std::string resolved_scalar_arg(const std::string &name) const
Access namespace resolved argument as a string by name.
Definition: DDAlgoArguments.cc:141
cms::DDAlgoArguments::integer
int integer(const std::string &nam) const
Shortcut to access integer arguments.
Definition: DDAlgoArguments.cc:339
cms::DDAlgoArguments::vecDble
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
Definition: DDAlgoArguments.cc:342
cms::hash
constexpr unsigned int hash(const char *str, int h=0)
Definition: DDAlgoArguments.h:18
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDParsingContext.h
cms::DDAlgoArguments::operator=
DDAlgoArguments & operator=(const DDAlgoArguments &copy)=delete
cms::DDParsingContext
Definition: DDParsingContext.h:14
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
cms::DDAlgoArguments::resolveValue
std::string resolveValue(const std::string &value) const
Definition: DDAlgoArguments.cc:148
cms::makeRotation3D
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:20
cms::DDAlgoArguments::str
std::string str(const std::string &nam) const
Shortcut to access string arguments.
Definition: DDAlgoArguments.cc:333
cms::DDAlgoArguments::name
std::string name
Definition: DDAlgoArguments.h:37
cms::DDAlgoArguments::value
T value(const std::string &name) const
DDXMLTags.h
str
#define str(s)
Definition: TestProcessor.cc:48
h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
cms::DDAlgoArguments::vecInt
std::vector< int > vecInt(const std::string &nam) const
Shortcut to access vector<int> arguments.
Definition: DDAlgoArguments.cc:345
cms::DDAlgoArguments::~DDAlgoArguments
~DDAlgoArguments()=default
qcdUeDQM_cfi.algorithm
algorithm
Definition: qcdUeDQM_cfi.py:32
cms::DDAlgoArguments::parentName
std::string parentName() const
Access value of rParent child node.
Definition: DDAlgoArguments.cc:104
value
Definition: value.py:1
cms::DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: DDAlgoArguments.h:14
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
DOFs::thetaY
Definition: AlignPCLThresholdsWriter.cc:37
cms::DDAlgoArguments::context
cms::DDParsingContext & context
Definition: DDAlgoArguments.h:38
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
cms::s_executed
static constexpr long s_executed
Definition: DDAlgoArguments.h:16
DOFs::thetaX
Definition: AlignPCLThresholdsWriter.cc:37
cms::DDAlgoArguments::DDAlgoArguments
DDAlgoArguments()=delete
cms::DDAlgoArguments::rawArgument
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.
Definition: DDAlgoArguments.cc:129
T
long double T
Definition: Basic3DVectorLD.h:48
DOFs::thetaZ
Definition: AlignPCLThresholdsWriter.cc:37
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
DDNamespace.h
cms::DDAlgoArguments::element
xml_h element
Definition: DDAlgoArguments.h:39
cms::DDAlgoArguments::dble
double dble(const std::string &nam) const
Shortcut to access double arguments.
Definition: DDAlgoArguments.cc:336
cms::DDAlgoArguments::vecStr
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
Definition: DDAlgoArguments.cc:348
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
cms::makeRotReflect
dd4hep::Rotation3D makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
Definition: DDAlgoArguments.cc:32
cms::DDAlgoArguments::childName
std::string childName() const
Access value of child'name from the xml element.
Definition: DDAlgoArguments.cc:112