1 #ifndef Geometry_TrackingGeometryAligner_GeometryAligner_h
2 #define Geometry_TrackingGeometryAligner_GeometryAligner_h
60 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
61 <<
"Starting to apply alignments.";
64 if ( alignments->
m_align.size() != geometry->theMap.size() )
66 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
67 <<
") and alignments (size=" << alignments->
m_align.size() <<
")";
70 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
71 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
78 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
79 std::vector<AlignTransformError>::const_iterator
82 std::map<unsigned int, GeomDet*> theMap;
83 std::copy(geometry->theMap.begin(), geometry->theMap.end(), std::inserter(theMap,theMap.begin()));
84 unsigned int nAPE = 0;
85 for ( std::map<unsigned int, GeomDet*>::const_iterator iPair = theMap.begin();
86 iPair != theMap.end(); ++iPair, ++iAlign, ++iAlignError )
89 if ( (*iPair).first != (*iAlign).rawId() )
91 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
92 <<
") and alignments (rawId=" << (*iAlign).rawId();
94 if ( (*iPair).first != (*iAlignError).rawId() )
96 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
97 <<
") and alignment errors (rawId=" << (*iAlignError).rawId();
100 CLHEP::Hep3Vector positionHep = globalRotation * CLHEP::Hep3Vector( (*iAlign).translation() ) + globalShift;
101 CLHEP::HepRotation rotationHep = CLHEP::HepRotation( (*iAlign).rotation() ) * inverseGlobalRotation;
106 rotationHep.yx(), rotationHep.yy(), rotationHep.yz(),
107 rotationHep.zx(), rotationHep.zy(), rotationHep.zz() );
108 GeomDet* iGeomDet = (*iPair).second;
115 iGeomDet->alignmentPositionError() ) {
144 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
145 <<
"Finished to apply " << theMap.size() <<
" alignments with "
146 << nAPE <<
" non-zero APE.";
154 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
155 <<
"Starting to attach surface deformations.";
158 std::map<unsigned int, GeomDetUnit*> theMap;
159 std::copy(geometry->theMapUnit.begin(), geometry->theMapUnit.end(), std::inserter(theMap, theMap.begin()));
161 unsigned int nSurfDef = 0;
162 unsigned int itemIndex = 0;
163 std::map<unsigned int, GeomDetUnit*>::const_iterator iPair = theMap.begin();
164 for ( std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
165 iItem != surfaceDeformations->
items().end();
170 while ( (*iPair).first != (*iItem).m_rawId ) {
177 if ( iPair==theMap.end() )
179 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId
180 <<
" not found in geometry";
186 std::copy(iteratorPair.first, iteratorPair.second, std::back_inserter(parameters));
203 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
204 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
213 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
214 <<
"Starting to remove global position from alignments and errors";
218 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
219 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
228 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
229 std::vector<AlignTransformError>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
230 unsigned int nAPE = 0;
231 for ( iAlign = alignments->
m_align.begin();
232 iAlign != alignments->
m_align.end();
233 ++iAlign, ++iAlignError ) {
236 newPosition = inverseGlobalRotation * ( (*iAlign).translation() - globalShift );
237 newRotation = (*iAlign).rotation() * globalRotation;
241 (*iAlign).rawId()) );
248 (*iAlignError).rawId() ) );
274 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
275 <<
"Finished to remove global transformation from "
276 << alignments->
m_align.size() <<
" alignments with "
277 << nAPE <<
" non-zero APE.";
Class to update a given geometry with a set of alignments.
std::vector< AlignTransformError > m_alignError
std::vector< AlignTransform > m_align
static int position[TOTALCHAMBERS][3]
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrors *newAlignmentErrors)
void setSurfaceDeformation(GeomDetUnit &detUnit, const SurfaceDeformation *deformation)
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void setGeomDetPosition(GeomDet &det, const Surface::PositionType &position, const Surface::RotationType &rotation)
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
void setAlignmentPositionError(GeomDet &det, const AlignmentPositionError &ape)
ESHandle< TrackerGeometry > geometry