Go to the documentation of this file.00001
00002
00003
00004
00005 #include "Alignment/CommonAlignmentParametrization/interface/AlignmentParametersFactory.h"
00006 #include "Alignment/CommonAlignmentParametrization/interface/RigidBodyAlignmentParameters.h"
00007 #include "Alignment/CommonAlignmentParametrization/interface/RigidBodyAlignmentParameters4D.h"
00008 #include "Alignment/CommonAlignmentParametrization/interface/BeamSpotAlignmentParameters.h"
00009 #include "Alignment/CommonAlignmentParametrization/interface/BowedSurfaceAlignmentParameters.h"
00010 #include "Alignment/CommonAlignmentParametrization/interface/TwoBowedSurfacesAlignmentParameters.h"
00011
00012 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00013 #include "FWCore/Utilities/interface/Exception.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015
00016
00017 #include <vector>
00018 #include <string>
00019
00020 namespace AlignmentParametersFactory {
00021
00022
00023 ParametersType parametersType(const std::string &typeString)
00024 {
00025 if (typeString == "RigidBody") return kRigidBody;
00026 else if (typeString == "Survey") return kSurvey;
00027 else if (typeString == "RigidBody4D") return kRigidBody4D;
00028 else if (typeString == "BeamSpot") return kBeamSpot;
00029 else if (typeString == "BowedSurface") return kBowedSurface;
00030 else if (typeString == "TwoBowedSurfaces") return kTwoBowedSurfaces;
00031 throw cms::Exception("BadConfig")
00032 << "AlignmentParametersFactory" << " No AlignmentParameters with name '" << typeString << "'.";
00033
00034 return kRigidBody;
00035 }
00036
00037
00038 ParametersType parametersType(int typeInt)
00039 {
00040 if (typeInt == kRigidBody) return kRigidBody;
00041 if (typeInt == kSurvey) return kSurvey;
00042 if (typeInt == kRigidBody4D) return kRigidBody4D;
00043 if (typeInt == kBeamSpot) return kBeamSpot;
00044 if (typeInt == kBowedSurface) return kBowedSurface;
00045 if (typeInt == kTwoBowedSurfaces) return kTwoBowedSurfaces;
00046
00047 throw cms::Exception("BadConfig")
00048 << "AlignmentParametersFactory" << " No AlignmentParameters with number " << typeInt << ".";
00049
00050 return kRigidBody;
00051 }
00052
00053
00054 std::string parametersTypeName(ParametersType parType)
00055 {
00056 switch(parType) {
00057 case kRigidBody:
00058 return "RigiBody";
00059 case kSurvey:
00060 return "Survey";
00061 case kRigidBody4D:
00062 return "RigiBody4D";
00063 case kBeamSpot:
00064 return "BeamSpot";
00065 case kBowedSurface:
00066 return "BowedSurface";
00067 case kTwoBowedSurfaces:
00068 return "TwoBowedSurfaces";
00069 }
00070
00071 return "unknown_should_never_reach";
00072 }
00073
00074
00075 AlignmentParameters* createParameters(Alignable *ali, ParametersType parType,
00076 const std::vector<bool> &sel)
00077 {
00078 switch (parType) {
00079 case kRigidBody:
00080 {
00081 const AlgebraicVector par(RigidBodyAlignmentParameters::N_PARAM, 0);
00082 const AlgebraicSymMatrix cov(RigidBodyAlignmentParameters::N_PARAM, 0);
00083 return new RigidBodyAlignmentParameters(ali, par, cov, sel);
00084 }
00085 break;
00086 case kSurvey:
00087
00088 throw cms::Exception("BadConfig")
00089 << "AlignmentParametersFactory cannot create SurveyParameters.";
00090
00091
00092
00093 break;
00094 case kRigidBody4D:
00095 {
00096 const AlgebraicVector par(RigidBodyAlignmentParameters4D::N_PARAM, 0);
00097 const AlgebraicSymMatrix cov(RigidBodyAlignmentParameters4D::N_PARAM, 0);
00098 return new RigidBodyAlignmentParameters4D(ali, par, cov, sel);
00099 }
00100 break;
00101 case kBeamSpot:
00102 {
00103 const AlgebraicVector par(BeamSpotAlignmentParameters::N_PARAM, 0);
00104 const AlgebraicSymMatrix cov(BeamSpotAlignmentParameters::N_PARAM, 0);
00105 return new BeamSpotAlignmentParameters(ali, par, cov, sel);
00106 }
00107 break;
00108 case kBowedSurface:
00109 {
00110 const AlgebraicVector par(BowedSurfaceAlignmentParameters::N_PARAM, 0);
00111 const AlgebraicSymMatrix cov(BowedSurfaceAlignmentParameters::N_PARAM, 0);
00112 return new BowedSurfaceAlignmentParameters(ali, par, cov, sel);
00113 }
00114 break;
00115 case kTwoBowedSurfaces:
00116 {
00117 const AlgebraicVector par(TwoBowedSurfacesAlignmentParameters::N_PARAM, 0);
00118 const AlgebraicSymMatrix cov(TwoBowedSurfacesAlignmentParameters::N_PARAM, 0);
00119 return new TwoBowedSurfacesAlignmentParameters(ali, par, cov, sel);
00120 }
00121 break;
00122 }
00123
00124 return 0;
00125 }
00126 }