test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlignmentParametersFactory.cc
Go to the documentation of this file.
1 
11 //#include "Alignment/SurveyAnalysis/interface/SurveyParameters.h"
15 
16 
17 #include <vector>
18 #include <string>
19 
20 namespace AlignmentParametersFactory {
21 
22  //_______________________________________________________________________________________
24  {
25  if (typeString == "RigidBody") return kRigidBody;
26  else if (typeString == "Survey") return kSurvey; //GF: do not belong here, so remove in the long term...
27  else if (typeString == "RigidBody4D") return kRigidBody4D;
28  else if (typeString == "BeamSpot") return kBeamSpot;
29  else if (typeString == "BowedSurface") return kBowedSurface;
30  else if (typeString == "TwoBowedSurfaces") return kTwoBowedSurfaces;
31  throw cms::Exception("BadConfig")
32  << "AlignmentParametersFactory" << " No AlignmentParameters with name '" << typeString << "'.";
33 
34  return kRigidBody; // to please compiler...
35  }
36 
37  //_______________________________________________________________________________________
39  {
40  if (typeInt == kRigidBody) return kRigidBody;
41  if (typeInt == kSurvey) return kSurvey; //GF: do not belong here, so remove in the long term...
42  if (typeInt == kRigidBody4D) return kRigidBody4D;
43  if (typeInt == kBeamSpot) return kBeamSpot;
44  if (typeInt == kBowedSurface) return kBowedSurface;
45  if (typeInt == kTwoBowedSurfaces) return kTwoBowedSurfaces;
46 
47  throw cms::Exception("BadConfig")
48  << "AlignmentParametersFactory" << " No AlignmentParameters with number " << typeInt << ".";
49 
50  return kRigidBody; // to please compiler...
51  }
52 
53  //_______________________________________________________________________________________
55  {
56  switch(parType) {
57  case kRigidBody:
58  return "RigiBody";
59  case kSurvey: //GF: do not belong here, so remove in the long term...
60  return "Survey";
61  case kRigidBody4D:
62  return "RigiBody4D";
63  case kBeamSpot:
64  return "BeamSpot";
65  case kBowedSurface:
66  return "BowedSurface";
67  case kTwoBowedSurfaces:
68  return "TwoBowedSurfaces";
69  }
70 
71  return "unknown_should_never_reach"; // to please the compiler
72  }
73 
74  //_______________________________________________________________________________________
76  const std::vector<bool> &sel)
77  {
78  switch (parType) {
79  case kRigidBody:
80  {
83  return new RigidBodyAlignmentParameters(ali, par, cov, sel);
84  }
85  break;
86  case kSurvey:
87 // creates some unwanted dependencies - and does not fit into AlignmentParameters anyway!
88  throw cms::Exception("BadConfig")
89  << "AlignmentParametersFactory cannot create SurveyParameters.";
90 // edm::LogWarning("Alignment") << "@SUB=createParameters"
91 // << "Creating SurveyParameters of length 0!";
92 // return new SurveyParameters(ali, AlgebraicVector(), AlgebraicSymMatrix());
93  break;
94  case kRigidBody4D:
95  {
98  return new RigidBodyAlignmentParameters4D(ali, par, cov, sel);
99  }
100  break;
101  case kBeamSpot:
102  {
105  return new BeamSpotAlignmentParameters(ali, par, cov, sel);
106  }
107  break;
108  case kBowedSurface:
109  {
112  return new BowedSurfaceAlignmentParameters(ali, par, cov, sel);
113  }
114  break;
115  case kTwoBowedSurfaces:
116  {
119  return new TwoBowedSurfacesAlignmentParameters(ali, par, cov, sel);
120  }
121  break;
122  }
123 
124  return 0; // unreached (all ParametersType appear in switch), to please the compiler
125  }
126 }
std::string parametersTypeName(ParametersType parType)
convert ParametersType to string understood by parametersType(string &amp;typeString) ...
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