CMS 3D CMS Logo

CocoaUnitsTable.h
Go to the documentation of this file.
1 //
2 // This class is copied from G4UnitsTable
3 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
4 
5 #ifndef CocoaUnitsTable_HH
6 #define CocoaUnitsTable_HH
7 
9 #include <vector>
10 #include "CLHEP/Vector/ThreeVector.h"
11 
13 typedef std::vector<CocoaUnitsCategory*> CocoaUnitsTable;
14 
15 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
16 
18 public: // with description
20 
21 public: // without description
25 
26 private:
29 
30 public: // with description
31  const ALIstring& GetName() const { return Name; }
32  const ALIstring& GetSymbol() const { return SymbolName; }
33  ALIdouble GetValue() const { return Value; }
34 
35  void PrintDefinition();
36 
37  static void BuildUnitsTable();
38  static void PrintUnitsTable();
39 
41 
42  static ALIdouble GetValueOf(const ALIstring&);
43  static ALIstring GetCategory(const ALIstring&);
44 
45 private:
46  ALIstring Name; // SI name
47  ALIstring SymbolName; // SI symbol
48  ALIdouble Value; // value in the internal system of units
49 
50  static CocoaUnitsTable theUnitsTable; // table of Units
51 
52  size_t CategoryIndex; // category index of this unit
53 };
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
57 typedef std::vector<CocoaUnitDefinition*> CocoaUnitsContainer;
58 
60 public: // without description
63  ALIint operator==(const CocoaUnitsCategory&) const;
64  ALIint operator!=(const CocoaUnitsCategory&) const;
65 
66 private:
69 
70 public: // without description
71  const ALIstring& GetName() const { return Name; }
73  ALIint GetNameMxLen() const { return NameMxLen; }
74  ALIint GetSymbMxLen() const { return SymbMxLen; }
75  void UpdateNameMxLen(ALIint len) {
76  if (NameMxLen < len)
77  NameMxLen = len;
78  }
79  void UpdateSymbMxLen(ALIint len) {
80  if (SymbMxLen < len)
81  SymbMxLen = len;
82  }
83  void PrintCategory();
84 
85 private:
86  ALIstring Name; // dimensional family: Length,Volume,Energy ...
87  CocoaUnitsContainer UnitsList; // List of units in this family
88  ALIint NameMxLen; // max length of the units name
89  ALIint SymbMxLen; // max length of the units symbol
90 };
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93 
95 public: // with description
96  CocoaBestUnit(ALIdouble internalValue, const ALIstring& category);
97  CocoaBestUnit(const CLHEP::Hep3Vector& internalValue, const ALIstring& category);
98  // These constructors convert a physical quantity from its internalValue
99  // into the most appropriate unit of the same category.
100  // In practice it builds an object VU = (newValue, newUnit)
101 
102  ~CocoaBestUnit();
103 
104 public: // without description
105  ALIdouble* GetValue() { return Value; }
106  const ALIstring& GetCategory() const { return Category; }
107  size_t GetIndexOfCategory() const { return IndexOfCategory; }
108 
109 public: // with description
110  friend std::ostream& operator<<(std::ostream&, CocoaBestUnit VU);
111  // Default format to print the objet VU above.
112 
113 private:
114  ALIdouble Value[3]; // value in the internal system of units
115  ALIint nbOfVals; // ALIdouble=1; CLHEP::Hep3Vector=3
116  ALIstring Category; // dimensional family: Length,Volume,Energy ...
117  size_t IndexOfCategory; // position of Category in UnitsTable
118 };
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
121 
122 #endif
CocoaBestUnit::GetCategory
const ALIstring & GetCategory() const
Definition: CocoaUnitsTable.h:106
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:30
CocoaBestUnit::GetValue
ALIdouble * GetValue()
Definition: CocoaUnitsTable.h:105
CocoaBestUnit
Definition: CocoaUnitsTable.h:94
CocoaBestUnit::operator<<
friend std::ostream & operator<<(std::ostream &, CocoaBestUnit VU)
Definition: CocoaUnitsTable.cc:342
CocoaUnitsTable
std::vector< CocoaUnitsCategory * > CocoaUnitsTable
Definition: CocoaUnitsTable.h:12
CocoaBestUnit::~CocoaBestUnit
~CocoaBestUnit()
Definition: CocoaUnitsTable.cc:338
CocoaUnitsCategory::UpdateSymbMxLen
void UpdateSymbMxLen(ALIint len)
Definition: CocoaUnitsTable.h:79
CocoaUnitDefinition::operator==
ALIint operator==(const CocoaUnitDefinition &) const
Definition: CocoaUnitsTable.cc:61
CocoaUnitsCategory::operator!=
ALIint operator!=(const CocoaUnitsCategory &) const
Definition: CocoaUnitsTable.cc:276
CocoaUnitDefinition::GetUnitsTable
static CocoaUnitsTable & GetUnitsTable()
Definition: CocoaUnitsTable.cc:69
CocoaBestUnit::CocoaBestUnit
CocoaBestUnit(ALIdouble internalValue, const ALIstring &category)
Definition: CocoaUnitsTable.cc:288
CocoaUnitsCategory::GetNameMxLen
ALIint GetNameMxLen() const
Definition: CocoaUnitsTable.h:73
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
CocoaUnitDefinition::GetSymbol
const ALIstring & GetSymbol() const
Definition: CocoaUnitsTable.h:32
CocoaUnitDefinition::Value
ALIdouble Value
Definition: CocoaUnitsTable.h:48
CocoaUnitsCategory::PrintCategory
void PrintCategory()
Definition: CocoaUnitsTable.cc:280
CocoaBestUnit::Value
ALIdouble Value[3]
Definition: CocoaUnitsTable.h:114
CocoaUnitsCategory::UpdateNameMxLen
void UpdateNameMxLen(ALIint len)
Definition: CocoaUnitsTable.h:75
CocoaUnitDefinition::~CocoaUnitDefinition
~CocoaUnitDefinition()
Definition: CocoaUnitsTable.cc:37
CocoaUnitsCategory::GetSymbMxLen
ALIint GetSymbMxLen() const
Definition: CocoaUnitsTable.h:74
CocoaUnitsCategory::NameMxLen
ALIint NameMxLen
Definition: CocoaUnitsTable.h:88
CocoaUnitDefinition::SymbolName
ALIstring SymbolName
Definition: CocoaUnitsTable.h:47
CocoaUnitDefinition::operator!=
ALIint operator!=(const CocoaUnitDefinition &) const
Definition: CocoaUnitsTable.cc:65
CocoaUnitsCategory::~CocoaUnitsCategory
~CocoaUnitsCategory()
Definition: CocoaUnitsTable.cc:252
CocoaUnitsCategory::SymbMxLen
ALIint SymbMxLen
Definition: CocoaUnitsTable.h:89
CocoaUnitsCategory::operator=
CocoaUnitsCategory & operator=(const CocoaUnitsCategory &)
Definition: CocoaUnitsTable.cc:260
CocoaUnitDefinition::PrintUnitsTable
static void PrintUnitsTable()
Definition: CocoaUnitsTable.cc:239
CocoaUnitsCategory::CocoaUnitsCategory
CocoaUnitsCategory(const ALIstring &name)
Definition: CocoaUnitsTable.cc:248
CocoaUnitDefinition::GetValue
ALIdouble GetValue() const
Definition: CocoaUnitsTable.h:33
CocoaBestUnit::nbOfVals
ALIint nbOfVals
Definition: CocoaUnitsTable.h:115
CocoaUnitDefinition::GetName
const ALIstring & GetName() const
Definition: CocoaUnitsTable.h:31
CocoaUnitDefinition::PrintDefinition
void PrintDefinition()
Definition: CocoaUnitsTable.cc:116
CocoaUnitsCategory::Name
ALIstring Name
Definition: CocoaUnitsTable.h:86
CocoaUnitsCategory::GetName
const ALIstring & GetName() const
Definition: CocoaUnitsTable.h:71
CocoaUnitDefinition::Name
ALIstring Name
Definition: CocoaUnitsTable.h:46
CocoaUnitsContainer
std::vector< CocoaUnitDefinition * > CocoaUnitsContainer
Definition: CocoaUnitsTable.h:57
CocoaUnitDefinition
Definition: CocoaUnitsTable.h:17
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
CocoaUnitsCategory::UnitsList
CocoaUnitsContainer UnitsList
Definition: CocoaUnitsTable.h:87
CocoaUnitDefinition::theUnitsTable
static CocoaUnitsTable theUnitsTable
Definition: CocoaUnitsTable.h:50
CocoaBestUnit::Category
ALIstring Category
Definition: CocoaUnitsTable.h:116
value
Definition: value.py:1
CocoaUnitsCategory::operator==
ALIint operator==(const CocoaUnitsCategory &) const
Definition: CocoaUnitsTable.cc:272
CocoaUnitDefinition::CocoaUnitDefinition
CocoaUnitDefinition(const ALIstring &name, const ALIstring &symbol, const ALIstring &category, ALIdouble value)
Definition: CocoaUnitsTable.cc:12
CocoaBestUnit::GetIndexOfCategory
size_t GetIndexOfCategory() const
Definition: CocoaUnitsTable.h:107
CocoaUnitDefinition::BuildUnitsTable
static void BuildUnitsTable()
Definition: CocoaUnitsTable.cc:124
CocoaUnitsCategory
Definition: CocoaUnitsTable.h:59
CocoaUnitDefinition::CategoryIndex
size_t CategoryIndex
Definition: CocoaUnitsTable.h:52
CocoaUnitDefinition::operator=
CocoaUnitDefinition & operator=(const CocoaUnitDefinition &)
Definition: CocoaUnitsTable.cc:49
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CocoaUnitDefinition::GetCategory
static ALIstring GetCategory(const ALIstring &)
Definition: CocoaUnitsTable.cc:94
CocoaUnitsCategory::GetUnitsList
CocoaUnitsContainer & GetUnitsList()
Definition: CocoaUnitsTable.h:72
ALIint
int ALIint
Definition: CocoaGlobals.h:15
CocoaGlobals.h
CocoaBestUnit::IndexOfCategory
size_t IndexOfCategory
Definition: CocoaUnitsTable.h:117
CocoaUnitDefinition::GetValueOf
static ALIdouble GetValueOf(const ALIstring &)
Definition: CocoaUnitsTable.cc:73