CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Alignment/MuonAlignment/src/AlignableDTWheel.cc

Go to the documentation of this file.
00001 
00009 #include "Alignment/MuonAlignment/interface/AlignableDTWheel.h"
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 
00012 
00013 
00015 AlignableDTWheel::AlignableDTWheel( const std::vector<AlignableDTStation*> dtStations ) 
00016    : AlignableComposite(dtStations[0]->id(), align::AlignableDTWheel)
00017 {
00018 
00019   theDTStations.insert( theDTStations.end(), dtStations.begin(), dtStations.end() );
00020 
00021   setSurface( computeSurface() );
00022    
00023 }
00024       
00025 
00027 AlignableDTWheel::~AlignableDTWheel() 
00028 {
00029   for ( std::vector<AlignableDTStation*>::iterator iter = theDTStations.begin(); 
00030         iter != theDTStations.end(); iter++)
00031     delete *iter;
00032 
00033 }
00034 
00036 AlignableDTStation &AlignableDTWheel::station(int i) 
00037 {
00038   
00039   if (i >= size() ) 
00040         throw cms::Exception("LogicError") << "Station index (" << i << ") out of range";
00041 
00042   return *theDTStations[i];
00043   
00044 }
00045 
00046 
00049 AlignableSurface AlignableDTWheel::computeSurface()
00050 {
00051 
00052   return AlignableSurface( computePosition(), computeOrientation() );
00053 
00054 }
00055 
00056 
00057 
00059 AlignableDTWheel::PositionType AlignableDTWheel::computePosition() 
00060 {
00061 
00062   float zz = 0.;
00063 
00064   for ( std::vector<AlignableDTStation*>::iterator ilayer = theDTStations.begin();
00065                 ilayer != theDTStations.end(); ilayer++ )
00066     zz += (*ilayer)->globalPosition().z();
00067 
00068   zz /= static_cast<float>(theDTStations.size());
00069 
00070   return PositionType( 0.0, 0.0, zz );
00071 
00072 }
00073 
00074 
00076 AlignableDTWheel::RotationType AlignableDTWheel::computeOrientation() 
00077 {
00078   return RotationType();
00079 }
00080 
00081 
00083 std::ostream &operator << (std::ostream& os, const AlignableDTWheel& b )
00084 {
00085 
00086   os << "This DTWheel contains " << b.theDTStations.size() << " DT stations" << std::endl;
00087   os << "(phi, r, z) =  (" << b.globalPosition().phi() << "," 
00088      << b.globalPosition().perp() << "," << b.globalPosition().z();
00089   os << "),  orientation:" << std::endl<< b.globalRotation() << std::endl;
00090   return os;
00091 
00092 }
00093 
00094 
00096 void AlignableDTWheel::dump( void ) const 
00097 {
00098 
00099   edm::LogInfo("AlignableDump") << (*this);
00100   for ( std::vector<AlignableDTStation*>::const_iterator iStation = theDTStations.begin();
00101                 iStation != theDTStations.end(); iStation++ )
00102         (*iStation)->dump();
00103 
00104 }