File indexing completed on 2023-03-17 10:39:38
0001
0002
0003
0004
0005
0006
0007
0008 #include "Alignment/MuonAlignment/interface/AlignableDTStation.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010
0011
0012 AlignableDTStation::AlignableDTStation(const std::vector<AlignableDTChamber*>& dtChambers)
0013 : AlignableComposite(dtChambers[0]->id(), align::AlignableDTStation) {
0014 theDTChambers.insert(theDTChambers.end(), dtChambers.begin(), dtChambers.end());
0015
0016
0017 for (const auto& chamber : dtChambers) {
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 AlignableDTChamber& AlignableDTStation::chamber(int i) {
0029 if (i >= size())
0030 throw cms::Exception("LogicError") << "DT Chamber index (" << i << ") out of range";
0031
0032 return *theDTChambers[i];
0033 }
0034
0035
0036
0037 AlignableSurface AlignableDTStation::computeSurface() {
0038 return AlignableSurface(computePosition(), computeOrientation());
0039 }
0040
0041
0042 AlignableDTStation::PositionType AlignableDTStation::computePosition() {
0043 float zz = 0.;
0044
0045 for (std::vector<AlignableDTChamber*>::iterator ilayer = theDTChambers.begin(); ilayer != theDTChambers.end();
0046 ilayer++)
0047 zz += (*ilayer)->globalPosition().z();
0048
0049 zz /= static_cast<float>(theDTChambers.size());
0050
0051 return PositionType(0.0, 0.0, zz);
0052 }
0053
0054
0055 AlignableDTStation::RotationType AlignableDTStation::computeOrientation() { return RotationType(); }
0056
0057
0058 std::ostream& operator<<(std::ostream& os, const AlignableDTStation& b) {
0059 os << "This DT Station contains " << b.theDTChambers.size() << " DT chambers" << 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 AlignableDTStation::dump(void) const {
0068 edm::LogInfo("AlignableDump") << (*this);
0069 for (std::vector<AlignableDTChamber*>::const_iterator iChamber = theDTChambers.begin();
0070 iChamber != theDTChambers.end();
0071 iChamber++)
0072 edm::LogInfo("AlignableDump") << (**iChamber);
0073 }