CMS 3D CMS Logo

AlignableDet Class Reference

An AlignableComposite corresponding to a composite GeomDet direct components are AlignableDetUnits or AlignableDets. More...

#include <Alignment/CommonAlignment/interface/AlignableDet.h>

Inheritance diagram for AlignableDet:

AlignableComposite Alignable AlignableCSCChamber AlignableDTChamber AlignableDTSuperLayer AlignableSiStripDet

List of all members.

Public Member Functions

virtual void addAlignmentPositionError (const AlignmentPositionError &ape)
 Add (or set if it does not exist yet) the AlignmentPositionError.
virtual void addAlignmentPositionErrorFromLocalRotation (const RotationType &rot)
 Add (or set if it does not exist yet) the AlignmentPositionError resulting from a rotation in the local reference frame.
virtual void addAlignmentPositionErrorFromRotation (const RotationType &rot)
 Add (or set if it does not exist yet) the AlignmentPositionError resulting from a rotation in the global reference frame.
 AlignableDet (const GeomDet *geomDet, bool addComponents=true)
 Constructor: If addComponents = true, creates components for geomDet's components, assuming they are GeomDetUnits.
virtual AlignmentErrorsalignmentErrors () const
 Return vector of alignment errors.
virtual Alignmentsalignments () const
 Return vector of alignment data.
virtual void setAlignmentPositionError (const AlignmentPositionError &ape)
 Set alignment position error of this and all components to given error.
virtual ~AlignableDet ()
 Destructor.

Private Attributes

AlignmentPositionErrortheAlignmentPositionError


Detailed Description

An AlignableComposite corresponding to a composite GeomDet direct components are AlignableDetUnits or AlignableDets.

Definition at line 8 of file AlignableDet.h.


Constructor & Destructor Documentation

AlignableDet::AlignableDet ( const GeomDet geomDet,
bool  addComponents = true 
)

Constructor: If addComponents = true, creates components for geomDet's components, assuming they are GeomDetUnits.

Definition at line 14 of file AlignableDet.cc.

References AlignableComposite::addComponent(), align::AlignableDetUnit, GeomDet::components(), GeomDet::surface(), and Alignable::theSurface.

00014                                                                        : 
00015   AlignableComposite( geomDet ), 
00016   theAlignmentPositionError(0)
00017 {
00018   if (addComponents) {
00019       
00020     // Behaviour depends on level of components:
00021     // Check if the AlignableDet is a CompositeDet or a DetUnit
00022     
00023     if ( geomDet->components().size() == 0 ) // Is a DetUnit
00024     {
00025       edm::LogError("Alignment") << "@SUB=AlignableDet"
00026                                    << "No components, will become exception!";
00027       addComponent( new AlignableDetUnit( id(), geomDet->surface() ) );
00028     }
00029     else // Is a compositeDet: push back all components
00030     {
00031       const std::vector<const GeomDet*>& geomDets = geomDet->components();
00032       for ( std::vector<const GeomDet*>::const_iterator idet=geomDets.begin(); 
00033             idet != geomDets.end(); ++idet )
00034         {
00035           addComponent( new AlignableDetUnit( (*idet)->geographicalId().rawId(),
00036                                               (*idet)->surface() ) );
00037         }
00038     }
00039     // Ensure that the surface is not screwed up by addComponent, it must stay the GeomDet's one:
00040     theSurface = AlignableSurface(geomDet->surface());
00041   } // end addComponents  
00042 }

AlignableDet::~AlignableDet (  )  [virtual]

Destructor.

Definition at line 46 of file AlignableDet.cc.

References theAlignmentPositionError.

00047 {
00048 
00049   delete theAlignmentPositionError;
00050 
00051 }


Member Function Documentation

void AlignableDet::addAlignmentPositionError ( const AlignmentPositionError ape  )  [virtual]

Add (or set if it does not exist yet) the AlignmentPositionError.

