Go to the documentation of this file.00001
00010 #include "FWCore/Utilities/interface/Exception.h"
00011
00012
00013 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00014 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00015
00016
00017 #include "Alignment/CommonAlignment/interface/AlignableBeamSpot.h"
00018
00019 #include "CondFormats/Alignment/interface/Alignments.h"
00020 #include "CondFormats/Alignment/interface/AlignmentErrors.h"
00021 #include "CondFormats/Alignment/interface/AlignmentSorter.h"
00022
00023 #include "Alignment/CommonAlignment/interface/AlignableExtras.h"
00024
00025
00026 AlignableExtras::AlignableExtras()
00027 {
00028 align::Alignables& alis = alignableLists_.get("BeamSpot");
00029 alis.push_back(new AlignableBeamSpot());
00030 components_.push_back(alis.back());
00031 }
00032
00033
00034 void AlignableExtras::dump( void ) const
00035 {
00036 Alignables comp = this->components();
00037
00038
00039 edm::LogInfo("AlignableDump")
00040 << " AlignableExtras knows " << comp.size() << " alignable(s)" << std::endl;
00041
00042
00043 for ( Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
00044 (*i)->dump();
00045 }
00046
00047
00048 Alignments* AlignableExtras::alignments( void ) const
00049 {
00050 align::Alignables comp = this->components();
00051 Alignments* m_alignments = new Alignments();
00052
00053 for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
00054 {
00055 Alignments* tmpAlignments = (*i)->alignments();
00056 std::copy( tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(),
00057 std::back_inserter(m_alignments->m_align) );
00058 delete tmpAlignments;
00059 }
00060
00061 std::sort( m_alignments->m_align.begin(), m_alignments->m_align.end(),
00062 lessAlignmentDetId<AlignTransform>() );
00063
00064 return m_alignments;
00065 }
00066
00067
00068 AlignmentErrors* AlignableExtras::alignmentErrors( void ) const
00069 {
00070 align::Alignables comp = this->components();
00071 AlignmentErrors* m_alignmentErrors = new AlignmentErrors();
00072
00073
00074 for ( align::Alignables::iterator i=comp.begin(); i!=comp.end(); i++ )
00075 {
00076 AlignmentErrors* tmpAlignmentErrors = (*i)->alignmentErrors();
00077 std::copy( tmpAlignmentErrors->m_alignError.begin(), tmpAlignmentErrors->m_alignError.end(),
00078 std::back_inserter(m_alignmentErrors->m_alignError) );
00079 delete tmpAlignmentErrors;
00080 }
00081
00082 std::sort( m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end(),
00083 lessAlignmentDetId<AlignTransformError>() );
00084
00085 return m_alignmentErrors;
00086 }
00087
00088 void AlignableExtras::initializeBeamSpot(double x, double y, double z,
00089 double dxdz, double dydz)
00090 {
00091 align::Alignables& alis = beamSpot();
00092 AlignableBeamSpot * aliBS = dynamic_cast<AlignableBeamSpot*>(alis.back());
00093 if (aliBS) {
00094 aliBS->initialize(x, y, z, dxdz, dydz);
00095 } else {
00096 edm::LogError("AlignableExtras")
00097 << " AlignableBeamSpot not available. Cannot initialize!" << std::endl;
00098 }
00099 }