File indexing completed on 2023-03-17 10:39:38
0001
0002
0003
0004
0005
0006
0007
0008 #include "Alignment/MuonAlignment/interface/AlignableCSCRing.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010
0011
0012 AlignableCSCRing::AlignableCSCRing(const std::vector<AlignableCSCChamber*>& cscChambers)
0013 : AlignableComposite(cscChambers[0]->id(), align::AlignableCSCRing) {
0014 theCSCChambers.insert(theCSCChambers.end(), cscChambers.begin(), cscChambers.end());
0015
0016
0017 for (const auto& chamber : cscChambers) {
0018 const auto mother = chamber->mother();
0019 this->addComponent(chamber);
0020 chamber->setMother(mother);
0021 }
0022
0023 setSurface(computeSurface());
0024 compConstraintType_ = Alignable::CompConstraintType::POSITION_Z;
0025 }
0026
0027
0028 AlignableCSCChamber& AlignableCSCRing::chamber(int i) {
0029 if (i >= size())
0030 throw cms::Exception("LogicError") << "CSC Chamber index (" << i << ") out of range";
0031
0032 return *theCSCChambers[i];
0033 }
0034
0035
0036
0037 AlignableSurface AlignableCSCRing::computeSurface() {
0038 return AlignableSurface(computePosition(), computeOrientation());
0039 }
0040
0041
0042 AlignableCSCRing::PositionType AlignableCSCRing::computePosition() {
0043 float zz = 0.;
0044
0045 for (std::vector<AlignableCSCChamber*>::iterator ichamber = theCSCChambers.begin(); ichamber != theCSCChambers.end();
0046 ichamber++)
0047 zz += (*ichamber)->globalPosition().z();
0048
0049 zz /= static_cast<float>(theCSCChambers.size());
0050
0051 return PositionType(0.0, 0.0, zz);
0052 }
0053
0054
0055 AlignableCSCRing::RotationType AlignableCSCRing::computeOrientation() { return RotationType(); }
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 std::ostream& operator<<(std::ostream& os, const AlignableCSCRing& b) {
0068 os << "This CSC Ring contains " << b.theCSCChambers.size() << " CSC chambers" << std::endl;
0069 os << "(phi, r, z) = (" << b.globalPosition().phi() << "," << b.globalPosition().perp() << ","
0070 << b.globalPosition().z();
0071 os << "), orientation:" << std::endl << b.globalRotation() << std::endl;
0072 return os;
0073 }
0074
0075
0076 void AlignableCSCRing::dump(void) const {
0077 edm::LogInfo("AlignableDump") << (*this);
0078 for (std::vector<AlignableCSCChamber*>::const_iterator iChamber = theCSCChambers.begin();
0079 iChamber != theCSCChambers.end();
0080 iChamber++)
0081 edm::LogInfo("AlignableDump") << (**iChamber);
0082 }