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;
120 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::applyAlignments"
121 <<
"Finished to apply " << theMap.size() <<
" alignments with "
122 << nAPE <<
" non-zero APE.";
130 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
131 <<
"Starting to attach surface deformations.";
134 std::map<unsigned int, GeomDetUnit*> theMap;
135 std::copy(geometry->theMapUnit.begin(), geometry->theMapUnit.end(), std::inserter(theMap, theMap.begin()));
137 unsigned int nSurfDef = 0;
138 unsigned int itemIndex = 0;
139 std::map<unsigned int, GeomDetUnit*>::const_iterator iPair = theMap.begin();
140 for ( std::vector<AlignmentSurfaceDeformations::Item>::const_iterator iItem = surfaceDeformations->
items().begin();
141 iItem != surfaceDeformations->
items().end();
146 while ( (*iPair).first != (*iItem).m_rawId ) {
153 if ( iPair==theMap.end() )
155 <<
"GeomDetUnit with rawId=" << (*iItem).m_rawId
156 <<
" not found in geometry";
162 std::copy(iteratorPair.first, iteratorPair.second, std::back_inserter(parameters));
179 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::attachSurfaceDeformations"
180 <<
"Finished to attach " << nSurfDef <<
" surface deformations.";
189 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
190 <<
"Starting to remove global position from alignments and errors";
194 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
195 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
204 std::vector<AlignTransform>::const_iterator iAlign = alignments->
m_align.begin();
205 std::vector<AlignTransformError>::const_iterator iAlignError = alignmentErrors->
m_alignError.begin();
206 unsigned int nAPE = 0;
207 for ( iAlign = alignments->
m_align.begin();
208 iAlign != alignments->
m_align.end();
209 ++iAlign, ++iAlignError ) {
212 newPosition = inverseGlobalRotation * ( (*iAlign).translation() - globalShift );
213 newRotation = (*iAlign).rotation() * globalRotation;
217 (*iAlign).rawId()) );
224 (*iAlignError).rawId() ) );
225 if ( error.
cxx() || error.
cyy() || error.
czz() ||
226 error.
cyx() || error.
czx() || error.
czy() ) {
250 edm::LogInfo(
"Alignment") <<
"@SUB=GeometryAligner::removeGlobalTransform"
251 <<
"Finished to remove global transformation from "
252 << alignments->
m_align.size() <<
" alignments with "
253 << nAPE <<
" non-zero APE.";
bool setAlignmentPositionError(GeomDet &det, const AlignmentPositionError &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)
ESHandle< TrackerGeometry > geometry