ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/CMSSW/Alignment/CommonAlignmentAlgorithm/src/AlignmentParameterStore.cc
Revision: 1.10
Committed: Mon Mar 12 21:39:04 2007 UTC (18 years, 1 month ago) by cklae
Content type: text/plain
Branch: MAIN
Changes since 1.9: +60 -91 lines
Log Message:
Remove AlignmentTransformations and use align namespace.

File Contents

# User Rev Content
1 flucke 1.9 /**
2     * \file AlignmentParameterStore.cc
3     *
4 cklae 1.10 * $Revision: 1.9 $
5     * $Date: 2007/02/12 16:06:19 $
6 flucke 1.9 * (last update by $Author: flucke $)
7     */
8    
9 fronga 1.1 #include "FWCore/MessageLogger/interface/MessageLogger.h"
10     #include "FWCore/Utilities/interface/Exception.h"
11    
12 flucke 1.9 #include "Alignment/CommonAlignment/interface/Alignable.h"
13     #include "Alignment/TrackerAlignment/interface/TrackerAlignableId.h"
14    
15 cklae 1.10 #include "Alignment/CommonAlignment/interface/Utilities.h"
16 flucke 1.9 #include "Alignment/CommonAlignmentParametrization/interface/RigidBodyAlignmentParameters.h"
17 cklae 1.10 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentCorrelationsStore.h"
18     #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentExtendedCorrelationsStore.h"
19 fronga 1.1
20     // This class's header
21     #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterStore.h"
22    
23     //__________________________________________________________________________________________________
24 flucke 1.9 AlignmentParameterStore::AlignmentParameterStore( const Alignables &alis,
25 ewidl 1.6 const edm::ParameterSet& config ) :
26 flucke 1.9 theAlignables(alis)
27 fronga 1.1 {
28 flucke 1.9 if (config.getUntrackedParameter<bool>("UseExtendedCorrelations")) {
29     theCorrelationsStore = new AlignmentExtendedCorrelationsStore
30     (config.getParameter<edm::ParameterSet>("ExtendedCorrelationsConfig"));
31     } else {
32 ewidl 1.6 theCorrelationsStore = new AlignmentCorrelationsStore();
33     }
34 fronga 1.1
35     theTrackerAlignableId = new TrackerAlignableId;
36    
37 flucke 1.9 edm::LogInfo("Alignment") << "@SUB=AlignmentParameterStore"
38     << "Created with " << theAlignables.size() << " alignables.";
39     }
40 fronga 1.1
41 flucke 1.9 //__________________________________________________________________________________________________
42     AlignmentParameterStore::~AlignmentParameterStore()
43     {
44     delete theCorrelationsStore;
45     delete theTrackerAlignableId;
46 fronga 1.1 }
47    
48     //__________________________________________________________________________________________________
49 ewidl 1.6 CompositeAlignmentParameters
50 fronga 1.1 AlignmentParameterStore::selectParameters( const std::vector<AlignableDet*>& alignabledets ) const
51     {
52    
53     std::vector<Alignable*> alignables;
54     std::map <AlignableDet*,Alignable*> alidettoalimap;
55     std::map <Alignable*,int> aliposmap;
56     std::map <Alignable*,int> alilenmap;
57     int nparam=0;
58    
59     // iterate over AlignableDet's
60 ewidl 1.6 std::vector<AlignableDet*>::const_iterator iad;
61     for( iad = alignabledets.begin(); iad != alignabledets.end(); ++iad )
62     {
63 flucke 1.9 Alignable* ali = alignableFromAlignableDet( *iad );
64 ewidl 1.6 if ( ali )
65     {
66     alidettoalimap[ *iad ] = ali; // Add to map
67     // Check if Alignable already there, insert into vector if not
68     if ( find(alignables.begin(),alignables.end(),ali) == alignables.end() )
69     {
70     alignables.push_back(ali);
71     AlignmentParameters* ap = ali->alignmentParameters();
72     nparam += ap->numSelected();
73     }
74     }
75     }
76    
77     AlgebraicVector* selpar = new AlgebraicVector( nparam, 0 );
78     AlgebraicSymMatrix* selcov = new AlgebraicSymMatrix( nparam, 0 );
79 fronga 1.1
80 ewidl 1.6 // Fill in parameters and corresponding covariance matricess
81     int ipos = 1; // NOTE: .sub indices start from 1
82     std::vector<Alignable*>::const_iterator it1;
83     for( it1 = alignables.begin(); it1 != alignables.end(); ++it1 )
84     {
85     AlignmentParameters* ap = (*it1)->alignmentParameters();
86     selpar->sub( ipos, ap->selectedParameters() );
87     selcov->sub( ipos, ap->selectedCovariance() );
88     int npar = ap->numSelected();
89     aliposmap[*it1]=ipos;
90     alilenmap[*it1]=npar;
91     ipos +=npar;
92     }
93 fronga 1.1
94 ewidl 1.6 // Fill in the correlations. Has to be an extra loop, because the
95     // AlignmentExtendedCorrelationsStore (if used) needs the
96     // alignables' covariance matrices already present.
97     ipos = 1;
98     for( it1 = alignables.begin(); it1 != alignables.end(); ++it1 )
99     {
100     int jpos=1;
101    
102     // Look for correlations between alignables
103     std::vector<Alignable*>::const_iterator it2;
104     for( it2 = alignables.begin(); it2 != it1; ++it2 )
105     {
106     theCorrelationsStore->correlations( *it1, *it2, *selcov, ipos-1, jpos-1 );
107     jpos += (*it2)->alignmentParameters()->numSelected();
108     }
109 fronga 1.1
110 ewidl 1.6 ipos += (*it1)->alignmentParameters()->numSelected();
111 fronga 1.1 }
112    
113 ewidl 1.6 AlignmentParametersData::DataContainer data( new AlignmentParametersData( selpar, selcov ) );
114     CompositeAlignmentParameters aap( data, alignables, alidettoalimap, aliposmap, alilenmap );
115    
116 fronga 1.1 return aap;
117     }
118    
119    
120     //__________________________________________________________________________________________________
121     void AlignmentParameterStore::updateParameters( const CompositeAlignmentParameters& aap )
122     {
123    
124     std::vector<Alignable*> alignables = aap.components();
125 ewidl 1.6 const AlgebraicVector& parameters = aap.parameters();
126     const AlgebraicSymMatrix& covariance = aap.covariance();
127 fronga 1.1
128 ewidl 1.6 int ipos = 1; // NOTE: .sub indices start from 1
129 fronga 1.1
130     // Loop over alignables
131 ewidl 1.6 for( std::vector<Alignable*>::const_iterator it=alignables.begin(); it != alignables.end(); ++it )
132     {
133     // Update parameters and local covariance
134     AlignmentParameters* ap = (*it)->alignmentParameters();
135     int nsel = ap->numSelected();
136     AlgebraicVector subvec = parameters.sub( ipos, ipos+nsel-1 );
137     AlgebraicSymMatrix subcov = covariance.sub( ipos, ipos+nsel-1 );
138     AlignmentParameters* apnew = ap->cloneFromSelected( subvec, subcov );
139     (*it)->setAlignmentParameters( apnew );
140 fronga 1.1
141 ewidl 1.6 // Now update correlations between detectors
142     int jpos = 1;
143     for( std::vector<Alignable*>::const_iterator it2 = alignables.begin(); it2 != it; ++it2 )
144     {
145     theCorrelationsStore->setCorrelations( *it, *it2, covariance, ipos-1, jpos-1 );
146     jpos += (*it2)->alignmentParameters()->numSelected();
147     }
148    
149     ipos+=nsel;
150     }
151 fronga 1.1
152     }
153    
154    
155     //__________________________________________________________________________________________________
156     std::vector<Alignable*> AlignmentParameterStore::validAlignables(void) const
157     {
158     std::vector<Alignable*> result;
159     for (std::vector<Alignable*>::const_iterator iali = theAlignables.begin();
160 ewidl 1.6 iali != theAlignables.end(); ++iali)
161     if ( (*iali)->alignmentParameters()->isValid() ) result.push_back(*iali);
162 fronga 1.1
163 flucke 1.4 LogDebug("Alignment") << "@SUB=AlignmentParameterStore::validAlignables"
164     << "Valid alignables: " << result.size()
165     << "out of " << theAlignables.size();
166 fronga 1.1 return result;
167     }
168    
169     //__________________________________________________________________________________________________
170 flucke 1.9 Alignable* AlignmentParameterStore::alignableFromAlignableDet( AlignableDet* alignableDet ) const
171 fronga 1.1 {
172 flucke 1.9 Alignable *mother = alignableDet;
173     while (mother) {
174     if (mother->alignmentParameters()) return mother;
175     mother = mother->mother();
176     }
177 fronga 1.1
178 flucke 1.9 return 0;
179 fronga 1.1 }
180    
181     //__________________________________________________________________________________________________
182     void AlignmentParameterStore::applyParameters(void)
183     {
184 ewidl 1.6 std::vector<Alignable*>::const_iterator iali;
185     for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali)
186     applyParameters( *iali );
187 fronga 1.1 }
188    
189    
190     //__________________________________________________________________________________________________
191     void AlignmentParameterStore::applyParameters(Alignable* alignable)
192     {
193    
194     // Get alignment parameters
195     RigidBodyAlignmentParameters* ap =
196 ewidl 1.6 dynamic_cast<RigidBodyAlignmentParameters*>( alignable->alignmentParameters() );
197 fronga 1.1
198     if ( !ap )
199 ewidl 1.6 throw cms::Exception("BadAlignable")
200     << "applyParameters: provided alignable does not have rigid body alignment parameters";
201 fronga 1.1
202     // Translation in local frame
203 cklae 1.10 AlgebraicVector shift = ap->translation(); // fixme: should be LocalVector
204 fronga 1.1
205     // Translation local->global
206 cklae 1.10 align::LocalVector lv(shift[0], shift[1], shift[2]);
207     alignable->move( alignable->surface().toGlobal(lv) );
208 fronga 1.1
209     // Rotation in local frame
210 cklae 1.10 align::EulerAngles angles = ap->rotation();
211     if (angles.normsq() > 1e-10)
212 ewidl 1.6 {
213 cklae 1.10 alignable->rotateInLocalFrame( align::toMatrix(angles) );
214 ewidl 1.6 }
215 fronga 1.1 }
216    
217    
218     //__________________________________________________________________________________________________
219     void AlignmentParameterStore::resetParameters(void)
220     {
221     // Erase contents of correlation map
222 ewidl 1.6 theCorrelationsStore->resetCorrelations();
223 fronga 1.1
224     // Iterate over alignables in the store and reset parameters
225 ewidl 1.6 std::vector<Alignable*>::const_iterator iali;
226     for ( iali = theAlignables.begin(); iali != theAlignables.end(); ++iali )
227     resetParameters( *iali );
228 fronga 1.1 }
229    
230    
231     //__________________________________________________________________________________________________
232     void AlignmentParameterStore::resetParameters( Alignable* ali )
233     {
234     if ( ali )
235 ewidl 1.6 {
236     // Get alignment parameters for this alignable
237     AlignmentParameters* ap = ali->alignmentParameters();
238     if ( ap )
239 flucke 1.4 {
240 ewidl 1.6 int npar=ap->numSelected();
241 flucke 1.4
242 ewidl 1.6 AlgebraicVector par(npar,0);
243     AlgebraicSymMatrix cov(npar,0);
244     AlignmentParameters* apnew = ap->cloneFromSelected(par,cov);
245     ali->setAlignmentParameters(apnew);
246     apnew->setValid(false);
247 flucke 1.4 }
248 ewidl 1.6 else
249     edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore::resetParameters"
250     << "alignable has no alignment parameter";
251     }
252 fronga 1.1 else
253 flucke 1.4 edm::LogError("BadArgument") << "@SUB=AlignmentParameterStore::resetParameters"
254     << "argument is NULL";
255 fronga 1.1 }
256    
257    
258     //__________________________________________________________________________________________________
259     void AlignmentParameterStore::acquireRelativeParameters(void)
260     {
261    
262 cklae 1.10 unsigned int nAlignables = theAlignables.size();
263    
264     for (unsigned int i = 0; i < nAlignables; ++i)
265 ewidl 1.6 {
266 cklae 1.10 Alignable* ali = theAlignables[i];
267    
268 ewidl 1.6 RigidBodyAlignmentParameters* ap =
269 cklae 1.10 dynamic_cast<RigidBodyAlignmentParameters*>( ali->alignmentParameters() );
270 ewidl 1.6
271     if ( !ap )
272     throw cms::Exception("BadAlignable")
273     << "acquireRelativeParameters: "
274     << "provided alignable does not have rigid body alignment parameters";
275 fronga 1.1
276 ewidl 1.6 AlgebraicVector par( ap->size(),0 );
277     AlgebraicSymMatrix cov( ap->size(), 0 );
278 fronga 1.1
279 ewidl 1.6 // Get displacement and transform global->local
280 cklae 1.10 align::LocalVector dloc = ali->surface().toLocal( ali->displacement() );
281 ewidl 1.6 par[0]=dloc.x();
282     par[1]=dloc.y();
283     par[2]=dloc.z();
284    
285     // Transform to local euler angles
286 cklae 1.10 align::EulerAngles euloc = align::toAngles( ali->surface().toLocal( ali->rotation() ) );
287     par[3]=euloc(1);
288     par[4]=euloc(2);
289     par[5]=euloc(3);
290 fronga 1.1
291 ewidl 1.6 // Clone parameters
292     RigidBodyAlignmentParameters* apnew = ap->clone(par,cov);
293 fronga 1.1
294 cklae 1.10 ali->setAlignmentParameters(apnew);
295 ewidl 1.6 }
296 fronga 1.1 }
297    
298    
299     //__________________________________________________________________________________________________
300     // Get type/layer from Alignable
301     // type: -6 -5 -4 -3 -2 -1 1 2 3 4 5 6
302     // TEC- TOB- TID- TIB- PxEC- PxBR- PxBr+ PxEC+ TIB+ TID+ TOB+ TEC+
303     // Layers start from zero
304 flucke 1.9 std::pair<int,int> AlignmentParameterStore::typeAndLayer(const Alignable* ali) const
305 fronga 1.1 {
306     return theTrackerAlignableId->typeAndLayerFromAlignable( ali );
307     }
308    
309    
310     //__________________________________________________________________________________________________
311     void AlignmentParameterStore::
312     applyAlignableAbsolutePositions( const Alignables& alivec,
313 ewidl 1.6 const AlignablePositions& newpos,
314     int& ierr )
315 fronga 1.1 {
316     unsigned int nappl=0;
317     ierr=0;
318    
319     // Iterate over list of alignables
320 ewidl 1.6 for ( Alignables::const_iterator iali = alivec.begin(); iali != alivec.end(); ++iali )
321     {
322     Alignable* ali = *iali;
323     unsigned int detId = theTrackerAlignableId->alignableId(ali);
324     int typeId = theTrackerAlignableId->alignableTypeId(ali);
325    
326     // Find corresponding entry in AlignablePositions
327     bool found=false;
328     for ( AlignablePositions::const_iterator ipos = newpos.begin(); ipos != newpos.end(); ++ipos )
329     if ( detId == ipos->id() && typeId == ipos->objId() )
330     if ( found )
331     edm::LogError("DuplicatePosition")
332     << "New positions for alignable found more than once!";
333     else
334     {
335     // New position/rotation
336 cklae 1.10 const align::PositionType& pnew = ipos->pos();
337     const align::RotationType& rnew = ipos->rot();
338 ewidl 1.6 // Current position / rotation
339 cklae 1.10 const align::PositionType& pold = ali->globalPosition();
340     const align::RotationType& rold = ali->globalRotation();
341 fronga 1.1
342 ewidl 1.6 // shift needed to move from current to new position
343 cklae 1.10 align::GlobalVector posDiff = pnew - pold;
344     align::RotationType rotDiff = rold.multiplyInverse(rnew);
345     align::rectify(rotDiff); // correct for rounding errors
346     ali->move( posDiff );
347     ali->rotateInGlobalFrame( rotDiff );
348     LogDebug("NewPosition") << "moving by:" << posDiff;
349     LogDebug("NewRotation") << "rotating by:\n" << rotDiff;
350    
351 ewidl 1.6 // add position error
352     // AlignmentPositionError ape(shift.x(),shift.y(),shift.z());
353     // (*iali)->addAlignmentPositionError(ape);
354     // (*iali)->addAlignmentPositionErrorFromRotation(rot);
355 fronga 1.1
356 ewidl 1.6 found=true;
357     ++nappl;
358 fronga 1.1 }
359 ewidl 1.6 }
360 fronga 1.1
361     if ( nappl< newpos.size() )
362 ewidl 1.6 edm::LogError("Mismatch") << "Applied only " << nappl << " new positions"
363     << " out of " << newpos.size();
364 fronga 1.1
365 flucke 1.4 LogDebug("NewPositions") << "Applied new positions for " << nappl
366     << " out of " << alivec.size() <<" alignables.";
367 fronga 1.1
368     }
369    
370    
371     //__________________________________________________________________________________________________
372     void AlignmentParameterStore::
373 ewidl 1.6 applyAlignableRelativePositions( const Alignables& alivec, const AlignableShifts& shifts, int& ierr )
374 fronga 1.1 {
375    
376 cklae 1.10 ierr=0;
377 fronga 1.1 unsigned int nappl=0;
378 cklae 1.10 unsigned int nAlignables = alivec.size();
379 fronga 1.1
380 cklae 1.10 for (unsigned int i = 0; i < nAlignables; ++i)
381 ewidl 1.6 {
382 cklae 1.10 Alignable* ali = alivec[i];
383    
384     unsigned int detId = theTrackerAlignableId->alignableId(ali);
385     int typeId=theTrackerAlignableId->alignableTypeId(ali);
386 ewidl 1.6
387     // Find corresponding entry in AlignableShifts
388     bool found = false;
389     for ( AlignableShifts::const_iterator ipos = shifts.begin(); ipos != shifts.end(); ++ipos )
390     {
391     if ( detId == ipos->id() && typeId == ipos->objId() )
392     if ( found )
393     edm::LogError("DuplicatePosition")
394     << "New positions for alignable found more than once!";
395     else
396     {
397 cklae 1.10 ali->move( ipos->pos() );
398     ali->rotateInGlobalFrame( ipos->rot() );
399 ewidl 1.6
400     // Add position error
401     //AlignmentPositionError ape(pnew.x(),pnew.y(),pnew.z());
402 cklae 1.10 //ali->addAlignmentPositionError(ape);
403     //ali->addAlignmentPositionErrorFromRotation(rnew);
404 fronga 1.1
405 ewidl 1.6 found=true;
406     ++nappl;
407 fronga 1.1 }
408 ewidl 1.6 }
409     }
410 fronga 1.1
411     if ( nappl < shifts.size() )
412 ewidl 1.6 edm::LogError("Mismatch") << "Applied only " << nappl << " new positions"
413     << " out of " << shifts.size();
414 fronga 1.1
415 flucke 1.4 LogDebug("NewPositions") << "Applied new positions for " << nappl << " alignables.";
416 fronga 1.1 }
417    
418    
419    
420     //__________________________________________________________________________________________________
421     void AlignmentParameterStore::attachAlignmentParameters( const Parameters& parvec, int& ierr )
422     {
423     attachAlignmentParameters( theAlignables, parvec, ierr);
424     }
425    
426    
427    
428     //__________________________________________________________________________________________________
429     void AlignmentParameterStore::attachAlignmentParameters( const Alignables& alivec,
430 ewidl 1.6 const Parameters& parvec, int& ierr )
431 fronga 1.1 {
432     int ipass = 0;
433     int ifail = 0;
434     ierr = 0;
435    
436     // Iterate over alignables
437 ewidl 1.6 for ( Alignables::const_iterator iali = alivec.begin(); iali != alivec.end(); ++iali )
438     {
439     // Iterate over Parameters
440     bool found=false;
441     for ( Parameters::const_iterator ipar = parvec.begin(); ipar != parvec.end(); ++ipar)
442     {
443     // Get new alignment parameters
444     RigidBodyAlignmentParameters* ap = dynamic_cast<RigidBodyAlignmentParameters*>(*ipar);
445    
446     // Check if parameters belong to alignable
447     if ( ap->alignable() == (*iali) )
448     {
449     if (!found)
450     {
451     (*iali)->setAlignmentParameters(ap);
452     ++ipass;
453     found=true;
454     }
455     else edm::LogError("DuplicateParameters") << "More than one parameters for Alignable";
456     }
457     }
458     if (!found) ++ifail;
459     }
460 fronga 1.1 if (ifail>0) ierr=-1;
461    
462 ewidl 1.6 LogDebug("attachAlignmentParameters") << " Parameters, Alignables: " << parvec.size() << ","
463     << alivec.size() << "\n pass,fail: " << ipass << ","<< ifail;
464 fronga 1.1 }
465    
466    
467     //__________________________________________________________________________________________________
468     void AlignmentParameterStore::attachCorrelations( const Correlations& cormap,
469 ewidl 1.6 bool overwrite, int& ierr )
470 fronga 1.1 {
471     attachCorrelations( theAlignables, cormap, overwrite, ierr );
472     }
473    
474    
475     //__________________________________________________________________________________________________
476     void AlignmentParameterStore::attachCorrelations( const Alignables& alivec,
477 ewidl 1.6 const Correlations& cormap,
478     bool overwrite, int& ierr )
479 fronga 1.1 {
480     ierr=0;
481     int icount=0;
482    
483     // Iterate over correlations
484 ewidl 1.6 for ( Correlations::const_iterator icor = cormap.begin(); icor!=cormap.end(); ++icor )
485     {
486     AlgebraicMatrix mat=(*icor).second;
487     Alignable* ali1 = (*icor).first.first;
488     Alignable* ali2 = (*icor).first.second;
489    
490     // Check if alignables exist
491     if ( find( alivec.begin(), alivec.end(), ali1 ) != alivec.end() &&
492     find( alivec.begin(), alivec.end(), ali2 ) != alivec.end() )
493     {
494     // Check if correlations already existing between these alignables
495     if ( !theCorrelationsStore->correlationsAvailable(ali1,ali2) || (overwrite) )
496     {
497     theCorrelationsStore->setCorrelations(ali1,ali2,mat);
498     ++icount;
499     }
500     else edm::LogInfo("AlreadyExists") << "Correlation existing and not overwritten";
501     }
502     else edm::LogInfo("IgnoreCorrelation") << "Ignoring correlation with no alignables!";
503     }
504 fronga 1.1
505 ewidl 1.6 LogDebug( "attachCorrelations" ) << " Alignables,Correlations: " << alivec.size() <<","<< cormap.size()
506     << "\n applied: " << icount ;
507 fronga 1.1
508     }
509    
510    
511     //__________________________________________________________________________________________________
512     void AlignmentParameterStore::
513     attachUserVariables( const Alignables& alivec,
514 ewidl 1.6 const std::vector<AlignmentUserVariables*>& uvarvec, int& ierr )
515 fronga 1.1 {
516     ierr=0;
517    
518 flucke 1.4 LogDebug("DumpArguments") << "size of alivec: " << alivec.size()
519     << "\nsize of uvarvec: " << uvarvec.size();
520 fronga 1.1
521     std::vector<AlignmentUserVariables*>::const_iterator iuvar=uvarvec.begin();
522    
523 ewidl 1.6 for ( Alignables::const_iterator iali=alivec.begin(); iali!=alivec.end(); ++iali, ++iuvar )
524     {
525     AlignmentParameters* ap = (*iali)->alignmentParameters();
526     AlignmentUserVariables* uvarnew = (*iuvar);
527     ap->setUserVariables(uvarnew);
528     }
529 fronga 1.1 }
530    
531    
532     //__________________________________________________________________________________________________
533     void AlignmentParameterStore::setAlignmentPositionError( const Alignables& alivec,
534 cklae 1.10 const double valshift, const double valrot )
535 fronga 1.1 {
536 cklae 1.10 LogDebug("StoreAPE") << "Store APE from shift: " << valshift;
537     LogDebug("StoreAPE") << "Store APE from rotation: " << valrot;
538    
539     unsigned int nAlignables = alivec.size();
540    
541     for (unsigned int i = 0; i < nAlignables; ++i)
542 ewidl 1.6 {
543 cklae 1.10 Alignable* ali = alivec[i];
544 fronga 1.1
545 fronga 1.7 // First reset APE
546     AlignmentPositionError nulApe(0,0,0);
547 cklae 1.10 ali->setAlignmentPositionError(nulApe);
548 fronga 1.7
549     // Set APE from displacement
550     AlignmentPositionError ape(valshift,valshift,valshift);
551 cklae 1.10 if ( valshift > 0. ) ali->addAlignmentPositionError(ape);
552     else ali->setAlignmentPositionError(ape);
553 fronga 1.7
554     // Set APE from rotation
555 cklae 1.10 align::EulerAngles r(3);
556     r(1)=valrot; r(2)=valrot; r(3)=valrot;
557     ali->addAlignmentPositionErrorFromRotation( align::toMatrix(r) );
558 ewidl 1.6 }
559 fronga 1.1 }