1 #ifndef Geometry_TrackingGeometryAligner_GeometryAligner_h 2 #define Geometry_TrackingGeometryAligner_GeometryAligner_h 61 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments" 62 <<
"Starting to apply alignments.";
65 if ( alignments->
m_align.size() != geometry->theMap.size() )
67 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
68 <<
") and alignments (size=" << alignments->
m_align.size() <<
")";
71 <<
"Size mismatch between geometry (size=" << geometry->theMap.size()
72 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
79 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
80 std::vector<AlignTransformErrorExtended>::const_iterator
83 std::map<unsigned int, GeomDet const *> theMap;
84 std::copy(geometry->theMap.begin(), geometry->theMap.end(), std::inserter(theMap,theMap.begin()));
85 unsigned int nAPE = 0;
86 for (
auto iPair = theMap.begin();
87 iPair != theMap.end(); ++iPair, ++iAlign, ++iAlignError )
90 if ( (*iPair).first != (*iAlign).rawId() )
92 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
93 <<
") and alignments (rawId=" << (*iAlign).rawId();
95 if ( (*iPair).first != (*iAlignError).rawId() )
97 <<
"DetId mismatch between geometry (rawId=" << (*iPair).first
98 <<
") and alignment errors (rawId=" << (*iAlignError).rawId();
101 CLHEP::Hep3Vector positionHep = globalRotation * CLHEP::Hep3Vector( (*iAlign).translation() ) + globalShift;
102 CLHEP::HepRotation rotationHep = CLHEP::HepRotation( (*iAlign).rotation() ) * inverseGlobalRotation;
107 rotationHep.yx(), rotationHep.yy(), rotationHep.yz(),
108 rotationHep.zx(), rotationHep.zy(), rotationHep.zz() );
121 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments" 122 <<
"Finished to apply " << theMap.size() <<
" alignments with " 123 << nAPE <<
" non-zero APE.";
131 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations" 132 <<
"Starting to attach surface deformations.";
135 std::map<unsigned int, GeomDetUnit const*> theMap;
136 std::copy(geometry->theMapUnit.begin(), geometry->theMapUnit.end(), std::inserter(theMap, theMap.begin()));
138 unsigned int nSurfDef = 0;
139 unsigned int itemIndex = 0;
140 auto iPair = theMap.begin();
141 for ( std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
142 iItem != surfaceDeformations->
items().end();
147 while ( (*iPair).first != (*iItem).m_rawId ) {
154 if ( iPair==theMap.end() )
156 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId
157 <<
" not found in geometry";
163 std::copy(iteratorPair.first, iteratorPair.second, std::back_inserter(parameters));
180 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations" 181 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
190 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform" 191 <<
"Starting to remove global position from alignments and errors";
195 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
196 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
205 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
206 std::vector<AlignTransformErrorExtended>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
207 unsigned int nAPE = 0;
208 for ( iAlign = alignments->
m_align.begin();
209 iAlign != alignments->
m_align.end();
210 ++iAlign, ++iAlignError ) {
213 newPosition = inverseGlobalRotation * ( (*iAlign).translation() - globalShift );
214 newRotation = (*iAlign).rotation() * globalRotation;
218 (*iAlign).rawId()) );
225 (*iAlignError).rawId() ) );
252 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform" 253 <<
"Finished to remove global transformation from " 254 << alignments->
m_align.size() <<
" alignments with " 255 << 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
static int position[264][3]