Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "Alignment/TrackerAlignment/interface/AlignableSiStripDet.h"
00007
00008 #include "Alignment/CommonAlignment/interface/AlignableSurface.h"
00009
00010 #include "CondFormats/Alignment/interface/AlignmentErrors.h"
00011 #include "CondFormats/Alignment/interface/AlignTransformError.h"
00012
00013 #include "DataFormats/GeometrySurface/interface/Bounds.h"
00014 #include "DataFormats/TrackingRecHit/interface/AlignmentPositionError.h"
00015 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00016 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00017 #include "Geometry/TrackerGeometryBuilder/interface/PlaneBuilderForGluedDet.h"
00018 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00019 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00020
00021 #include "FWCore/Utilities/interface/Exception.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023
00024 #include <math.h>
00025
00026 AlignableSiStripDet::AlignableSiStripDet(const GluedGeomDet *gluedDet)
00027 : AlignableDet(gluedDet, true),
00028 theMonoBounds (gluedDet->monoDet() ->surface().bounds().clone()),
00029 theStereoBounds(gluedDet->stereoDet()->surface().bounds().clone()),
00030 theMonoType (static_cast<const StripGeomDetUnit*>(gluedDet->monoDet()) ->specificType()),
00031 theStereoType(static_cast<const StripGeomDetUnit*>(gluedDet->stereoDet())->specificType())
00032 {
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 const Alignables units(this->components());
00043 if (units.size() != 2
00044 || gluedDet->monoDet()->geographicalId() != units[0]->geomDetId()
00045 || gluedDet->stereoDet()->geographicalId() != units[1]->geomDetId()) {
00046 throw cms::Exception("LogicError")
00047 << "[AlignableSiStripDet] " << "Either != 2 components or "
00048 << "mono/stereo in wrong order for consistifyAlignments.";
00049 }
00050 }
00051
00052
00053 AlignableSiStripDet::~AlignableSiStripDet()
00054 {
00055 delete theMonoBounds;
00056 delete theStereoBounds;
00057 }
00058
00059
00060 Alignments* AlignableSiStripDet::alignments() const
00061 {
00062 const_cast<AlignableSiStripDet*>(this)->consistifyAlignments();
00063
00064 return this->AlignableDet::alignments();
00065 }
00066
00067
00068 void AlignableSiStripDet::consistifyAlignments()
00069 {
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 const Alignables aliUnits(this->components());
00080
00081 BoundPlane::BoundPlanePointer monoPlane
00082 = BoundPlane::build(aliUnits[0]->globalPosition(), aliUnits[0]->globalRotation(),
00083 *theMonoBounds);
00084
00085 const StripGeomDetUnit monoDet(&(*monoPlane), &theMonoType, 0);
00086
00087 BoundPlane::BoundPlanePointer stereoPlane
00088 = BoundPlane::build(aliUnits[1]->globalPosition(), aliUnits[1]->globalRotation(),
00089 *theStereoBounds);
00090
00091 const StripGeomDetUnit stereoDet(&(*stereoPlane), &theStereoType, 0);
00092
00093 std::vector<const GeomDetUnit*> detComps;
00094 detComps.push_back(&monoDet);
00095 detComps.push_back(&stereoDet);
00096
00097
00098 const PositionType oldPos(theSurface.position());
00099 const RotationType oldRot(theSurface.rotation());
00100
00101 PlaneBuilderForGluedDet planeBuilder;
00102 theSurface = AlignableSurface(*planeBuilder.plane(detComps));
00103
00104
00105 const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector());
00106
00107 const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation()));
00108 this->addDisplacement(movement);
00109 this->addRotation(rotation);
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 }
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148