CMS 3D CMS Logo

OpticalAlignInfo.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <iomanip>
5 
7 {
8  quality_ = -1;
9  dim_type_ = "";
10 }
11 
12 std::ostream & operator<<(std::ostream & os, const OpticalAlignInfo & r)
13 {
14  os << "Name: " << r.name_ << std::endl;
15  os << "Parent Name: " << r.parentName_ << std::endl;
16  os << "Type: " << r.type_ << " ID: " << r.ID_ << std::endl;
17  int iw = os.width(); // save current width
18  int ip = os.precision(); // save current precision
19  int now = 12;
20  int nop = 5;
21  os << std::setw( now ) << std::setprecision( nop ) << "member";
22  os << std::setw( now ) << std::setprecision( nop ) << "dim_type";
23  os << std::setw( now ) << std::setprecision( nop ) << "value";
24  os << std::setw( now ) << std::setprecision( nop ) << "error";
25  os << std::setw( now ) << std::setprecision( nop ) << "quality" << std::endl;
26  os << std::setw( now ) << std::setprecision( nop ) << r.x_ << std::endl;
27  os << std::setw( now ) << std::setprecision( nop ) << r.y_ << std::endl;
28  os << std::setw( now ) << std::setprecision( nop ) << r.z_ << std::endl;
29  os << std::setw( now ) << std::setprecision( nop ) << r.angx_ << std::endl;
30  os << std::setw( now ) << std::setprecision( nop ) << r.angy_ << std::endl;
31  os << std::setw( now ) << std::setprecision( nop ) << r.angz_ << std::endl;
32  os << std::setw( now ) << std::setprecision( nop ) << "--- Extra Entries --- " << std::endl;
33  size_t max = r.extraEntries_.size();
34  size_t iE = 0;
35  while ( iE < max ) {
36  os << "[" << iE << "]" << r.extraEntries_[iE];
37  iE++;
38  }
39  os << std::setprecision( ip ) << std::setw( iw );
40  return os;
41 }
42 
43 
44 std::ostream & operator<<(std::ostream & os, const OpticalAlignParam & r)
45 {
46  int iw = std::cout.width(); // save current width
47  int ip = std::cout.precision(); // save current precision
48  int now = 12;
49  int nop = 5;
50  os << std::setw( now ) << std::setprecision( nop ) << r.name_;
51  os << std::setw( now ) << std::setprecision( nop ) << r.dim_type_;
52  os << std::setw( now ) << std::setprecision( nop ) << r.value_;
53  os << std::setw( now ) << std::setprecision( nop ) << r.error_;
54  os << std::setw( now ) << std::setprecision( nop ) << r.quality_ << std::endl;
55 
56  // Reset the values we changed
57  std::cout << std::setprecision( ip ) << std::setw( iw );
58  return os;
59 }
60 
62 {
63  value_ = rhs.value_;
64  error_ = rhs.error_;
65  quality_ = rhs.quality_;
66  name_ = rhs.name_;
67  dim_type_ = rhs.dim_type_;
68 }
69 
71 {
72  OpticalAlignParam* param = nullptr;
73  std::vector<OpticalAlignParam>::iterator ite;
74  for( ite = extraEntries_.begin(); ite != extraEntries_.end(); ite++ ){
75  if( (*ite).name_ == name ){
76  param = &(*ite);
77  break;
78  }
79  }
80  return param;
81 }
82 
std::string parentName_
OpticalAlignParam x_
std::string name() const
OpticalAlignParam angx_
OpticalAlignParam * findExtraEntry(std::string &name)
OpticalAlignParam y_
OpticalAlignParam angz_
OpticalAlignParam z_
std::vector< OpticalAlignParam > extraEntries_
std::ostream & operator<<(std::ostream &os, const OpticalAlignInfo &r)
OpticalAlignParam angy_
std::string dim_type_
unsigned int ID_