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