CMS 3D CMS Logo

BowedSurfaceDeformation.cc
Go to the documentation of this file.
1 
6 
8 
9 // already included via header:
10 // #include <vector>
11 
12 //------------------------------------------------------------------------------
13 BowedSurfaceDeformation::BowedSurfaceDeformation(const std::vector<double> &pars)
14  : theSagittaX(!pars.empty() ? pars[0] : 0.),
15  theSagittaY(pars.size() > 2 ? pars[2] : 0.),
16  theSagittaXY(pars.size() > 1 ? pars[1] : 0.) {
17  if (pars.size() != minParameterSize()) {
18  edm::LogError("BadSetup") << "@SUB=BowedSurfaceDeformation"
19  << "Input vector of wrong size " << pars.size() << " instead of " << minParameterSize()
20  << ", filled up with zeros!";
21  }
22 }
23 
24 //------------------------------------------------------------------------------
27 }
28 
29 //------------------------------------------------------------------------------
31 
32 //------------------------------------------------------------------------------
34  const LocalTrackAngles &localAngles,
35  double length,
36  double width) const {
37  // different widthes at high/low y could somehow be treated by theRelWidthLowY
38  // if (widthLowY > 0. && widthHighY != widthLowY) {
39  // // TEC would always create a warning...
40  // edm::LogWarning("UnusableData") << "@SUB=BowedSurfaceDeformation::positionCorrection"
41  // << "Cannot yet deal with different widthes, take "
42  // << widthHighY << " not " << widthLowY;
43  // }
44  // const double width = widthHighY;
45 
46  double uRel = (width ? 2. * localPos.x() / width : 0.); // relative u (-1 .. +1)
47  double vRel = (length ? 2. * localPos.y() / length : 0.); // relative v (-1 .. +1)
48  // 'range check':
49  const double cutOff = 1.5;
50  if (uRel < -cutOff) {
51  uRel = -cutOff;
52  } else if (uRel > cutOff) {
53  uRel = cutOff;
54  }
55  if (vRel < -cutOff) {
56  vRel = -cutOff;
57  } else if (vRel > cutOff) {
58  vRel = cutOff;
59  }
60 
61  // apply coefficients to Legendre polynomials
62  // to get local height relative to 'average'
63  const double dw =
64  (uRel * uRel - 1. / 3.) * theSagittaX + uRel * vRel * theSagittaXY + (vRel * vRel - 1. / 3.) * theSagittaY;
65 
66  // positive dxdz/dydz and positive dw mean negative shift in x/y:
67  return Local2DVector(-dw * localAngles);
68 }
69 
70 //------------------------------------------------------------------------------
72  if (other.type() == this->type()) {
73  const std::vector<double> otherParams(other.parameters());
74  if (otherParams.size() == parameterSize()) { // double check!
75  theSagittaX += otherParams[0]; // bows can simply be added up
76  theSagittaXY += otherParams[1];
77  theSagittaY += otherParams[2];
78 
79  return true;
80  }
81  }
82 
83  return false;
84 }
85 
86 //------------------------------------------------------------------------------
87 std::vector<double> BowedSurfaceDeformation::parameters() const {
88  std::vector<double> result(parameterSize());
89  result[0] = theSagittaX;
90  result[1] = theSagittaXY;
91  result[2] = theSagittaY;
92 
93  return result;
94 }
Point2DBase< double, LocalTag >
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
BowedSurfaceDeformation::minParameterSize
static constexpr unsigned int minParameterSize()
minimum size of vector that is accepted by constructor from vector
Definition: BowedSurfaceDeformation.h:59
MessageLogger.h
BowedSurfaceDeformation
Definition: BowedSurfaceDeformation.h:20
BowedSurfaceDeformation::theSagittaY
double theSagittaY
Definition: BowedSurfaceDeformation.h:65
BowedSurfaceDeformation::clone
BowedSurfaceDeformation * clone() const override
Definition: BowedSurfaceDeformation.cc:25
SurfaceDeformation
Definition: SurfaceDeformation.h:18
BowedSurfaceDeformation::type
int type() const override
specific type, i.e. SurfaceDeformationFactory::kBowedSurface
Definition: BowedSurfaceDeformation.cc:30
BowedSurfaceDeformation::parameterSize
static constexpr unsigned int parameterSize()
Definition: BowedSurfaceDeformation.h:56
SurfaceDeformation::Local2DVector
Vector2DBase< double, LocalTag > Local2DVector
Definition: SurfaceDeformation.h:20
trackingPlots.other
other
Definition: trackingPlots.py:1465
Vector2DBase
Definition: Vector2DBase.h:8
BowedSurfaceDeformation::parameters
std::vector< double > parameters() const override
parameters, i.e. sagittae as given in the constructor
Definition: BowedSurfaceDeformation.cc:87
edm::LogError
Definition: MessageLogger.h:183
BowedSurfaceDeformation::positionCorrection
Local2DVector positionCorrection(const Local2DPoint &localPos, const LocalTrackAngles &localAngles, double length, double width) const override
Definition: BowedSurfaceDeformation.cc:33
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
BowedSurfaceDeformation::add
bool add(const SurfaceDeformation &other) override
Definition: BowedSurfaceDeformation.cc:71
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
SurfaceDeformationFactory::kBowedSurface
Definition: SurfaceDeformationFactory.h:19
Topology::LocalTrackAngles
Definition: Topology.h:44
BowedSurfaceDeformation::theSagittaXY
double theSagittaXY
Definition: BowedSurfaceDeformation.h:66
SurfaceDeformationFactory.h
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
BowedSurfaceDeformation::BowedSurfaceDeformation
BowedSurfaceDeformation(double sagittaX, double sagittaXY, double sagittaY)
constructor from sagittae, i.e. coefficients of Legendre polynomials
Definition: BowedSurfaceDeformation.h:23
mps_fire.result
result
Definition: mps_fire.py:303
BowedSurfaceDeformation.h
BowedSurfaceDeformation::theSagittaX
double theSagittaX
Definition: BowedSurfaceDeformation.h:64
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443