CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
UnitConverter Class Reference

#include <UnitConverter.h>

Public Member Functions

std::string ucstring ()
 
 UnitConverter (ALIdouble val, const ALIstring &category)
 
 ~UnitConverter ()
 

Public Attributes

bool angl_
 
CocoaBestUnitbu_
 

Detailed Description

Definition at line 15 of file UnitConverter.h.

Constructor & Destructor Documentation

UnitConverter::UnitConverter ( ALIdouble  val,
const ALIstring category 
)

Definition at line 17 of file UnitConverter.cc.

References angl_.

18  : bu_(new CocoaBestUnit(val,category)), angl_(false)
19 {
20  if (category=="Angle")
21  angl_=true;
22 }
CocoaBestUnit * bu_
Definition: UnitConverter.h:23
UnitConverter::~UnitConverter ( )

Definition at line 24 of file UnitConverter.cc.

References bu_.

25 {
26  delete bu_;
27 }
CocoaBestUnit * bu_
Definition: UnitConverter.h:23

Member Function Documentation

std::string UnitConverter::ucstring ( )

Definition at line 29 of file UnitConverter.cc.

References angl_, bu_, CocoaBestUnit::GetValue(), alignCSCRings::s, harvestTrackValidationPlots::str, AlCaHLTBitMon_QueryRunRegistry::string, and x.

30 {
31 
32  std::ostrstream str;
33 
34  if (angl_) {
35  str.precision(11);
36  double x = ( *(bu_->GetValue()) ) / deg;
37  str << x << std::string("*deg") << '\0';
38  return std::string(str.str());
39 
40  }
41  else {
42  str << *bu_ << '\0';
43  std::string s(str.str());
44  return s.replace(s.find(" "),1,"*");
45  }
46  //return s;
47 
48 }
CocoaBestUnit * bu_
Definition: UnitConverter.h:23
ALIdouble * GetValue()

Member Data Documentation

bool UnitConverter::angl_

Definition at line 24 of file UnitConverter.h.

Referenced by ucstring(), and UnitConverter().

CocoaBestUnit* UnitConverter::bu_

Definition at line 23 of file UnitConverter.h.

Referenced by ucstring(), and ~UnitConverter().