#include <Alignment/CommonAlignment/interface/AlignableComposite.h>
Public Member Functions | |
virtual void | addAlignmentPositionError (const AlignmentPositionError &ape) |
Add the AlignmentPositionError to all the components of the composite. | |
virtual void | addAlignmentPositionErrorFromLocalRotation (const RotationType &rotation) |
Add position error to all components as resulting from given local rotation. | |
virtual void | addAlignmentPositionErrorFromRotation (const RotationType &rotation) |
Add position error to all components as resulting from global rotation. | |
virtual void | addComponent (Alignable *component) |
Add a component and set its mother to this alignable. | |
AlignableComposite (align::ID id, StructureType aType, const RotationType &rot=RotationType()) | |
Constructor for a composite with given rotation. | |
virtual StructureType | alignableObjectId () const |
Return the alignable type identifier. | |
virtual AlignmentErrors * | alignmentErrors () const |
Return vector of alignment errors. | |
virtual Alignments * | alignments () const |
Return alignment data. | |
virtual Alignables | components () const |
Return vector of direct components. | |
virtual void | dump () const |
Recursive printout of alignable structure. | |
virtual void | move (const GlobalVector &displacement) |
Move with respect to the global reference frame. | |
virtual void | moveComponentLocal (const int i, const LocalVector &localDisplacement) |
Move a single component with respect to the local reference frame. | |
virtual void | moveComponentsLocal (const LocalVector &localDisplacement) |
Move with respect to the local reference frame. | |
virtual void | recursiveComponents (Alignables &result) const |
Provide all components, subcomponents etc. (cf. description in base class). | |
virtual void | rotateInGlobalFrame (const RotationType &rotation) |
Rotation interpreted in global reference frame. | |
virtual void | setAlignmentPositionError (const AlignmentPositionError &ape) |
Set the AlignmentPositionError to all the components of the composite. | |
virtual | ~AlignableComposite () |
deleting its components | |
Protected Member Functions | |
AlignableComposite (const GeomDet *geomDet) | |
Constructor from GeomDet, only for use in AlignableDet. | |
void | setSurface (const AlignableSurface &s) |
Protected Attributes | |
StructureType | theStructureType |
Private Member Functions | |
AlignableComposite () | |
default constructor hidden | |
Private Attributes | |
Alignables | theComponents |
Definition at line 25 of file AlignableComposite.h.
AlignableComposite::AlignableComposite | ( | align::ID | id, | |
StructureType | aType, | |||
const RotationType & | rot = RotationType() | |||
) |
Constructor for a composite with given rotation.
Position can be found from average of daughters' positions later, using addComponent(Alignable*).
Definition at line 20 of file AlignableComposite.cc.
00022 : 00023 Alignable(id, rot), 00024 theStructureType(type) 00025 { 00026 }
AlignableComposite::~AlignableComposite | ( | ) | [virtual] |
deleting its components
Definition at line 28 of file AlignableComposite.cc.
References i, and theComponents.
00029 { 00030 for (unsigned int i = 0; i < theComponents.size(); ++i) delete theComponents[i]; 00031 }
AlignableComposite::AlignableComposite | ( | const GeomDet * | geomDet | ) | [explicit, protected] |
Constructor from GeomDet, only for use in AlignableDet.
Definition at line 14 of file AlignableComposite.cc.
00014 : 00015 Alignable( geomDet->geographicalId().rawId(), geomDet->surface() ), 00016 theStructureType(align::AlignableDet) 00017 { 00018 }
AlignableComposite::AlignableComposite | ( | ) | [inline, private] |
default constructor hidden
Definition at line 96 of file AlignableComposite.h.
Referenced by AlignableTracker::buildBarrel(), and AlignableTracker::buildTRK().
00096 : Alignable (0, RotationType()) {};
void AlignableComposite::addAlignmentPositionError | ( | const AlignmentPositionError & | ape | ) | [virtual] |
Add the AlignmentPositionError to all the components of the composite.
Implements Alignable.
Reimplemented in AlignableDet.
Definition at line 171 of file AlignableComposite.cc.
References components(), and i.
Referenced by AlignableDet::addAlignmentPositionError().
00172 { 00173 00174 Alignables comp = this->components(); 00175 for ( Alignables::const_iterator i=comp.begin(); i!=comp.end(); i++) 00176 (*i)->addAlignmentPositionError(ape); 00177 00178 }
void AlignableComposite::addAlignmentPositionErrorFromLocalRotation | ( | const RotationType & | rotation | ) | [virtual] |
Add position error to all components as resulting from given local rotation.
Adds the AlignmentPositionError (in x,y,z coordinates) that would result on the various components from a possible Rotation of a composite the rotation matrix is in interpreted in LOCAL coordinates of the composite.
Implements Alignable.
Reimplemented in AlignableDet.
Definition at line 219 of file AlignableComposite.cc.
References addAlignmentPositionErrorFromRotation(), Alignable::globalRotation(), and TkRotation< T >::multiplyInverse().
Referenced by AlignableDet::addAlignmentPositionErrorFromLocalRotation().
00220 { 00221 00222 RotationType globalRot = globalRotation().multiplyInverse(rot*globalRotation()); 00223 this->addAlignmentPositionErrorFromRotation(globalRot); 00224 00225 }
void AlignableComposite::addAlignmentPositionErrorFromRotation | ( | const RotationType & | rotation | ) | [virtual] |
Add position error to all components as resulting from global rotation.
Adds the AlignmentPositionError (in x,y,z coordinates) that would result on the various components from a possible Rotation of a composite the rotation matrix is in interpreted in GLOBAL coordinates.
Implements Alignable.
Reimplemented in AlignableDet.
Definition at line 185 of file AlignableComposite.cc.
References PV3DBase< T, PVType, FrameType >::basicVector(), components(), Alignable::globalPosition(), i, and TkRotation< T >::multiplyInverse().
Referenced by addAlignmentPositionErrorFromLocalRotation(), and AlignableDet::addAlignmentPositionErrorFromRotation().
00186 { 00187 00188 Alignables comp = this->components(); 00189 00190 PositionType myPosition=this->globalPosition(); 00191 00192 for ( Alignables::const_iterator i=comp.begin(); i!=comp.end(); i++ ) 00193 { 00194 00195 // It is just similar to to the "movement" that results to the components 00196 // when the composite is rotated. 00197 // Local Position given in coordinates of the GLOBAL Frame 00198 const GlobalVector localPositionVector = (**i).globalPosition()-myPosition; 00199 GlobalVector::BasicVectorType lpvgf = localPositionVector.basicVector(); 00200 00201 // rotate with GLOBAL rotation matrix and subtract => moveVector in global coordinates 00202 // apparently... you have to use the inverse of the rotation here 00203 // (rotate the VECTOR rather than the frame) 00204 GlobalVector moveVector( rotation.multiplyInverse(lpvgf) - lpvgf ); 00205 00206 AlignmentPositionError ape( moveVector.x(), moveVector.y(), moveVector.z() ); 00207 (*i)->addAlignmentPositionError( ape ); 00208 (*i)->addAlignmentPositionErrorFromRotation( rotation ); 00209 00210 } 00211 00212 }
Add a component and set its mother to this alignable.
(Note: The component will be adopted, e.g. later deleted.) Also find average position of this composite from its modules' positions.
Implements Alignable.
Definition at line 33 of file AlignableComposite.cc.
References Alignable::deepComponents(), Alignable::globalPosition(), k, GloballyPositioned< T >::move(), Alignable::setMother(), theComponents, Alignable::theDeepComponents, and Alignable::theSurface.
Referenced by AlignableDet::AlignableDet(), AlignableDTChamber::AlignableDTChamber(), and AlignableTracker::buildTRK().
00034 { 00035 const Alignables& newComps = ali->deepComponents(); 00036 00037 theDeepComponents.insert( theDeepComponents.end(), newComps.begin(), newComps.end() ); 00038 00039 Scalar k = static_cast<Scalar>( newComps.size() ) / theDeepComponents.size(); 00040 00041 theSurface.move( ( ali->globalPosition() - globalPosition() ) * k ); 00042 00043 ali->setMother(this); 00044 theComponents.push_back(ali); 00045 }
virtual StructureType AlignableComposite::alignableObjectId | ( | ) | const [inline, virtual] |
Return the alignable type identifier.
Implements Alignable.
Definition at line 75 of file AlignableComposite.h.
References theStructureType.
Referenced by dump().
00075 { return theStructureType; }
AlignmentErrors * AlignableComposite::alignmentErrors | ( | void | ) | const [virtual] |
Return vector of alignment errors.
Implements Alignable.
Reimplemented in AlignableDet, AlignableCSCEndcap, AlignableDTBarrel, AlignableMuon, AlignableSiStripDet, and AlignableTracker.
Definition at line 275 of file AlignableComposite.cc.
References components(), edmNew::copy(), i, and AlignmentErrors::m_alignError.
00276 { 00277 00278 // Recursively call alignmentsErrors, until we get to an AlignableDetUnit 00279 Alignables comp = this->components(); 00280 00281 AlignmentErrors* m_alignmentErrors = new AlignmentErrors(); 00282 00283 // Add components recursively 00284 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ ) 00285 { 00286 AlignmentErrors* tmpAlignmentErrors = (*i)->alignmentErrors(); 00287 std::copy( tmpAlignmentErrors->m_alignError.begin(), tmpAlignmentErrors->m_alignError.end(), 00288 std::back_inserter(m_alignmentErrors->m_alignError) ); 00289 delete tmpAlignmentErrors; 00290 } 00291 00292 00293 return m_alignmentErrors; 00294 00295 }
Alignments * AlignableComposite::alignments | ( | void | ) | const [virtual] |
Return alignment data.
Implements Alignable.
Reimplemented in AlignableDet, AlignableCSCEndcap, AlignableDTBarrel, AlignableMuon, AlignableSiStripDet, and AlignableTracker.
Definition at line 251 of file AlignableComposite.cc.
References components(), edmNew::copy(), i, and Alignments::m_align.
00252 { 00253 00254 // Recursively call alignments, until we get to an AlignableDetUnit 00255 Alignables comp = this->components(); 00256 00257 Alignments* m_alignments = new Alignments(); 00258 00259 // Add components recursively 00260 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ ) 00261 { 00262 Alignments* tmpAlignments = (*i)->alignments(); 00263 std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), 00264 std::back_inserter(m_alignments->m_align) ); 00265 delete tmpAlignments; 00266 } 00267 00268 00269 return m_alignments; 00270 00271 }
virtual Alignables AlignableComposite::components | ( | ) | const [inline, virtual] |
Return vector of direct components.
Implements Alignable.
Reimplemented in AlignableCSCEndcap, AlignableCSCRing, AlignableCSCStation, AlignableDTBarrel, AlignableDTStation, AlignableDTWheel, and AlignableMuon.
Definition at line 45 of file AlignableComposite.h.
References theComponents.
Referenced by addAlignmentPositionError(), addAlignmentPositionErrorFromRotation(), AlignmentParameterSelector::addAllAlignables(), AlignmentParameterSelector::addSelection(), AlignableTracker::AlignableTracker(), alignmentErrors(), AlignableDet::alignmentErrors(), AlignableTracker::alignmentErrors(), alignments(), AlignableTracker::alignments(), AlignableDet::alignments(), AlignableTracker::detsToAlignables(), dump(), KalmanAlignmentAlgorithm::initialize(), move(), moveComponentLocal(), operator<<(), recursiveComponents(), rotateInGlobalFrame(), and setAlignmentPositionError().
00045 { return theComponents; }
Recursive printout of alignable structure.
Implements Alignable.
Definition at line 228 of file AlignableComposite.cc.
References alignableObjectId(), components(), lat::endl(), Alignable::globalPosition(), Alignable::globalRotation(), and i.
00229 { 00230 00231 // A simple printout method. Could be specialized in the implementation classes. 00232 00233 Alignables comp = this->components(); 00234 00235 // Dump this 00236 edm::LogInfo("AlignableDump") 00237 << " Alignable of type " << this->alignableObjectId() 00238 << " has " << comp.size() << " components" << std::endl 00239 << " position = " << this->globalPosition() << ", orientation:" << std::endl 00240 << this->globalRotation(); 00241 00242 // Dump components 00243 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ ) 00244 (*i)->dump(); 00245 00246 }
void AlignableComposite::move | ( | const GlobalVector & | displacement | ) | [virtual] |
Move with respect to the global reference frame.
Implements Alignable.
Definition at line 64 of file AlignableComposite.cc.
References Alignable::addDisplacement(), components(), i, GloballyPositioned< T >::move(), and Alignable::theSurface.
Referenced by moveComponentsLocal().
00065 { 00066 00067 // Move components 00068 Alignables comp = this->components(); 00069 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ ) 00070 (**i).move( displacement); 00071 00072 // Move surface 00073 this->addDisplacement( displacement ); 00074 theSurface.move( displacement ); 00075 00076 }
void AlignableComposite::moveComponentLocal | ( | const int | i, | |
const LocalVector & | localDisplacement | |||
) | [virtual] |
Move a single component with respect to the local reference frame.
Definition at line 88 of file AlignableComposite.cc.
References components(), Exception, and Alignable::size().
00089 { 00090 00091 if (i >= size() ) 00092 throw cms::Exception("LogicError") 00093 << "AlignableComposite index (" << i << ") out of range"; 00094 00095 Alignables comp = this->components(); 00096 comp[i]->move( this->surface().toGlobal( localDisplacement ) ); 00097 00098 }
void AlignableComposite::moveComponentsLocal | ( | const LocalVector & | localDisplacement | ) | [virtual] |
Move with respect to the local reference frame.
Definition at line 80 of file AlignableComposite.cc.
References move().
00081 { 00082 00083 this->move( this->surface().toGlobal(localDisplacement) ); 00084 00085 }
void AlignableComposite::recursiveComponents | ( | Alignables & | result | ) | const [virtual] |
Provide all components, subcomponents etc. (cf. description in base class).
Definition at line 48 of file AlignableComposite.cc.
References align::AlignableDet, components(), and iter.
00049 { 00050 00051 Alignables components = this->components(); 00052 if (this->alignableObjectId() == align::AlignableDet 00053 && components.size() <= 1) { // Non-glued AlignableDets (still) contain themselves 00054 return; // (would be better to implement AlignableDet::recursiveComponents!) 00055 } 00056 for (Alignables::const_iterator iter = components.begin(); 00057 iter != components.end(); ++iter) { 00058 result.push_back(*iter); // could use std::copy(..), but here we build a real hierarchy 00059 (*iter)->recursiveComponents(result); 00060 } 00061 }
void AlignableComposite::rotateInGlobalFrame | ( | const RotationType & | rotation | ) | [virtual] |
Rotation interpreted in global reference frame.
Rotation intepreted such, that the orientation of the rotation axis is w.r.t.
to the global coordinate system. This, however, does NOT mean the center of the rotation. This is simply taken as the center of the Alignable-object
Implements Alignable.
Definition at line 106 of file AlignableComposite.cc.
References Alignable::addRotation(), PV3DBase< T, PVType, FrameType >::basicVector(), components(), Alignable::globalPosition(), i, TkRotation< T >::multiplyInverse(), GloballyPositioned< T >::rotate(), and Alignable::theSurface.
00107 { 00108 00109 Alignables comp = this->components(); 00110 00111 PositionType myPosition = this->globalPosition(); 00112 00113 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ ) 00114 { 00115 00116 // It is much simpler to calculate the local position given in coordinates 00117 // of the GLOBAL frame and then just apply the rotation matrix given in the 00118 // GLOBAL frame as well. ONLY this is somewhat tricky... as Teddy's frames 00119 // don't like this kind of mixing... 00120 00121 // Rotations are defined for "Basic3DVector" types, without any FrameTAG, 00122 // because Rotations usually switch between different frames. You get 00123 // this by using the method .basicVector() 00124 00125 // localPosition = globalPosition (Component) - globalPosition(Composite) 00126 // moveVector = rotated localPosition - original localposition 00127 // LocalVector localPositionVector = (**i).globalPosition()-myPosition; 00128 00129 00130 // Local Position given in coordinates of the GLOBAL Frame 00131 const GlobalVector localPositionVector = (**i).globalPosition() - myPosition; 00132 GlobalVector::BasicVectorType lpvgf = localPositionVector.basicVector(); 00133 00134 // rotate with GLOBAL rotation matrix and subtract => moveVector in 00135 // global Coordinates 00136 // apparently... you have to use the inverse of the rotation here 00137 // (rotate the VECTOR rather than the frame) 00138 GlobalVector moveVector( rotation.multiplyInverse(lpvgf) - lpvgf ); 00139 00140 00141 (**i).move( moveVector ); 00142 (**i).rotateInGlobalFrame( rotation ); 00143 00144 } 00145 00146 this->addRotation( rotation ); 00147 00148 theSurface.rotate( rotation ); 00149 00150 }
void AlignableComposite::setAlignmentPositionError | ( | const AlignmentPositionError & | ape | ) | [virtual] |
Set the AlignmentPositionError to all the components of the composite.
Set the alignment position error of all components to given error.
Implements Alignable.
Reimplemented in AlignableDet.
Definition at line 155 of file AlignableComposite.cc.
References components(), and i.
Referenced by AlignableDet::setAlignmentPositionError().
00156 { 00157 00158 // Since no geomDet is attached, alignable composites do not have an APE 00159 // The APE is, therefore, just propagated down 00160 Alignables comp = this->components(); 00161 for ( Alignables::const_iterator i=comp.begin(); i!=comp.end(); i++) 00162 { 00163 (*i)->setAlignmentPositionError(ape); 00164 } 00165 00166 }
void AlignableComposite::setSurface | ( | const AlignableSurface & | s | ) | [inline, protected] |
Definition at line 90 of file AlignableComposite.h.
References Alignable::theSurface.
Referenced by AlignableCSCEndcap::AlignableCSCEndcap(), AlignableCSCRing::AlignableCSCRing(), AlignableCSCStation::AlignableCSCStation(), AlignableDTBarrel::AlignableDTBarrel(), AlignableDTStation::AlignableDTStation(), and AlignableDTWheel::AlignableDTWheel().
00090 { theSurface = s; }
Alignables AlignableComposite::theComponents [private] |
Definition at line 96 of file AlignableComposite.h.
Referenced by addComponent(), components(), and ~AlignableComposite().
StructureType AlignableComposite::theStructureType [protected] |
Definition at line 92 of file AlignableComposite.h.
Referenced by AlignableCSCChamber::AlignableCSCChamber(), AlignableDTChamber::AlignableDTChamber(), AlignableDTSuperLayer::AlignableDTSuperLayer(), and alignableObjectId().