00001 #include "CondFormats/OptAlignObjects/interface/OpticalAlignInfo.h"
00002
00003 #include <iostream>
00004 #include <iomanip>
00005
00006 OpticalAlignParam::OpticalAlignParam()
00007 {
00008 quality_ = -1;
00009 dim_type_ = "";
00010 }
00011
00012 std::ostream & operator<<(std::ostream & os, const OpticalAlignInfo & r)
00013 {
00014 os << "Name: " << r.name_ << std::endl;
00015 os << "Parent Name: " << r.parentName_ << std::endl;
00016 os << "Type: " << r.type_ << " ID: " << r.ID_ << std::endl;
00017 int iw = os.width();
00018 int ip = os.precision();
00019 int now = 12;
00020 int nop = 5;
00021 os << std::setw( now ) << std::setprecision( nop ) << "member";
00022 os << std::setw( now ) << std::setprecision( nop ) << "dim_type";
00023 os << std::setw( now ) << std::setprecision( nop ) << "value";
00024 os << std::setw( now ) << std::setprecision( nop ) << "error";
00025 os << std::setw( now ) << std::setprecision( nop ) << "quality" << std::endl;
00026 os << std::setw( now ) << std::setprecision( nop ) << r.x_ << std::endl;
00027 os << std::setw( now ) << std::setprecision( nop ) << r.y_ << std::endl;
00028 os << std::setw( now ) << std::setprecision( nop ) << r.z_ << std::endl;
00029 os << std::setw( now ) << std::setprecision( nop ) << r.angx_ << std::endl;
00030 os << std::setw( now ) << std::setprecision( nop ) << r.angy_ << std::endl;
00031 os << std::setw( now ) << std::setprecision( nop ) << r.angz_ << std::endl;
00032 os << std::setw( now ) << std::setprecision( nop ) << "--- Extra Entries --- " << std::endl;
00033 size_t max = r.extraEntries_.size();
00034 size_t iE = 0;
00035 while ( iE < max ) {
00036 os << "[" << iE << "]" << r.extraEntries_[iE];
00037 iE++;
00038 }
00039 os << std::setprecision( ip ) << std::setw( iw );
00040 return os;
00041 }
00042
00043
00044 std::ostream & operator<<(std::ostream & os, const OpticalAlignParam & r)
00045 {
00046 int iw = std::cout.width();
00047 int ip = std::cout.precision();
00048 int now = 12;
00049 int nop = 5;
00050 os << std::setw( now ) << std::setprecision( nop ) << r.name_;
00051 os << std::setw( now ) << std::setprecision( nop ) << r.dim_type_;
00052 os << std::setw( now ) << std::setprecision( nop ) << r.value_;
00053 os << std::setw( now ) << std::setprecision( nop ) << r.error_;
00054 os << std::setw( now ) << std::setprecision( nop ) << r.quality_ << std::endl;
00055
00056
00057 std::cout << std::setprecision( ip ) << std::setw( iw );
00058 return os;
00059 }
00060
00061 OpticalAlignParam::OpticalAlignParam( const OpticalAlignParam &rhs )
00062 {
00063 value_ = rhs.value_;
00064 error_ = rhs.error_;
00065 quality_ = rhs.quality_;
00066 name_ = rhs.name_;
00067 dim_type_ = rhs.dim_type_;
00068 }
00069
00070 OpticalAlignParam* OpticalAlignInfo::findExtraEntry( std::string& name )
00071 {
00072 OpticalAlignParam* param = 0;
00073 std::vector<OpticalAlignParam>::iterator ite;
00074 for( ite = extraEntries_.begin(); ite != extraEntries_.end(); ite++ ){
00075 if( (*ite).name_ == name ){
00076 param = &(*ite);
00077 break;
00078 }
00079 }
00080 return param;
00081 }
00082