CMS 3D CMS Logo

SurfaceDeformationFactory.cc
Go to the documentation of this file.
1 
5 
9 
10 // included by header:
11 // #include <vector>
12 // #include <string>
13 
15  if (typeString == "BowedSurface")
16  return kBowedSurface;
17  else if (typeString == "TwoBowedSurfaces")
18  return kTwoBowedSurfaces;
19  else {
20  throw cms::Exception("BadInput") << "SurfaceDeformationFactory::surfaceDeformationType: "
21  << "Unknown SurfaceDeformation type " << typeString
22  << " (must be 'BowedSurface' or 'TwoBowedSurfaces'.\n";
23  return kNoDeformations; // not reached, to please the compiler
24  }
25 }
27  switch (type) {
28  case kBowedSurface:
29  return std::string("BowedSurface");
30  case kTwoBowedSurfaces:
31  return std::string("TwoBowedSurfaces");
32  default:
33  throw cms::Exception("BadInput") << "SurfaceDeformationFactory::surfaceDeformationTypeName: "
34  << "Unknown SurfaceDeformation type " << type
35  << " (must be 'kBowedSurface' or 'kTwoBowedSurfaces'.\n";
36  return std::string("NoDeformations");
37  }
38 }
39 
41  switch (type) {
42  case kBowedSurface:
43  case kTwoBowedSurfaces:
45  default:
46  throw cms::Exception("BadInput") << "SurfaceDeformationFactory::create: "
47  << "Unknown SurfaceDeformation type " << type << " (need " << kBowedSurface
48  << " or " << kTwoBowedSurfaces << ")\n";
49  return nullptr;
50  }
51 }
52 
56  return new BowedSurfaceDeformation(params);
60 
61  throw cms::Exception("BadInput") << "SurfaceDeformationFactory::create: "
62  << "Params.size() (" << params.size() << ") does not match.\n";
63 
64  return nullptr;
65 }
static constexpr unsigned int minParameterSize()
minimum size of vector that is accepted by constructor from vector
static constexpr unsigned int minParameterSize()
minimum size of vector that is accepted by constructor from vector
static constexpr unsigned int maxParameterSize()
maximum size of vector that is accepted by constructor from vector
static constexpr unsigned int maxParameterSize()
maximum size of vector that is accepted by constructor from vector
std::string surfaceDeformationTypeName(const Type &type)
Type surfaceDeformationType(const std::string &typeString)
convert string to &#39;Type&#39; - exception if string is not known
SurfaceDeformation * create(int type, const std::vector< double > &params)