CMS 3D CMS Logo

UnitConverter.cc
Go to the documentation of this file.
3 #include "CLHEP/Units/GlobalSystemOfUnits.h"
4 #include <sstream>
5 #include <strstream>
6 
7 /*
8 UnitConverter::UnitConverter(const G4BestUnit & bu)
9  : bu_(bu)
10 {
11  //ostrstream s;
12  //s << bu;
13 
14 }
15 */
16 
18  : bu_(new CocoaBestUnit(val, category)), angl_(false) {
19  if (category == "Angle")
20  angl_ = true;
21 }
22 
24 
26  std::ostrstream str;
27 
28  if (angl_) {
29  str.precision(11);
30  double x = (*(bu_->GetValue())) / deg;
31  str << x << std::string("*deg") << '\0';
32  return std::string(str.str());
33 
34  } else {
35  str << *bu_ << '\0';
36  std::string s(str.str());
37  return s.replace(s.find(' '), 1, "*");
38  }
39  //return s;
40 }
41 
42 /*
43 ostream & operator<<(ostream & os, const UnitConverter & uc)
44 {
45  ostrstream temp;
46  //temp << uc.bu_;
47  //temp << '\0';
48  //string s(temp.str());
49  //cout << "NOW: " << s << endl;
50  os << *(uc.bu_);
51 }
52 
53 */
UnitConverter::bu_
CocoaBestUnit * bu_
Definition: UnitConverter.h:22
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
CocoaBestUnit::GetValue
ALIdouble * GetValue()
Definition: CocoaUnitsTable.h:105
CocoaBestUnit
Definition: CocoaUnitsTable.h:94
UnitConverter::ucstring
std::string ucstring()
Definition: UnitConverter.cc:25
funct::false
false
Definition: Factorize.h:29
UnitConverter::angl_
bool angl_
Definition: UnitConverter.h:23
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
DDAxes::x
UnitConverter::~UnitConverter
~UnitConverter()
Definition: UnitConverter.cc:23
UnitConverter.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
str
#define str(s)
Definition: TestProcessor.cc:52
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CocoaUnitsTable.h
UnitConverter::UnitConverter
UnitConverter(ALIdouble val, const ALIstring &category)
Definition: UnitConverter.cc:17
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
heppy_batch.val
val
Definition: heppy_batch.py:351