CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
TwoBowedSurfacesDeformation Class Reference

#include <TwoBowedSurfacesDeformation.h>

Inheritance diagram for TwoBowedSurfacesDeformation:
SurfaceDeformation

Public Member Functions

bool add (const SurfaceDeformation &other) override
 
TwoBowedSurfacesDeformationclone () const override
 
std::vector< double > parameters () const override
 parameters - see constructor for meaning More...
 
Local2DVector positionCorrection (const Local2DPoint &localPos, const LocalTrackAngles &localAngles, double length, double width) const override
 
 TwoBowedSurfacesDeformation (const std::vector< double > &parameters)
 
int type () const override
 specific type, i.e. SurfaceDeformationFactory::kTwoBowedSurfaces More...
 
- Public Member Functions inherited from SurfaceDeformation
virtual ~SurfaceDeformation ()
 

Static Public Member Functions

static constexpr unsigned int k_ySplit ()
 
static constexpr unsigned int maxParameterSize ()
 maximum size of vector that is accepted by constructor from vector More...
 
static constexpr unsigned int minParameterSize ()
 minimum size of vector that is accepted by constructor from vector More...
 
static constexpr unsigned int parameterSize ()
 

Static Public Attributes

static constexpr unsigned int parSize = 13
 

Private Attributes

double theParameters [parSize]
 

Additional Inherited Members

- Public Types inherited from SurfaceDeformation
typedef Topology::Local2DPoint Local2DPoint
 
typedef Vector2DBase< double, LocalTagLocal2DVector
 
typedef Topology::LocalTrackAngles LocalTrackAngles
 
typedef Topology::MathVector2D MathVector2D
 
typedef Topology::Vector2D Vector2D
 

Detailed Description

TwoBowedSurfacesAlignmentParameters

Class to apply corrections to local positions resulting from two surfaces chained in local y. Possible bows are parametrised using Legendre polynomials up to second order, excluding 0th and 1st order that are already treated by local w shift and rotations around local u and v axes. In addition store relative shifts and rotations of the two surfaces.

Definition at line 19 of file TwoBowedSurfacesDeformation.h.

Constructor & Destructor Documentation

◆ TwoBowedSurfacesDeformation()

TwoBowedSurfacesDeformation::TwoBowedSurfacesDeformation ( const std::vector< double > &  pars)

Constructor from vector of parameters, its size() must be between minParameterSize() and maxParameterSize(). The parameters are (in that order)

  • mean sagittaX of both surfaces
  • mean sagittaXY
  • mean sagittaY
  • 'delta' u of both surfaces (shift surface at lower/higher y by +u/-u)
  • 'delta' v of both surfaces
  • 'delta' w of both surfaces
  • 'delta' alpha of both surfaces (rotate around local x)
  • 'delta' beta
  • 'delta' gamma
  • 'delta' sagittaX of both surfaces (add/subtract for surfaces at lower/higher y)
  • 'delta' sagittaXY
  • 'delta' sagittaY
  • ySplit: y-value where surfaces are split
Author
: Gero Flucke date : October 2010

Definition at line 13 of file TwoBowedSurfacesDeformation.cc.

13  {
14  if (pars.size() != parameterSize()) {
15  edm::LogError("BadSetup") << "@SUB=TwoBowedSurfacesDeformation"
16  << "Input vector of wrong size " << pars.size() << " instead of " << parameterSize()
17  << ", add zeros to fill up!";
18  }
19  for (unsigned int i = 0; i != std::min((unsigned int)(pars.size()), parameterSize()); ++i)
20  theParameters[i] = pars[i];
21  for (unsigned int i = pars.size(); i != parameterSize(); ++i)
22  theParameters[i] = 0;
23 }

References mps_fire::i, min(), parameterSize(), and theParameters.

Referenced by clone().

Member Function Documentation

◆ add()

bool TwoBowedSurfacesDeformation::add ( const SurfaceDeformation other)
overridevirtual

update information with parameters of 'other', false in case the type or some parameters do not match and thus the information cannot be used (then no changes are done), true if merge was successful

Implements SurfaceDeformation.

Definition at line 98 of file TwoBowedSurfacesDeformation.cc.

