CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 
00008 #include "Alignment/MuonAlignment/interface/AlignableDTChamber.h"
00009 #include "Alignment/MuonAlignment/interface/AlignableDTSuperLayer.h"
00010 
00011 AlignableDTChamber::AlignableDTChamber(const GeomDet *geomDet)
00012    : AlignableDet(geomDet, false)
00013 {
00014    // even though we overload alignableObjectId(), it's dangerous to
00015    // have two different claims about the structure type
00016    theStructureType = align::AlignableDTChamber;
00017 
00018    // The unique thing about DT chambers is that they are Dets that contain Dets (superlayers)
00019    // The superlayer Dets contain DetUnits (layers), as usual
00020    const std::vector<const GeomDet*>& geomDets = geomDet->components();
00021    for (std::vector<const GeomDet*>::const_iterator idet = geomDets.begin();  idet != geomDets.end();  ++idet) {
00022       addComponent(new AlignableDTSuperLayer(*idet));
00023    }
00024 
00025    // DO NOT let the chamber position become an average of the layers
00026    this->theSurface = geomDet->surface();
00027 }
00028 
00030 std::ostream& operator<< (std::ostream &os, const AlignableDTChamber & r) {
00031    std::vector<Alignable*> theDets = r.components();
00032 
00033    os << "    This DTChamber contains " << theDets.size() << " units" << std::endl ;
00034    os << "    position = " << r.globalPosition() << std::endl;
00035    os << "    (phi, r, z)= (" << r.globalPosition().phi() << "," << r.globalPosition().perp() << "," << r.globalPosition().z();
00036    os << "), orientation:" << std::endl<< r.globalRotation() << std::endl;
00037    
00038    os << "    total displacement and rotation: " << r.displacement() << std::endl;
00039    os << r.rotation() << std::endl;
00040  
00041    for (std::vector<Alignable*>::const_iterator idet = theDets.begin();  idet != theDets.end();  ++idet) {
00042       const align::Alignables& comp = (*idet)->components();
00043 
00044       for (unsigned int i = 0; i < comp.size(); ++i) {
00045          os << "     Det position, phi, r: " 
00046             << comp[i]->globalPosition() << " , "
00047             << comp[i]->globalPosition().phi() << " , "
00048             << comp[i]->globalPosition().perp() << std::endl; 
00049          os << "     local  position, phi, r: " 
00050             << r.surface().toLocal(comp[i]->globalPosition())        << " , "
00051             << r.surface().toLocal(comp[i]->globalPosition()).phi()  << " , "
00052             << r.surface().toLocal(comp[i]->globalPosition()).perp() << std::endl; 
00053       }
00054    }
00055 
00056    return os;
00057 }