Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-25 23:59:18

0001 /* AlignableGEMStation
0002  * \author Hyunyong Kim - TAMU
0003  */
0004 #include "Alignment/MuonAlignment/interface/AlignableGEMStation.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 
0007 AlignableGEMStation::AlignableGEMStation(const std::vector<AlignableGEMRing*>& GEMRings)
0008     : AlignableComposite(GEMRings[0]->id(), align::AlignableGEMStation) {
0009   theGEMRings.insert(theGEMRings.end(), GEMRings.begin(), GEMRings.end());
0010 
0011   for (const auto& ring : GEMRings) {
0012     const auto mother = ring->mother();
0013     this->addComponent(ring);
0014     ring->setMother(mother);
0015   }
0016 
0017   setSurface(computeSurface());
0018   compConstraintType_ = Alignable::CompConstraintType::POSITION_Z;
0019 }
0020 
0021 AlignableGEMRing& AlignableGEMStation::ring(int i) {
0022   if (i >= size())
0023     throw cms::Exception("LogicError") << "GEM Ring index (" << i << ") out of range";
0024 
0025   return *theGEMRings[i];
0026 }
0027 
0028 AlignableSurface AlignableGEMStation::computeSurface() {
0029   return AlignableSurface(computePosition(), computeOrientation());
0030 }
0031 
0032 AlignableGEMStation::PositionType AlignableGEMStation::computePosition() {
0033   float zz = 0.;
0034 
0035   for (std::vector<AlignableGEMRing*>::iterator ilayer = theGEMRings.begin(); ilayer != theGEMRings.end(); ilayer++)
0036     zz += (*ilayer)->globalPosition().z();
0037 
0038   zz /= static_cast<float>(theGEMRings.size());
0039 
0040   return PositionType(0.0, 0.0, zz);
0041 }
0042 
0043 AlignableGEMStation::RotationType AlignableGEMStation::computeOrientation() { return RotationType(); }
0044 
0045 std::ostream& operator<<(std::ostream& os, const AlignableGEMStation& b) {
0046   os << "This GEM Station contains " << b.theGEMRings.size() << " GEM rings" << std::endl;
0047   os << "(phi, r, z) =  (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
0048      << b.globalPosition().z();
0049   os << "),  orientation:" << std::endl << b.globalRotation() << std::endl;
0050   return os;
0051 }
0052 
0053 void AlignableGEMStation::dump(void) const {
0054   edm::LogInfo("AlignableDump") << (*this);
0055   for (std::vector<AlignableGEMRing*>::const_iterator iRing = theGEMRings.begin(); iRing != theGEMRings.end(); iRing++)
0056     edm::LogInfo("AlignableDump") << (**iRing);
0057 }