Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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     TrapezoidFineCell = 13,
0041     Hexagon8FineCell = 14,
0042   };
0043 
0044   enum WaferMode { Polyhedra = 0, ExtrudedPolygon = 1 };
0045 
0046   // Gets Geometry mode
0047   GeometryMode getGeometryMode(const char* s, const DDsvalues_type& sv);
0048   GeometryMode getGeometryMode(const std::string& s);
0049   // Gets wafer mode
0050   WaferMode getGeometryWaferMode(const char* s, const DDsvalues_type& sv);
0051 
0052   WaferMode getGeometryWaferMode(std::string& s);
0053 };  // namespace HGCalGeometryMode
0054 
0055 #endif