File indexing completed on 2023-03-17 10:40:49
0001
0002
0003
0004
0005
0006 #include "Alignment/TrackerAlignment/interface/AlignableSiStripDet.h"
0007
0008 #include "Alignment/CommonAlignment/interface/AlignableSurface.h"
0009
0010 #include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
0011 #include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h"
0012
0013 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0014 #include "DataFormats/GeometryCommonDetAlgo/interface/AlignmentPositionError.h"
0015 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
0016 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0017 #include "Geometry/TrackerGeometryBuilder/interface/PlaneBuilderForGluedDet.h"
0018 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0019 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0020
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023
0024 #include <cmath>
0025
0026 AlignableSiStripDet::AlignableSiStripDet(const GluedGeomDet* gluedDet)
0027 : AlignableDet(gluedDet, true),
0028 theMonoBounds(gluedDet->monoDet()->surface().bounds().clone()),
0029 theStereoBounds(gluedDet->stereoDet()->surface().bounds().clone()),
0030 theMonoType(static_cast<const StripGeomDetUnit*>(gluedDet->monoDet())->specificType()),
0031 theStereoType(static_cast<const StripGeomDetUnit*>(gluedDet->stereoDet())->specificType()) {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 const Alignables units(this->components());
0042 if (units.size() != 2 || gluedDet->monoDet()->geographicalId() != units[0]->geomDetId() ||
0043 gluedDet->stereoDet()->geographicalId() != units[1]->geomDetId()) {
0044 throw cms::Exception("LogicError") << "[AlignableSiStripDet] "
0045 << "Either != 2 components or "
0046 << "mono/stereo in wrong order for consistifyAlignments.";
0047 }
0048 }
0049
0050
0051 AlignableSiStripDet::~AlignableSiStripDet() {
0052 delete theMonoBounds;
0053 delete theStereoBounds;
0054 }
0055
0056
0057 Alignments* AlignableSiStripDet::alignments() const {
0058 const_cast<AlignableSiStripDet*>(this)->consistifyAlignments();
0059
0060 return this->AlignableDet::alignments();
0061 }
0062
0063
0064 void AlignableSiStripDet::consistifyAlignments() {
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 const Alignables aliUnits(this->components());
0075
0076 BoundPlane::BoundPlanePointer monoPlane =
0077 BoundPlane::build(aliUnits[0]->globalPosition(), aliUnits[0]->globalRotation(), theMonoBounds->clone());
0078
0079 const StripGeomDetUnit monoDet(&(*monoPlane), &theMonoType, 0);
0080
0081 BoundPlane::BoundPlanePointer stereoPlane =
0082 BoundPlane::build(aliUnits[1]->globalPosition(), aliUnits[1]->globalRotation(), theStereoBounds->clone());
0083
0084 const StripGeomDetUnit stereoDet(&(*stereoPlane), &theStereoType, 0);
0085
0086 std::vector<const GeomDetUnit*> detComps;
0087 detComps.push_back(&monoDet);
0088 detComps.push_back(&stereoDet);
0089
0090
0091 const PositionType oldPos(theSurface.position());
0092 const RotationType oldRot(theSurface.rotation());
0093
0094 PlaneBuilderForGluedDet planeBuilder;
0095 theSurface = AlignableSurface(*planeBuilder.plane(detComps));
0096
0097
0098 const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector());
0099
0100 const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation()));
0101 this->addDisplacement(movement);
0102 this->addRotation(rotation);
0103
0104
0105
0106
0107
0108
0109
0110
0111 }
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140