98  {
99  if (this->type() == other.type()) {
100  const std::vector<double> otherParameters(other.parameters());
101  if (otherParameters.size() == parameterSize()) {
102  // Second check in case it is really adding, either way DO NOT check equality directly
103  if (fabs(theParameters[k_ySplit()] - otherParameters[k_ySplit()]) < 1e-5 ||
104  fabs(otherParameters[k_ySplit()]) < 1e-5) {
105  for (unsigned int i = 0; i != parameterSize() - 1; ++i) { // -1 for ySplit
106  // mean bows, delta shifts, delta angles and delta bows can simply be added up
107  theParameters[i] += otherParameters[i];
108  }
109  return true;
110  } else { // ySplit values are different!
111  edm::LogError("Alignment") << "@SUB=TwoBowedSurfacesDeformation::add"
112  << "Different ySplit: this " << theParameters[k_ySplit()] << ", to add "
113  << otherParameters[k_ySplit()];
114  }
115  } // same size
116  } // same type
117 
118  edm::LogError("Alignment") << "@SUB=TwoBowedSurfacesDeformation::add"
119  << "Types are different!";
120 
121  return false;
122 }

References MillePedeFileConverter_cfg::e, mps_fire::i, k_ySplit(), trackingPlots::other, parameterSize(), theParameters, SurfaceDeformation::type(), and type().

Referenced by counter.Counter::register().

◆ clone()

TwoBowedSurfacesDeformation * TwoBowedSurfacesDeformation::clone ( void  ) const
overridevirtual

Implements SurfaceDeformation.

Definition at line 26 of file TwoBowedSurfacesDeformation.cc.

26  {
27  return new TwoBowedSurfacesDeformation(*this);
28 }

References TwoBowedSurfacesDeformation().

◆ k_ySplit()

static constexpr unsigned int TwoBowedSurfacesDeformation::k_ySplit ( )
inlinestaticconstexpr

Definition at line 74 of file TwoBowedSurfacesDeformation.h.

74 { return parameterSize() - 1; }

References parameterSize().

Referenced by add(), and positionCorrection().

◆ maxParameterSize()

static constexpr unsigned int TwoBowedSurfacesDeformation::maxParameterSize ( )
inlinestaticconstexpr

maximum size of vector that is accepted by constructor from vector

Definition at line 71 of file TwoBowedSurfacesDeformation.h.

71 { return parameterSize(); }

References parameterSize().

Referenced by SurfaceDeformationFactory::create().

◆ minParameterSize()

static constexpr unsigned int TwoBowedSurfacesDeformation::minParameterSize ( )
inlinestaticconstexpr

minimum size of vector that is accepted by constructor from vector

Definition at line 69 of file TwoBowedSurfacesDeformation.h.

69 { return parameterSize(); }

References parameterSize().

Referenced by SurfaceDeformationFactory::create().

◆ parameters()

std::vector< double > TwoBowedSurfacesDeformation::parameters ( void  ) const
overridevirtual

parameters - see constructor for meaning

Implements SurfaceDeformation.

Definition at line 125 of file TwoBowedSurfacesDeformation.cc.

125  {
126  return std::vector<double>(theParameters, theParameters + parameterSize());
127 }

References parameterSize(), and theParameters.

◆ parameterSize()

static constexpr unsigned int TwoBowedSurfacesDeformation::parameterSize ( )
inlinestaticconstexpr

◆ positionCorrection()

SurfaceDeformation::Local2DVector TwoBowedSurfacesDeformation::positionCorrection ( const Local2DPoint localPos,
const LocalTrackAngles localAngles,
double  length,
double  width 
) const
overridevirtual

correction to add to local position depending on

  • track parameters in local frame (from LocalTrajectoryParameters):
    • track position as Local2DPoint(x,y)
    • track angles as LocalTrackAngles(dxdz, dydz)
  • length of surface (local y-coordinate)
  • width of surface (local x-coordinate)

Implements SurfaceDeformation.

Definition at line 34 of file TwoBowedSurfacesDeformation.cc.

