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.";
122 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
123 <<
"Starting to attach surface deformations.";
126 std::map<unsigned int, GeomDetUnit const*> theMap;
129 unsigned int nSurfDef = 0;
130 unsigned int itemIndex = 0;
131 auto iPair = theMap.begin();
132 for (std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
133 iItem != surfaceDeformations->
items().end();
137 while ((*iPair).first != (*iItem).m_rawId) {
139 GeomDetUnit* geomDetUnit = const_cast<GeomDetUnit*>((*iPair).second);
143 if (iPair == theMap.end())
145 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId <<
" not found in geometry";
155 GeomDetUnit* geomDetUnit = const_cast<GeomDetUnit*>((*iPair).second);
168 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
169 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
177 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
178 <<
"Starting to remove global position from alignments and errors";
182 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
183 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
192 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
193 std::vector<AlignTransformErrorExtended>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
194 unsigned int nAPE = 0;
195 for (iAlign = alignments->
m_align.begin(); iAlign != alignments->
m_align.end(); ++iAlign, ++iAlignError) {
197 newPosition = inverseGlobalRotation * ((*iAlign).translation() - globalShift);
198 newRotation = (*iAlign).rotation() * globalRotation;
234 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
235 <<
"Finished to remove global transformation from " << alignments->
m_align.size()
236 <<
" alignments with " << nAPE <<
" non-zero APE.";