CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SurfaceDeformationFactory.cc
Go to the documentation of this file.
1 
8 
12 
13 // included by header:
14 // #include <vector>
15 
16 SurfaceDeformation* SurfaceDeformationFactory::create(int type, const std::vector<double> &params)
17 {
18  switch(type) {
19  case kBowedSurface:
20  {
21  if (params.size() <= BowedSurfaceDeformation::maxParameterSize() &&
22  params.size() >= BowedSurfaceDeformation::minParameterSize()) {
23  return new BowedSurfaceDeformation(params);
24  } else {
25  break;
26  }
27  }
28  case kTwoBowedSurfaces:
29  {
30  if (params.size() <= TwoBowedSurfacesDeformation::maxParameterSize() &&
32  return new TwoBowedSurfacesDeformation(params);
33  } else {
34  break;
35  }
36  }
37  }
38 
39  throw cms::Exception("BadInput") << "SurfaceDeformationFactory::create: "
40  << "Unknown SurfaceDeformation type " << type << " (need "
41  << kBowedSurface << " or " << kTwoBowedSurfaces
42  << ") or params.size() (" << params.size()
43  << ") does not match.\n";
44 
45  return 0;
46 }
type
Definition: HCALResponse.h:22
static unsigned int minParameterSize()
minimum size of vector that is accepted by constructor from vector
static unsigned int minParameterSize()
minimum size of vector that is accepted by constructor from vector
static unsigned int maxParameterSize()
maximum size of vector that is accepted by constructor from vector
static unsigned int maxParameterSize()
maximum size of vector that is accepted by constructor from vector
SurfaceDeformation * create(int type, const std::vector< double > &params)