CMS 3D CMS Logo

AlignmentParametersFactory.cc
Go to the documentation of this file.
1 
11 //#include "Alignment/SurveyAnalysis/interface/SurveyParameters.h"
15 
16 #include <string>
17 #include <vector>
18 
20 
21  //_______________________________________________________________________________________
23  if (typeString == "RigidBody")
24  return kRigidBody;
25  else if (typeString == "Survey")
26  return kSurvey; // GF: do not belong here, so remove in the long term...
27  else if (typeString == "RigidBody4D")
28  return kRigidBody4D;
29  else if (typeString == "BeamSpot")
30  return kBeamSpot;
31  else if (typeString == "BowedSurface")
32  return kBowedSurface;
33  else if (typeString == "TwoBowedSurfaces")
34  return kTwoBowedSurfaces;
35  throw cms::Exception("BadConfig") << "AlignmentParametersFactory"
36  << " No AlignmentParameters with name '" << typeString << "'.";
37 
38  return kRigidBody; // to please compiler...
39  }
40 
41  //_______________________________________________________________________________________
43  if (typeInt == kRigidBody)
44  return kRigidBody;
45  if (typeInt == kSurvey)
46  return kSurvey; // GF: do not belong here, so remove in the long term...
47  if (typeInt == kRigidBody4D)
48  return kRigidBody4D;
49  if (typeInt == kBeamSpot)
50  return kBeamSpot;
51  if (typeInt == kBowedSurface)
52  return kBowedSurface;
53  if (typeInt == kTwoBowedSurfaces)
54  return kTwoBowedSurfaces;
55 
56  throw cms::Exception("BadConfig") << "AlignmentParametersFactory"
57  << " No AlignmentParameters with number " << typeInt << ".";
58 
59  return kRigidBody; // to please compiler...
60  }
61 
62  //_______________________________________________________________________________________
64  switch (parType) {
65  case kRigidBody:
66  return "RigiBody";
67  case kSurvey: // GF: do not belong here, so remove in the long term...
68  return "Survey";
69  case kRigidBody4D:
70  return "RigiBody4D";
71  case kBeamSpot:
72  return "BeamSpot";
73  case kBowedSurface:
74  return "BowedSurface";
75  case kTwoBowedSurfaces:
76  return "TwoBowedSurfaces";
77  }
78 
79  return "unknown_should_never_reach"; // to please the compiler
80  }
81 
82  //_______________________________________________________________________________________
83  AlignmentParameters *createParameters(Alignable *ali, ParametersType parType, const std::vector<bool> &sel) {
84  switch (parType) {
85  case kRigidBody: {
88  return new RigidBodyAlignmentParameters(ali, par, cov, sel);
89  } break;
90  case kSurvey:
91  // creates some unwanted dependencies - and does not fit into
92  // AlignmentParameters anyway!
93  throw cms::Exception("BadConfig") << "AlignmentParametersFactory cannot create SurveyParameters.";
94  // edm::LogWarning("Alignment") << "@SUB=createParameters"
95  // << "Creating SurveyParameters of length 0!";
96  // return new SurveyParameters(ali, AlgebraicVector(),
97  // AlgebraicSymMatrix());
98  break;
99  case kRigidBody4D: {
102  return new RigidBodyAlignmentParameters4D(ali, par, cov, sel);
103  } break;
104  case kBeamSpot: {
107  return new BeamSpotAlignmentParameters(ali, par, cov, sel);
108  } break;
109  case kBowedSurface: {
112  return new BowedSurfaceAlignmentParameters(ali, par, cov, sel);
113  } break;
114  case kTwoBowedSurfaces: {
117  return new TwoBowedSurfacesAlignmentParameters(ali, par, cov, sel);
118  } break;
119  }
120 
121  return nullptr; // unreached (all ParametersType appear in switch), to please
122  // the compiler
123  }
124 } // namespace AlignmentParametersFactory
std::string parametersTypeName(ParametersType parType)
ParametersType
enums for all available AlignmentParameters
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
CLHEP::HepVector AlgebraicVector
CLHEP::HepSymMatrix AlgebraicSymMatrix
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known