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
#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h"

#include <string>

namespace MTDTopologyMode {

  Mode MTDStringToEnumParser(const std::string &value) {
    std::string prefix("MTDTopologyMode::");
    Mode output = Mode::undefined;
    if (value == prefix + "tile") {
      output = Mode::tile;
    } else if (value == prefix + "bar") {
      output = Mode::bar;
    } else if (value == prefix + "barzflat") {
      output = Mode::barzflat;
    } else if (value == prefix + "barphiflat") {
      output = Mode::barphiflat;
    } else if (value == prefix + "btlv1etlv4") {
      output = Mode::btlv1etlv4;
    } else if (value == prefix + "btlv1etlv5") {
      output = Mode::btlv1etlv5;
    } else if (value == prefix + "btlv2etlv5") {
      output = Mode::btlv2etlv5;
    } else if (value == prefix + "btlv3etlv8") {
      output = Mode::btlv3etlv8;
    } else {
      throw cms::Exception("MTDTopologyModeError") << "the value " << value << " is not defined.";
    }
    return output;
  }

}  // namespace MTDTopologyMode