Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:53

0001 #ifndef Geometry_HGCalCommonData_HGCalGeometryMode_H
0002 #define Geometry_HGCalCommonData_HGCalGeometryMode_H
0003 
0004 #include <algorithm>
0005 #include <map>
0006 #include <string>
0007 #include "DetectorDescription/Core/interface/DDsvalues.h"
0008 #include "FWCore/Utilities/interface/Exception.h"
0009 
0010 template <typename T>
0011 class HGCalStringToEnumParser {
0012   std::map<std::string, T> enumMap;
0013 
0014 public:
0015   HGCalStringToEnumParser(void);
0016 
0017   T parseString(const std::string& value) {
0018     typename std::map<std::string, T>::const_iterator itr = enumMap.find(value);
0019     if (itr == enumMap.end())
0020       throw cms::Exception("Configuration") << "the value " << value << " is not defined.";
0021     return itr->second;
0022   }
0023 };
0024 
0025 namespace HGCalGeometryMode {
0026   enum GeometryMode {
0027     Square = 0,
0028     Hexagon = 1,
0029     HexagonFull = 2,
0030     Hexagon8 = 3,
0031     Hexagon8Full = 4,
0032     Trapezoid = 5,
0033     Hexagon8File = 6,
0034     TrapezoidFile = 7,
0035     Hexagon8Module = 8,
0036     TrapezoidModule = 9,
0037     Hexagon8Cassette = 10,
0038     TrapezoidCassette = 11,
0039     Hexagon8CalibCell = 12,
0040   };
0041 
0042   enum WaferMode { Polyhedra = 0, ExtrudedPolygon = 1 };
0043 
0044   // Gets Geometry mode
0045   GeometryMode getGeometryMode(const char* s, const DDsvalues_type& sv);
0046   GeometryMode getGeometryMode(const std::string& s);
0047   // Gets wafer mode
0048   WaferMode getGeometryWaferMode(const char* s, const DDsvalues_type& sv);
0049 
0050   WaferMode getGeometryWaferMode(std::string& s);
0051 };  // namespace HGCalGeometryMode
0052 
0053 #endif