Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-16 22:52:23

0001 #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
0002 #include "DetectorDescription/Core/interface/DDutils.h"
0003 
0004 template <>
0005 HGCalStringToEnumParser<HGCalGeometryMode::GeometryMode>::HGCalStringToEnumParser() {
0006   enumMap["HGCalGeometryMode::Square"] = HGCalGeometryMode::Square;
0007   enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon;
0008   enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull;
0009   enumMap["HGCalGeometryMode::Hexagon8"] = HGCalGeometryMode::Hexagon8;
0010   enumMap["HGCalGeometryMode::Hexagon8Full"] = HGCalGeometryMode::Hexagon8Full;
0011   enumMap["HGCalGeometryMode::Trapezoid"] = HGCalGeometryMode::Trapezoid;
0012   enumMap["HGCalGeometryMode::Hexagon8File"] = HGCalGeometryMode::Hexagon8File;
0013   enumMap["HGCalGeometryMode::TrapezoidFile"] = HGCalGeometryMode::TrapezoidFile;
0014   enumMap["HGCalGeometryMode::Hexagon8Module"] = HGCalGeometryMode::Hexagon8Module;
0015   enumMap["HGCalGeometryMode::TrapezoidModule"] = HGCalGeometryMode::TrapezoidModule;
0016   enumMap["HGCalGeometryMode::Hexagon8Cassette"] = HGCalGeometryMode::Hexagon8Cassette;
0017   enumMap["HGCalGeometryMode::TrapezoidCassette"] = HGCalGeometryMode::TrapezoidCassette;
0018   enumMap["HGCalGeometryMode::Hexagon8CalibCell"] = HGCalGeometryMode::Hexagon8CalibCell;
0019   enumMap["HGCalGeometryMode::TrapezoidFineCell"] = HGCalGeometryMode::TrapezoidFineCell;
0020   enumMap["HGCalGeometryMode::Hexagon8FineCell"] = HGCalGeometryMode::Hexagon8FineCell;
0021 }
0022 
0023 template <>
0024 HGCalStringToEnumParser<HGCalGeometryMode::WaferMode>::HGCalStringToEnumParser() {
0025   enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra;
0026   enumMap["HGCalGeometryMode::ExtrudedPolygon"] = HGCalGeometryMode::ExtrudedPolygon;
0027 }
0028 
0029 HGCalGeometryMode::GeometryMode HGCalGeometryMode::getGeometryMode(const char* s, const DDsvalues_type& sv) {
0030   DDValue val(s);
0031   if (DDfetch(&sv, val)) {
0032     const std::vector<std::string>& fvec = val.strings();
0033     if (fvec.empty()) {
0034       throw cms::Exception("HGCalGeom") << "getGeometryMode::Failed to get " << s << " tag.";
0035     }
0036 
0037     HGCalStringToEnumParser<HGCalGeometryMode::GeometryMode> eparser;
0038     HGCalGeometryMode::GeometryMode result = (HGCalGeometryMode::GeometryMode)eparser.parseString(fvec[0]);
0039     return result;
0040   } else {
0041     throw cms::Exception("HGCalGeom") << "getGeometryMode::Failed to fetch " << s << " tag";
0042   }
0043 };
0044 
0045 HGCalGeometryMode::GeometryMode HGCalGeometryMode::getGeometryMode(const std::string& s) {
0046   HGCalStringToEnumParser<HGCalGeometryMode::GeometryMode> eparser;
0047   HGCalGeometryMode::GeometryMode result = (HGCalGeometryMode::GeometryMode)eparser.parseString(s);
0048   return result;
0049 };
0050 
0051 HGCalGeometryMode::WaferMode HGCalGeometryMode::getGeometryWaferMode(const char* s, const DDsvalues_type& sv) {
0052   DDValue val(s);
0053   if (DDfetch(&sv, val)) {
0054     const std::vector<std::string>& fvec = val.strings();
0055     if (fvec.empty()) {
0056       throw cms::Exception("HGCalGeom") << "getGeometryWaferMode::Failed to get " << s << " tag.";
0057     }
0058 
0059     HGCalStringToEnumParser<HGCalGeometryMode::WaferMode> eparser;
0060     HGCalGeometryMode::WaferMode result = (HGCalGeometryMode::WaferMode)eparser.parseString(fvec[0]);
0061     return result;
0062   } else {
0063     throw cms::Exception("HGCalGeom") << "getGeometryWaferMode::Failed to fetch " << s << " tag";
0064   }
0065 };
0066 
0067 HGCalGeometryMode::WaferMode HGCalGeometryMode::getGeometryWaferMode(std::string& s) {
0068   HGCalStringToEnumParser<HGCalGeometryMode::WaferMode> eparser;
0069   HGCalGeometryMode::WaferMode result = (HGCalGeometryMode::WaferMode)eparser.parseString(s);
0070   return result;
0071 };