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