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

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

Static Public Member Functions

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

Static Public Attributes

static 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 ( 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.

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

Referenced by clone().

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

Member Function Documentation

bool TwoBowedSurfacesDeformation::add ( const SurfaceDeformation other)
virtual

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 96 of file TwoBowedSurfacesDeformation.cc.

References i, k_ySplit(), LogDebug, SurfaceDeformation::parameters(), parameterSize(), theParameters, SurfaceDeformation::type(), and type().

Referenced by counter.Counter::register().

97 {
98  if (this->type() == other.type()) {
99  const std::vector<double> otherParameters(other.parameters());
100  if (otherParameters.size() ==parameterSize() ) {
101  if (theParameters[k_ySplit()] == otherParameters[k_ySplit()]) {
102  for (unsigned int i = 0; i != parameterSize()-1; ++i) {// -1 for ySplit
103  // mean bows, delta shifts, delta angles and delta bows can simply be added up
104  theParameters[i] += otherParameters[i];
105  }
106  return true;
107  } else { // ySplit values are different!
108  LogDebug("Alignment") << "@SUB=TwoBowedSurfacesDeformation::add"
109  << "Different ySplit: this " << theParameters[k_ySplit()]
110  << ", to add " << otherParameters[k_ySplit()];
111  }
112  } // same size
113  } // same type
114 
115  return false;
116 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
virtual std::vector< double > parameters() const =0
parameters - interpretation left to the concrete implementation
virtual int type() const =0
specific type, i.e. SurfaceDeformationFactory::Type
virtual int type() const
specific type, i.e. SurfaceDeformationFactory::kTwoBowedSurfaces
TwoBowedSurfacesDeformation * TwoBowedSurfacesDeformation::clone ( void  ) const
virtual

Implements SurfaceDeformation.

Definition at line 26 of file TwoBowedSurfacesDeformation.cc.

References TwoBowedSurfacesDeformation().

27 {
28  return new TwoBowedSurfacesDeformation(*this);
29 }
TwoBowedSurfacesDeformation(const std::vector< double > &parameters)
static unsigned int TwoBowedSurfacesDeformation::k_ySplit ( )
inlinestatic

Definition at line 75 of file TwoBowedSurfacesDeformation.h.

References parameterSize().

Referenced by add(), and positionCorrection().

75 { return parameterSize()-1;}
static unsigned int TwoBowedSurfacesDeformation::maxParameterSize ( )
inlinestatic

maximum size of vector that is accepted by constructor from vector

Definition at line 72 of file TwoBowedSurfacesDeformation.h.

References parameterSize().

Referenced by SurfaceDeformationFactory::create().

72 { return parameterSize();}
static unsigned int TwoBowedSurfacesDeformation::minParameterSize ( )
inlinestatic

minimum size of vector that is accepted by constructor from vector

Definition at line 70 of file TwoBowedSurfacesDeformation.h.

References parameterSize().

Referenced by SurfaceDeformationFactory::create().

70 { return parameterSize(); }
std::vector< double > TwoBowedSurfacesDeformation::parameters ( void  ) const
virtual

parameters - see constructor for meaning

Implements SurfaceDeformation.

Definition at line 119 of file TwoBowedSurfacesDeformation.cc.

References parameterSize(), and theParameters.

120 {
121  return std::vector<double>(theParameters,theParameters+parameterSize());
122 }
static unsigned int TwoBowedSurfacesDeformation::parameterSize ( )
inlinestatic
SurfaceDeformation::Local2DVector TwoBowedSurfacesDeformation::positionCorrection ( const Local2DPoint localPos,
const LocalTrackAngles localAngles,
double  length,
double  width 
) const
virtual

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 39 of file TwoBowedSurfacesDeformation.cc.

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().

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

Member Data Documentation

unsigned int TwoBowedSurfacesDeformation::parSize = 13
static

Definition at line 65 of file TwoBowedSurfacesDeformation.h.

Referenced by parameterSize().

double TwoBowedSurfacesDeformation::theParameters[parSize]
private