GeometryMode

HGCalStringToEnumParser

WaferMode

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#ifndef Geometry_HGCalCommonData_HGCalGeometryMode_H
#define Geometry_HGCalCommonData_HGCalGeometryMode_H

#include <algorithm>
#include <map>
#include <string>
#include "DetectorDescription/Core/interface/DDsvalues.h"
#include "FWCore/Utilities/interface/Exception.h"

template <typename T>
class HGCalStringToEnumParser {
  std::map<std::string, T> enumMap;

public:
  HGCalStringToEnumParser(void);

  T parseString(const std::string& value) {
    typename std::map<std::string, T>::const_iterator itr = enumMap.find(value);
    if (itr == enumMap.end())
      throw cms::Exception("Configuration") << "the value " << value << " is not defined.";
    return itr->second;
  }
};

namespace HGCalGeometryMode {
  enum GeometryMode {
    Square = 0,
    Hexagon = 1,
    HexagonFull = 2,
    Hexagon8 = 3,
    Hexagon8Full = 4,
    Trapezoid = 5,
    Hexagon8File = 6,
    TrapezoidFile = 7,
    Hexagon8Module = 8,
    TrapezoidModule = 9,
    Hexagon8Cassette = 10,
    TrapezoidCassette = 11,
    Hexagon8CalibCell = 12,
    TrapezoidFineCell = 13,
    Hexagon8FineCell = 14,
  };

  enum WaferMode { Polyhedra = 0, ExtrudedPolygon = 1 };

  // Gets Geometry mode
  GeometryMode getGeometryMode(const char* s, const DDsvalues_type& sv);
  GeometryMode getGeometryMode(const std::string& s);
  // Gets wafer mode
  WaferMode getGeometryWaferMode(const char* s, const DDsvalues_type& sv);

  WaferMode getGeometryWaferMode(std::string& s);
};  // namespace HGCalGeometryMode

#endif