File indexing completed on 2024-04-06 12:14:23
0001
0002
0003
0004 #include "Geometry/CommonTopologies/interface/BowedSurfaceDeformation.h"
0005 #include "Geometry/CommonTopologies/interface/SurfaceDeformationFactory.h"
0006
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008
0009
0010
0011
0012
0013 BowedSurfaceDeformation::BowedSurfaceDeformation(const std::vector<double> &pars)
0014 : theSagittaX(!pars.empty() ? pars[0] : 0.),
0015 theSagittaY(pars.size() > 2 ? pars[2] : 0.),
0016 theSagittaXY(pars.size() > 1 ? pars[1] : 0.) {
0017 if (pars.size() != minParameterSize()) {
0018 edm::LogError("BadSetup") << "@SUB=BowedSurfaceDeformation"
0019 << "Input vector of wrong size " << pars.size() << " instead of " << minParameterSize()
0020 << ", filled up with zeros!";
0021 }
0022 }
0023
0024
0025 BowedSurfaceDeformation *BowedSurfaceDeformation::clone() const {
0026 return new BowedSurfaceDeformation(theSagittaX, theSagittaXY, theSagittaY);
0027 }
0028
0029
0030 int BowedSurfaceDeformation::type() const { return SurfaceDeformationFactory::kBowedSurface; }
0031
0032
0033 SurfaceDeformation::Local2DVector BowedSurfaceDeformation::positionCorrection(const Local2DPoint &localPos,
0034 const LocalTrackAngles &localAngles,
0035 double length,
0036 double width) const {
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 double uRel = (width ? 2. * localPos.x() / width : 0.);
0047 double vRel = (length ? 2. * localPos.y() / length : 0.);
0048
0049 const double cutOff = 1.5;
0050 if (uRel < -cutOff) {
0051 uRel = -cutOff;
0052 } else if (uRel > cutOff) {
0053 uRel = cutOff;
0054 }
0055 if (vRel < -cutOff) {
0056 vRel = -cutOff;
0057 } else if (vRel > cutOff) {
0058 vRel = cutOff;
0059 }
0060
0061
0062
0063 const double dw =
0064 (uRel * uRel - 1. / 3.) * theSagittaX + uRel * vRel * theSagittaXY + (vRel * vRel - 1. / 3.) * theSagittaY;
0065
0066
0067 return Local2DVector(-dw * localAngles);
0068 }
0069
0070
0071 bool BowedSurfaceDeformation::add(const SurfaceDeformation &other) {
0072 if (other.type() == this->type()) {
0073 const std::vector<double> otherParams(other.parameters());
0074 if (otherParams.size() == parameterSize()) {
0075 theSagittaX += otherParams[0];
0076 theSagittaXY += otherParams[1];
0077 theSagittaY += otherParams[2];
0078
0079 return true;
0080 }
0081 }
0082
0083 return false;
0084 }
0085
0086
0087 std::vector<double> BowedSurfaceDeformation::parameters() const {
0088 std::vector<double> result(parameterSize());
0089 result[0] = theSagittaX;
0090 result[1] = theSagittaXY;
0091 result[2] = theSagittaY;
0092
0093 return result;
0094 }