00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef ElementData_h
00044 #define ElementData_h 1
00045
00046
00047
00048 #include "globals.hh"
00049 #include "G4NistElementBuilder.hh"
00050 #include "G4PhysicsVector.hh"
00051 #include <vector>
00052
00053
00054
00055 class G4ElementData
00056 {
00057 public:
00058
00059 G4ElementData();
00060
00061 ~G4ElementData();
00062
00063
00064 void InitialiseForElement(G4int Z, G4PhysicsVector* v);
00065
00066
00067 void InitialiseForComponent(G4int Z, G4int nComponents=0);
00068
00069
00070 void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
00071
00072
00073 void SetName(const G4String& nam);
00074
00075
00076 inline G4PhysicsVector* GetElementData(G4int Z);
00077
00078
00079 inline size_t GetNumberOfComponents(G4int Z);
00080
00081
00082
00083 inline G4int GetComponentID(G4int Z, size_t idx);
00084
00085
00086 inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
00087
00088
00089 inline G4PhysicsVector* GetComponentDataByID(G4int Z, G4int id);
00090
00091
00092
00093 inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
00094
00095
00096
00097 inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
00098
00099 private:
00100
00101
00102 G4ElementData & operator=(const G4ElementData &right);
00103 G4ElementData(const G4ElementData&);
00104
00105 G4PhysicsVector* elmData[maxNumElements];
00106 std::vector<G4PhysicsVector*> compData[maxNumElements];
00107 std::vector<G4int> compID[maxNumElements];
00108 size_t compLength[maxNumElements];
00109 G4String name;
00110 };
00111
00112 inline void G4ElementData::SetName(const G4String& nam)
00113 {
00114 name = nam;
00115 }
00116
00117 inline
00118 G4PhysicsVector* G4ElementData::GetElementData(G4int Z)
00119 {
00120 return elmData[Z];
00121 }
00122
00123 inline
00124 size_t G4ElementData::GetNumberOfComponents(G4int Z)
00125 {
00126 return compLength[Z];
00127 }
00128
00129 inline G4int G4ElementData::GetComponentID(G4int Z, size_t idx)
00130 {
00131 return (compID[Z])[idx];
00132 }
00133
00134 inline
00135 G4PhysicsVector* G4ElementData::GetComponentDataByIndex(G4int Z, size_t idx)
00136 {
00137 return (compData[Z])[idx];
00138 }
00139
00140 inline
00141 G4PhysicsVector* G4ElementData::GetComponentDataByID(G4int Z, G4int id)
00142 {
00143 G4PhysicsVector* v = 0;
00144 for(size_t i=0; i<compLength[Z]; ++i) {
00145 if(id == (compID[Z])[i]) {
00146 v = (compData[Z])[i];
00147 break;
00148 }
00149 }
00150 return v;
00151 }
00152
00153 inline
00154 G4double G4ElementData::GetValueForElement(G4int Z, G4double kinEnergy)
00155 {
00156 return elmData[Z]->Value(kinEnergy);
00157 }
00158
00159 inline G4double
00160 G4ElementData::GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
00161 {
00162 return ((compData[Z])[idx])->Value(kinEnergy);
00163 }
00164
00165
00166
00167 #endif
00168