Go to the documentation of this file.00001 #include "Alignment/CocoaToDDL/interface/UnitConverter.h"
00002 #include "Alignment/CocoaToDDL/interface/CocoaUnitsTable.h"
00003 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00004 #include <sstream>
00005 #include <strstream>
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 UnitConverter::UnitConverter(ALIdouble val, const ALIstring & category)
00018 : bu_(new CocoaBestUnit(val,category)), angl_(false)
00019 {
00020 if (category=="Angle")
00021 angl_=true;
00022 }
00023
00024 UnitConverter::~UnitConverter()
00025 {
00026 delete bu_;
00027 }
00028
00029 std::string UnitConverter::ucstring()
00030 {
00031
00032 std::ostrstream str;
00033
00034 if (angl_) {
00035 str.precision(11);
00036 double x = ( *(bu_->GetValue()) ) / deg;
00037 str << x << std::string("*deg") << '\0';
00038 return std::string(str.str());
00039
00040 }
00041 else {
00042 str << *bu_ << '\0';
00043 std::string s(str.str());
00044 return s.replace(s.find(" "),1,"*");
00045 }
00046
00047
00048 }
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061