CMS 3D CMS Logo

AlignableStackDet.cc
Go to the documentation of this file.
1 /*
2  * $Date: 2011/09/05 16:59:07 $
3  * $Revision: 1.9 $
4  */
5 
17 #include <cmath>
18 
20  : AlignableDet(stackedDet, true), // true: adding DetUnits
21  theLowerDetSurface(stackedDet->lowerDet()->surface()) {
22  // check order lower/upper
23  const Alignables units(this->components());
24  if (units.size() != 2 || stackedDet->lowerDet()->geographicalId() != units[0]->geomDetId() ||
25  stackedDet->upperDet()->geographicalId() != units[1]->geomDetId()) {
26  throw cms::Exception("LogicError") << "[AlignableStackDet] "
27  << "Either != 2 components or "
28  << "upper/lower in wrong order for consistifyAlignments.";
29  }
30 }
31 
32 //__________________________________________________________________________________________________
34  const_cast<AlignableStackDet*>(this)->consistifyAlignments();
35  return this->AlignableDet::alignments();
36 }
37 
38 //__________________________________________________________________________________________________
40  // Now we have all to calculate new position and rotation via PlaneBuilderForGluedDet.
41  const PositionType oldPos(theSurface.position()); // From old surface for keeping...
42  const RotationType oldRot(theSurface.rotation()); // ...track of changes.
43 
44  // The plane is *not* built in the middle, but on the Lower surface
45  // see usage in Geometry/TrackerGeometryBuilder/src/TrackerGeomBuilderFromGeometricDet.cc
47 
48  // But do not forget to keep track of movements/rotations:
49  const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector());
50  // Seems to be correct down to delta angles 4.*1e-8:
51  const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation()));
52  this->addDisplacement(movement);
53  this->addRotation(rotation);
54 }
void consistifyAlignments()
make alignments consistent with daughters
const GeomDetUnit * lowerDet() const
Definition: StackGeomDet.h:19
Alignments * alignments() const override
Return vector of alignment data.
const GeomDetUnit * upperDet() const
Definition: StackGeomDet.h:20
AlignableStackDet(const StackGeomDet *geomDet)
Constructor.
const Alignables & components() const override
Return vector of direct components.
Alignments * alignments() const override
first consistify with component detunits, then call method from AlignableDet
const Plane theLowerDetSurface
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
const PositionType & position() const
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:193
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:190
TString units(TString variable, Char_t axis)
const RotationType & rotation() const
align::Alignables Alignables
Definition: Alignable.h:34
AlignableSurface theSurface
Definition: Alignable.h:237
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144