File indexing completed on 2021-02-14 12:51:23
0001 #include "CondFormats/OptAlignObjects/interface/OpticalAlignInfo.h"
0002
0003 #include <iostream>
0004 #include <iomanip>
0005
0006 OpticalAlignParam::OpticalAlignParam() {
0007 quality_ = -1;
0008 dim_type_ = "";
0009 }
0010
0011 std::ostream& operator<<(std::ostream& os, const OpticalAlignInfo& r) {
0012 os << "Name: " << r.name_ << std::endl;
0013 os << "Parent Name: " << r.parentName_ << std::endl;
0014 os << "Type: " << r.type_ << " ID: " << r.ID_ << std::endl;
0015 int iw = os.width();
0016 int ip = os.precision();
0017 int now = 12;
0018 int nop = 5;
0019 os << std::setw(now) << std::setprecision(nop) << "member";
0020 os << std::setw(now) << std::setprecision(nop) << "dim_type";
0021 os << std::setw(now) << std::setprecision(nop) << "value";
0022 os << std::setw(now) << std::setprecision(nop) << "error";
0023 os << std::setw(now) << std::setprecision(nop) << "quality" << std::endl;
0024 os << std::setw(now) << std::setprecision(nop) << r.x_ << std::endl;
0025 os << std::setw(now) << std::setprecision(nop) << r.y_ << std::endl;
0026 os << std::setw(now) << std::setprecision(nop) << r.z_ << std::endl;
0027 os << std::setw(now) << std::setprecision(nop) << r.angx_ << std::endl;
0028 os << std::setw(now) << std::setprecision(nop) << r.angy_ << std::endl;
0029 os << std::setw(now) << std::setprecision(nop) << r.angz_ << std::endl;
0030 os << std::setw(now) << std::setprecision(nop) << "--- Extra Entries --- " << std::endl;
0031 size_t max = r.extraEntries_.size();
0032 size_t iE = 0;
0033 while (iE < max) {
0034 os << "[" << iE << "]" << r.extraEntries_[iE];
0035 iE++;
0036 }
0037 os << std::setprecision(ip) << std::setw(iw);
0038 return os;
0039 }
0040
0041 std::ostream& operator<<(std::ostream& os, const OpticalAlignParam& r) {
0042 int iw = std::cout.width();
0043 int ip = std::cout.precision();
0044 int now = 12;
0045 int nop = 5;
0046 os << std::setw(now) << std::setprecision(nop) << r.name_;
0047 os << std::setw(now) << std::setprecision(nop) << r.dim_type_;
0048 os << std::setw(now) << std::setprecision(nop) << r.value_;
0049 os << std::setw(now) << std::setprecision(nop) << r.error_;
0050 os << std::setw(now) << std::setprecision(nop) << r.quality_ << std::endl;
0051
0052
0053 std::cout << std::setprecision(ip) << std::setw(iw);
0054 return os;
0055 }
0056
0057 OpticalAlignParam::OpticalAlignParam(const OpticalAlignParam& rhs) {
0058 value_ = rhs.value_;
0059 error_ = rhs.error_;
0060 quality_ = rhs.quality_;
0061 name_ = rhs.name_;
0062 dim_type_ = rhs.dim_type_;
0063 }
0064
0065 OpticalAlignParam* OpticalAlignInfo::findExtraEntry(std::string& name) {
0066 OpticalAlignParam* param = nullptr;
0067 std::vector<OpticalAlignParam>::iterator ite;
0068 for (ite = extraEntries_.begin(); ite != extraEntries_.end(); ite++) {
0069 if ((*ite).name_ == name) {
0070 param = &(*ite);
0071 break;
0072 }
0073 }
0074 return param;
0075 }