CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Alignment/MuonAlignment/src/AlignableCSCStation.cc

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