File indexing completed on 2024-04-06 11:57:28
0001
0002
0003
0004
0005
0006 #include "Alignment/CommonAlignment/interface/AlignableSurface.h"
0007 #include "Alignment/TrackerAlignment/interface/AlignableStackDet.h"
0008 #include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h"
0009 #include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
0010 #include "DataFormats/GeometryCommonDetAlgo/interface/AlignmentPositionError.h"
0011 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
0012 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0013 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "FWCore/Utilities/interface/Exception.h"
0016 #include "Geometry/CommonDetUnit/interface/StackGeomDet.h"
0017 #include <cmath>
0018
0019 AlignableStackDet::AlignableStackDet(const StackGeomDet* stackedDet)
0020 : AlignableDet(stackedDet, true),
0021 theLowerDetSurface(stackedDet->lowerDet()->surface()) {
0022
0023 const Alignables units(this->components());
0024 if (units.size() != 2 || stackedDet->lowerDet()->geographicalId() != units[0]->geomDetId() ||
0025 stackedDet->upperDet()->geographicalId() != units[1]->geomDetId()) {
0026 throw cms::Exception("LogicError") << "[AlignableStackDet] "
0027 << "Either != 2 components or "
0028 << "upper/lower in wrong order for consistifyAlignments.";
0029 }
0030 }
0031
0032
0033 Alignments* AlignableStackDet::alignments() const {
0034 const_cast<AlignableStackDet*>(this)->consistifyAlignments();
0035 return this->AlignableDet::alignments();
0036 }
0037
0038
0039 void AlignableStackDet::consistifyAlignments() {
0040
0041 const PositionType oldPos(theSurface.position());
0042 const RotationType oldRot(theSurface.rotation());
0043
0044
0045
0046 theSurface = AlignableSurface(theLowerDetSurface);
0047
0048
0049 const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector());
0050
0051 const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation()));
0052 this->addDisplacement(movement);
0053 this->addRotation(rotation);
0054 }