Reimplemented from AlignableComposite.

Definition at line 69 of file AlignableDet.cc.

References AlignableComposite::addAlignmentPositionError(), and theAlignmentPositionError.

Referenced by addAlignmentPositionErrorFromRotation().

00070 {
00071 
00072   if ( !theAlignmentPositionError ) {
00073     theAlignmentPositionError = new AlignmentPositionError( ape );
00074   } else {
00075     // *theAlignmentPositionError += ape; grrr... buggy AlignmentPositionError::operator+=
00076     *theAlignmentPositionError = (*theAlignmentPositionError) += ape;
00077   }
00078 
00079   AlignableComposite::addAlignmentPositionError( ape );
00080 
00081 }

void AlignableDet::addAlignmentPositionErrorFromLocalRotation ( const RotationType rot  )  [virtual]

Add (or set if it does not exist yet) the AlignmentPositionError resulting from a rotation in the local reference frame.

Reimplemented from AlignableComposite.

Definition at line 102 of file AlignableDet.cc.

References AlignableComposite::addAlignmentPositionErrorFromLocalRotation(), addAlignmentPositionErrorFromRotation(), Alignable::globalRotation(), and TkRotation< T >::multiplyInverse().

00103 {
00104 
00105   RotationType globalRot = globalRotation().multiplyInverse(rot*globalRotation());
00106   this->addAlignmentPositionErrorFromRotation(globalRot);
00107 
00108   AlignableComposite::addAlignmentPositionErrorFromLocalRotation( rot );
00109 
00110 }

void AlignableDet::addAlignmentPositionErrorFromRotation ( const RotationType rot  )  [virtual]

Add (or set if it does not exist yet) the AlignmentPositionError resulting from a rotation in the global reference frame.

Reimplemented from AlignableComposite.

Definition at line 84 of file AlignableDet.cc.

References addAlignmentPositionError(), AlignableComposite::addAlignmentPositionErrorFromRotation(), PV3DBase< T, PVType, FrameType >::basicVector(), TkRotation< T >::multiplyInverse(), Alignable::surface(), AlignableSurface::toGlobal(), and width.

Referenced by addAlignmentPositionErrorFromLocalRotation().

00085 {
00086 
00087   // average error calculated by movement of a local point at
00088   // (xWidth/2,yLength/2,0) caused by the rotation rot
00089   GlobalVector localPositionVector = surface().toGlobal( LocalVector(.5 * surface().width(), .5 * surface().length(), 0.) );
00090 
00091   LocalVector::BasicVectorType lpvgf = localPositionVector.basicVector();
00092   GlobalVector gv( rot.multiplyInverse(lpvgf) - lpvgf );
00093 
00094   AlignmentPositionError  ape( gv.x(),gv.y(),gv.z() );
00095   this->addAlignmentPositionError( ape );
00096 
00097   AlignableComposite::addAlignmentPositionErrorFromRotation( rot );
00098 
00099 }

AlignmentErrors * AlignableDet::alignmentErrors ( void   )  const [virtual]

Return vector of alignment errors.

Reimplemented from AlignableComposite.

Reimplemented in AlignableSiStripDet.

Definition at line 152 of file AlignableDet.cc.

References AlignableComposite::components(), edmNew::copy(), detId, Alignable::geomDetId(), AlignmentPositionError::globalError(), i, AlignmentErrors::m_alignError, GlobalErrorBase< T, ErrorWeightType >::matrix(), DetId::rawId(), and theAlignmentPositionError.

Referenced by AlignableSiStripDet::alignmentErrors(), and AlignableSiStripDet::consistifyAlignmentErrors().

