CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Alignment/MuonAlignment/src/AlignableDTStation.cc

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