File indexing completed on 2024-04-06 11:56:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #ifndef ALIUnitsTable_HH
0040 #define ALIUnitsTable_HH
0041
0042 #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
0043 #include <vector>
0044 #include <memory>
0045 #include <CLHEP/Vector/ThreeVector.h>
0046
0047 class ALIUnitsCategory;
0048 typedef std::vector<ALIUnitsCategory*> ALIUnitsTable;
0049
0050
0051
0052 class ALIUnitDefinition : public std::enable_shared_from_this<ALIUnitDefinition> {
0053 public:
0054 ALIUnitDefinition(ALIstring name, ALIstring symbol, ALIstring category, ALIdouble value);
0055
0056 public:
0057 ~ALIUnitDefinition();
0058 ALIint operator==(const ALIUnitDefinition&) const;
0059 ALIint operator!=(const ALIUnitDefinition&) const;
0060
0061 private:
0062 ALIUnitDefinition(ALIUnitDefinition&);
0063 ALIUnitDefinition& operator=(const ALIUnitDefinition&);
0064
0065 public:
0066 ALIstring GetName() const { return Name; }
0067 ALIstring GetSymbol() const { return SymbolName; }
0068 ALIdouble GetValue() const { return Value; }
0069
0070 void PrintDefinition();
0071
0072 static void BuildUnitsTable();
0073 static void PrintUnitsTable();
0074
0075 static ALIUnitsTable& GetUnitsTable() { return theUnitsTable; }
0076
0077 static ALIdouble GetValueOf(ALIstring);
0078 static ALIstring GetCategory(ALIstring);
0079
0080 private:
0081 ALIstring Name;
0082 ALIstring SymbolName;
0083 ALIdouble Value;
0084
0085 static ALIUnitsTable theUnitsTable;
0086
0087 size_t CategoryIndex;
0088 };
0089
0090
0091
0092 using ALIUnitsContainer = std::vector<std::shared_ptr<ALIUnitDefinition>>;
0093
0094 class ALIUnitsCategory {
0095 public:
0096 ALIUnitsCategory(ALIstring name);
0097 ~ALIUnitsCategory();
0098 ALIint operator==(const ALIUnitsCategory&) const;
0099 ALIint operator!=(const ALIUnitsCategory&) const;
0100
0101 private:
0102 ALIUnitsCategory(ALIUnitsCategory&);
0103 ALIUnitsCategory& operator=(const ALIUnitsCategory&);
0104
0105 public:
0106 ALIstring GetName() const { return Name; }
0107 ALIUnitsContainer& GetUnitsList() { return UnitsList; }
0108 ALIint GetNameMxLen() const { return NameMxLen; }
0109 ALIint GetSymbMxLen() const { return SymbMxLen; }
0110 void UpdateNameMxLen(ALIint len) {
0111 if (NameMxLen < len)
0112 NameMxLen = len;
0113 }
0114 void UpdateSymbMxLen(ALIint len) {
0115 if (SymbMxLen < len)
0116 SymbMxLen = len;
0117 }
0118 void PrintCategory();
0119
0120 private:
0121 ALIstring Name;
0122 ALIUnitsContainer UnitsList;
0123 ALIint NameMxLen;
0124 ALIint SymbMxLen;
0125 };
0126
0127
0128
0129 class ALIBestUnit {
0130 public:
0131 ALIBestUnit(ALIdouble internalValue, ALIstring category);
0132 ALIBestUnit(const CLHEP::Hep3Vector& internalValue, ALIstring category);
0133
0134
0135
0136
0137 ~ALIBestUnit();
0138
0139 public:
0140 ALIdouble* GetValue() { return Value; }
0141 ALIstring GetCategory() const { return Category; }
0142 size_t GetIndexOfCategory() const { return IndexOfCategory; }
0143
0144 public:
0145 friend std::ostream& operator<<(std::ostream&, ALIBestUnit VU);
0146
0147
0148 private:
0149 ALIdouble Value[3];
0150 ALIint nbOfVals;
0151 ALIstring Category;
0152 size_t IndexOfCategory;
0153 };
0154
0155
0156
0157 #endif