37  {
38  const double ySplit = theParameters[k_ySplit()];
39 
40  // treatment of different widthes at high/low y could be done by theRelWidthLowY or so
41  // if (widthLowY > 0. && widthHighY != widthLowY) {
42  // std::cout << "SurfaceDeformation::positionCorrection2Bowed: Cannot yet deal "
43  // << " with different widthes, take " << widthHighY << " not " << widthLowY
44  // << std::endl;
45  // }
46  // const double width = widthHighY;
47 
48  // Some signs depend on whether we are in surface part below or above ySplit:
49  const double sign = (localPos.y() < ySplit ? +1. : -1.);
50  const double yMiddle = ySplit * 0.5 - sign * length * .25;
51  // 'calibrate' y length and transform y to be w.r.t. surface middle
52  const double myY = localPos.y() - yMiddle;
53  const double myLength = length * 0.5 + sign * ySplit;
54 
55  double uRel = 2. * localPos.x() / width; // relative u (-1 .. +1)
56  double vRel = 2. * myY / myLength; // relative v (-1 .. +1)
57  // 'range check':
58  const double cutOff = 1.5;
59  if (uRel < -cutOff) {
60  uRel = -cutOff;
61  } else if (uRel > cutOff) {
62  uRel = cutOff;
63  }
64  if (vRel < -cutOff) {
65  vRel = -cutOff;
66  } else if (vRel > cutOff) {
67  vRel = cutOff;
68  }
69 
70  auto pars = theParameters;
71  // 1st, get dw effect depending
72  // - on the surface sagittas (Legendre polynomials),
73  // see BowedSurfaceAlignmentDerivatives::operator()(..)
74  // - relative dw
75  // - surface specific dalpha (note that this shifts surface specific dw)
76  // - surface specific dbeta
77  const double dw = (uRel * uRel - 1. / 3.) * (pars[0] + sign * pars[9]) // sagittaX
78  + uRel * vRel * (pars[1] + sign * pars[10]) // sagittaXY
79  + (vRel * vRel - 1. / 3.) * (pars[2] + sign * pars[11]) // sagittaY
80  + sign * pars[5] // different dw
81  + myY * sign * pars[6] // different dalpha
82  - localPos.x() * sign * pars[7]; // different dbeta
83  // 2nd, translate the dw effect to shifts in x and y
84  // Positive dxdz/dydz and positive dw mean negative shift in x/y:
85  Local2DVector::ScalarType x = -dw * localAngles.dxdz();
86  Local2DVector::ScalarType y = -dw * localAngles.dydz();
87  // 3rd, treat in-plane differences depending on surface from xy-shifts...
88  x += (sign * pars[3]); // different du
89  y += (sign * pars[4]); // different dv
90  // ...and gamma-rotation
91  x -= myY * (sign * pars[8]); // different dgamma for u
92  y += localPos.x() * (sign * pars[8]); // different dgamma for v
93 
94  return Local2DVector(x, y);
95 }

References Topology::LocalTrackAngles::dxdz(), Topology::LocalTrackAngles::dydz(), k_ySplit(), Validation_hcalonly_cfi::sign, theParameters, ApeEstimator_cff::width, x, PV2DBase< T, PVType, FrameType >::x(), y, and PV2DBase< T, PVType, FrameType >::y().

◆ type()

int TwoBowedSurfacesDeformation::type ( ) const
overridevirtual

Member Data Documentation

◆ parSize

constexpr unsigned int TwoBowedSurfacesDeformation::parSize = 13
staticconstexpr

Definition at line 65 of file TwoBowedSurfacesDeformation.h.

Referenced by parameterSize().

◆ theParameters

double TwoBowedSurfacesDeformation::theParameters[parSize]
private
DDAxes::y
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
TwoBowedSurfacesDeformation::type
int type() const override
specific type, i.e. SurfaceDeformationFactory::kTwoBowedSurfaces
Definition: TwoBowedSurfacesDeformation.cc:31
min
T min(T a, T b)
Definition: MathUtil.h:58
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
SurfaceDeformationFactory::kTwoBowedSurfaces
Definition: SurfaceDeformationFactory.h:20
DDAxes::x
SurfaceDeformation::type
virtual int type() const =0
specific type, i.e. SurfaceDeformationFactory::Type
TwoBowedSurfacesDeformation::k_ySplit
static constexpr unsigned int k_ySplit()
Definition: TwoBowedSurfacesDeformation.h:74
SurfaceDeformation::Local2DVector
Vector2DBase< double, LocalTag > Local2DVector
Definition: SurfaceDeformation.h:20
TwoBowedSurfacesDeformation::parSize
static constexpr unsigned int parSize
Definition: TwoBowedSurfacesDeformation.h:65
trackingPlots.other
other
Definition: trackingPlots.py:1460
TwoBowedSurfacesDeformation::theParameters
double theParameters[parSize]
Definition: TwoBowedSurfacesDeformation.h:77
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
PV2DBase< T, VectorTag, FrameTag >::ScalarType
T ScalarType
Definition: PV2DBase.h:12
TwoBowedSurfacesDeformation::parameterSize
static constexpr unsigned int parameterSize()
Definition: TwoBowedSurfacesDeformation.h:66
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TwoBowedSurfacesDeformation::TwoBowedSurfacesDeformation
TwoBowedSurfacesDeformation(const std::vector< double > &parameters)
Definition: TwoBowedSurfacesDeformation.cc:13