Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:27

0001 #ifndef DetectorDescription_DDCMS_DDAlgoArguments_h
0002 #define DetectorDescription_DDCMS_DDAlgoArguments_h
0003 
0004 #include "XML/XML.h"
0005 #include "DetectorDescription/DDCMS/interface/DDXMLTags.h"
0006 #include "DetectorDescription/DDCMS/interface/DDNamespace.h"
0007 #include "DetectorDescription/DDCMS/interface/DDParsingContext.h"
0008 #include "DetectorDescription/DDCMS/interface/DDRotationMatrix.h"
0009 #include "DetectorDescription/DDCMS/interface/DDTranslation.h"
0010 
0011 #include <map>
0012 #include <sstream>
0013 
0014 namespace cms {
0015 
0016   static constexpr long s_executed = 1l;
0017 
0018   constexpr unsigned int hash(const char* str, int h = 0) { return !str[h] ? 5381 : (hash(str, h + 1) * 33) ^ str[h]; }
0019 
0020   inline unsigned int hash(const std::string& str) { return hash(str.c_str()); }
0021 
0022   DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
0023 
0024   DDRotationMatrix makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
0025 
0026   DDRotationMatrix makeRotation3D(DDRotationMatrix rotation, const std::string& axis, double angle);
0027 
0028   class DDAlgoArguments {
0029   public:
0030     DDAlgoArguments(cms::DDParsingContext&, xml_h algorithm);
0031 
0032     DDAlgoArguments() = delete;
0033     DDAlgoArguments(const DDAlgoArguments& copy) = delete;
0034     DDAlgoArguments& operator=(const DDAlgoArguments& copy) = delete;
0035     ~DDAlgoArguments() = default;
0036 
0037     std::string name;
0038     cms::DDParsingContext& context;
0039     xml_h element;
0040 
0041     std::string parentName() const;
0042     std::string childName() const;
0043     bool find(const std::string& name) const;
0044     template <typename T>
0045     T value(const std::string& name) const;
0046     std::string str(const std::string& nam) const;
0047     double dble(const std::string& nam) const;
0048     int integer(const std::string& nam) const;
0049     std::vector<double> vecDble(const std::string& nam) const;
0050     std::vector<float> vecFloat(const std::string& nam) const;
0051     std::vector<int> vecInt(const std::string& nam) const;
0052     std::vector<std::string> vecStr(const std::string& nam) const;
0053     std::string resolveValue(const std::string& value) const;
0054 
0055   private:
0056     xml_h rawArgument(const std::string& name) const;
0057     std::string resolved_scalar_arg(const std::string& name) const;
0058   };
0059 }  // namespace cms
0060 
0061 #endif