00153 {
00154 
00155 
00156   AlignmentErrors* m_alignmentErrors = new AlignmentErrors();
00157 
00158   // Add associated alignment position error
00159   uint32_t detId = this->geomDetId().rawId();
00160   HepSymMatrix clhepSymMatrix(3,0);
00161   if ( theAlignmentPositionError ) // Might not be set
00162     clhepSymMatrix= theAlignmentPositionError->globalError().matrix();
00163   AlignTransformError transformError( clhepSymMatrix, detId );
00164   m_alignmentErrors->m_alignError.push_back( transformError );
00165   
00166   // Add components recursively (if it is not already an alignable det unit)
00167   std::vector<Alignable*> comp = this->components();
00168   if ( comp.size() > 1 ) {
00169     for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
00170       {
00171                 AlignmentErrors* tmpAlignmentErrors = (*i)->alignmentErrors();
00172                 std::copy( tmpAlignmentErrors->m_alignError.begin(),
00173                            tmpAlignmentErrors->m_alignError.end(), 
00174                            std::back_inserter(m_alignmentErrors->m_alignError) );
00175                 delete tmpAlignmentErrors;
00176       }
00177   }
00178   
00179   return m_alignmentErrors;
00180 
00181 }

Alignments * AlignableDet::alignments ( void   )  const [virtual]

Return vector of alignment data.

Reimplemented from AlignableComposite.

Reimplemented in AlignableSiStripDet.

Definition at line 115 of file AlignableDet.cc.

References AlignableComposite::components(), edmNew::copy(), detId, Alignable::geomDetId(), Alignable::globalPosition(), i, Alignments::m_align, DetId::rawId(), rot, x, y, and z.

Referenced by AlignableSiStripDet::alignments().

00116 {
00117 
00118   Alignments* m_alignments = new Alignments();
00119   RotationType rot( this->globalRotation() );
00120 
00121   // Get position, rotation, detId
00122   Hep3Vector clhepVector( globalPosition().x(), globalPosition().y(), globalPosition().z() );
00123   HepRotation clhepRotation( HepRep3x3( rot.xx(), rot.xy(), rot.xz(),
00124                                         rot.yx(), rot.yy(), rot.yz(),
00125                                         rot.zx(), rot.zy(), rot.zz() ) );
00126   uint32_t detId = this->geomDetId().rawId();
00127   
00128   AlignTransform transform( clhepVector, clhepRotation, detId );
00129   
00130   // Add to alignments container
00131   m_alignments->m_align.push_back( transform );
00132 
00133   // Add components recursively (if it is not already an alignable det unit)
00134   std::vector<Alignable*> comp = this->components();
00135   if ( comp.size() > 1 ) {
00136     for ( std::vector<Alignable*>::iterator i=comp.begin(); i!=comp.end(); i++ )
00137       {
00138         Alignments* tmpAlignments = (*i)->alignments();
00139         std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), 
00140                    std::back_inserter(m_alignments->m_align) );
00141         delete tmpAlignments;
00142       }
00143   }
00144 
00145 
00146   return m_alignments;
00147 
00148 }

void AlignableDet::setAlignmentPositionError ( const AlignmentPositionError ape  )  [virtual]

Set alignment position error of this and all components to given error.

Reimplemented from AlignableComposite.

Definition at line 55 of file AlignableDet.cc.

References AlignableComposite::setAlignmentPositionError(), and theAlignmentPositionError.

Referenced by AlignableSiStripDet::consistifyAlignmentErrors().

00056 {
00057 
00058   if ( !theAlignmentPositionError )
00059         theAlignmentPositionError = new AlignmentPositionError( ape );
00060   else 
00061         *theAlignmentPositionError = ape;
00062 
00063   AlignableComposite::setAlignmentPositionError( ape );
00064 
00065 }


Member Data Documentation

AlignmentPositionError* AlignableDet::theAlignmentPositionError [private]

Definition at line 42 of file AlignableDet.h.

Referenced by addAlignmentPositionError(), alignmentErrors(), setAlignmentPositionError(), and ~AlignableDet().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:18 2009 for CMSSW by  doxygen 1.5.4