1 #ifndef Geometry_TrackingGeometryAligner_GeometryAligner_h
2 #define Geometry_TrackingGeometryAligner_GeometryAligner_h
56 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
57 <<
"Starting to apply alignments.";
61 throw cms::Exception(
"GeometryMismatch") <<
"Size mismatch between geometry (size=" <<
geometry->theMap.size()
62 <<
") and alignments (size=" << alignments->
m_align.size() <<
")";
65 <<
"Size mismatch between geometry (size=" <<
geometry->theMap.size()
66 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
73 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
74 std::vector<AlignTransformErrorExtended>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
76 std::map<unsigned int, GeomDet const*> theMap;
78 unsigned int nAPE = 0;
79 for (
auto iPair = theMap.begin(); iPair != theMap.end(); ++iPair, ++iAlign, ++iAlignError) {
81 if ((*iPair).first != (*iAlign).rawId())
82 throw cms::Exception(
"GeometryMismatch") <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
83 <<
") and alignments (rawId=" << (*iAlign).rawId();
85 if ((*iPair).first != (*iAlignError).rawId())
86 throw cms::Exception(
"GeometryMismatch") <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
87 <<
") and alignment errors (rawId=" << (*iAlignError).rawId();
90 CLHEP::Hep3Vector positionHep = globalRotation * CLHEP::Hep3Vector((*iAlign).translation()) + globalShift;
91 CLHEP::HepRotation rotationHep = CLHEP::HepRotation((*iAlign).rotation()) * inverseGlobalRotation;
104 GeomDet* iGeomDet = const_cast<GeomDet*>((*iPair).second);
115 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
116 <<
"Finished to apply " << theMap.size() <<
" alignments with " << nAPE <<
" non-zero APE.";
121 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
122 <<
"Starting to attach surface deformations.";
125 std::map<unsigned int, GeomDetUnit const*> theMap;
128 unsigned int nSurfDef = 0;
129 unsigned int itemIndex = 0;
130 auto iPair = theMap.begin();
131 for (std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
132 iItem != surfaceDeformations->
items().end();
136 while ((*iPair).first != (*iItem).m_rawId) {
138 GeomDetUnit* geomDetUnit = const_cast<GeomDetUnit*>((*iPair).second);
142 if (iPair == theMap.end())
144 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId <<
" not found in geometry";
154 GeomDetUnit* geomDetUnit = const_cast<GeomDetUnit*>((*iPair).second);
167 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
168 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
176 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
177 <<
"Starting to remove global position from alignments and errors";
181 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
182 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
191 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
192 std::vector<AlignTransformErrorExtended>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
193 unsigned int nAPE = 0;
194 for (iAlign = alignments->
m_align.begin(); iAlign != alignments->
m_align.end(); ++iAlign, ++iAlignError) {
196 newPosition = inverseGlobalRotation * ((*iAlign).translation() - globalShift);
197 newRotation = (*iAlign).rotation() * globalRotation;
233 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
234 <<
"Finished to remove global transformation from " << alignments->
m_align.size()
235 <<
" alignments with " << nAPE <<
" non-zero APE.";