1 #ifndef Geometry_TrackingGeometryAligner_GeometryAligner_h
2 #define Geometry_TrackingGeometryAligner_GeometryAligner_h
56 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
57 <<
"Starting to apply alignments.";
60 if (alignments->
m_align.size() != geometry->theMap.size())
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;
77 std::copy(geometry->theMap.begin(), geometry->theMap.end(), std::inserter(theMap, theMap.begin()));
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;
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;
127 std::copy(geometry->theMapUnit.begin(), geometry->theMapUnit.end(), std::inserter(theMap, theMap.begin()));
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) {
143 if (iPair == theMap.end())
145 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId <<
" not found in geometry";
151 std::copy(iteratorPair.first, iteratorPair.second, std::back_inserter(parameters));
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.";
void attachSurfaceDeformations(const C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
bool setAlignmentPositionError(GeomDet &det, const AlignmentPositionError &ape)
Class to update a given geometry with a set of alignments.
std::vector< AlignTransform > m_align
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
void setSurfaceDeformation(GeomDetUnit &detUnit, const SurfaceDeformation *deformation)
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)
Log< level::Info, false > LogInfo
std::vector< AlignTransformErrorExtended > m_alignError
static int position[264][3]