1 #ifndef Geometry_TrackingGeometryAligner_GeometryAligner_h
2 #define Geometry_TrackingGeometryAligner_GeometryAligner_h
62 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
63 <<
"Starting to apply alignments.";
66 if ( alignments->
m_align.size() != geometry->theMap.size() )
68 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
69 <<
") and alignments (size=" << alignments->
m_align.size() <<
")";
72 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
73 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
80 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
81 std::vector<AlignTransformErrorExtended>::const_iterator
84 std::map<unsigned int, GeomDet const *> theMap;
85 std::copy(geometry->theMap.begin(), geometry->theMap.end(), std::inserter(theMap,theMap.begin()));
86 unsigned int nAPE = 0;
87 for (
auto iPair = theMap.begin();
88 iPair != theMap.end(); ++iPair, ++iAlign, ++iAlignError )
91 if ( (*iPair).first != (*iAlign).rawId() )
93 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
94 <<
") and alignments (rawId=" << (*iAlign).rawId();
96 if ( (*iPair).first != (*iAlignError).rawId() )
98 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
99 <<
") and alignment errors (rawId=" << (*iAlignError).rawId();
102 CLHEP::Hep3Vector positionHep = globalRotation * CLHEP::Hep3Vector( (*iAlign).translation() ) + globalShift;
103 CLHEP::HepRotation rotationHep = CLHEP::HepRotation( (*iAlign).rotation() ) * inverseGlobalRotation;
108 rotationHep.yx(), rotationHep.yy(), rotationHep.yz(),
109 rotationHep.zx(), rotationHep.zy(), rotationHep.zz() );
122 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
123 <<
"Finished to apply " << theMap.size() <<
" alignments with "
124 << nAPE <<
" non-zero APE.";
132 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
133 <<
"Starting to attach surface deformations.";
136 std::map<unsigned int, GeomDetUnit const*> theMap;
137 std::copy(geometry->theMapUnit.begin(), geometry->theMapUnit.end(), std::inserter(theMap, theMap.begin()));
139 unsigned int nSurfDef = 0;
140 unsigned int itemIndex = 0;
141 auto iPair = theMap.begin();
142 for ( std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
143 iItem != surfaceDeformations->
items().end();
148 while ( (*iPair).first != (*iItem).m_rawId ) {
155 if ( iPair==theMap.end() )
157 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId
158 <<
" not found in geometry";
164 std::copy(iteratorPair.first, iteratorPair.second, std::back_inserter(parameters));
181 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
182 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
191 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
192 <<
"Starting to remove global position from alignments and errors";
196 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
197 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
206 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
207 std::vector<AlignTransformErrorExtended>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
208 unsigned int nAPE = 0;
209 for ( iAlign = alignments->
m_align.begin();
210 iAlign != alignments->
m_align.end();
211 ++iAlign, ++iAlignError ) {
214 newPosition = inverseGlobalRotation * ( (*iAlign).translation() - globalShift );
215 newRotation = (*iAlign).rotation() * globalRotation;
219 (*iAlign).rawId()) );
226 (*iAlignError).rawId() ) );
253 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
254 <<
"Finished to remove global transformation from "
255 << alignments->
m_align.size() <<
" alignments with "
256 << nAPE <<
" non-zero APE.";
bool setAlignmentPositionError(GeomDet &det, const AlignmentPositionError &ape)
Class to update a given geometry with a set of alignments.
std::vector< AlignTransform > m_align
void setSurfaceDeformation(GeomDetUnit &detUnit, const SurfaceDeformation *deformation)
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrorsExtended *newAlignmentErrorsExtended)
void setGeomDetPosition(GeomDet &det, const Surface::PositionType &position, const Surface::RotationType &rotation)
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
std::vector< AlignTransformErrorExtended > m_alignError
ESHandle< TrackerGeometry > geometry
static int position[264][3]