00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __MATERIAL_H
00016 #define __MATERIAL_H
00017
00018
00019 #include <string>
00020 #include <vector>
00021 #include <list>
00022
00023 #include "MatData.h"
00024
00037 class Material
00038 {
00039 public:
00041 Material()
00042 : zeff(0), aeff(0), rho(0), rlc(0), lambda(0)
00043 {};
00044
00046
00047 Material(std::istream&, const char* name);
00048
00049
00051 ~Material();
00052
00054
00058 static Material* hatch(const char* name);
00059
00061 int isVacuum()const {return rho==0;}
00062
00064 float dedx(float beta, float eta) const;
00065
00066 struct AtomicElement;
00067
00068
00070 AtomicElement* addElementData(char[],float,float,float,float);
00071
00073 AtomicElement* addElement(const char* bufffer);
00074
00076 const char* name() const {return isVacuum()? "vacuum": materialName;}
00077
00079 const char * title() const {return materialName;}
00080
00082 float Z() const;
00083 float A() const;
00084 float density() const;
00085
00087 float radiationLength() const {return rlc;}
00089 float interactionLength() const { return lambda; }
00090
00092 void setRadiationLength(float r){rlc=r;}
00094 void setInteractionLength(float r){lambda=r;}
00095
00097 static Material* vacuum;
00098
00100 static void dataPath(const char* path);
00101
00103 static void addPath(const char* path);
00104
00106 static const char *getDataPath();
00107
00108
00110
00119 static unsigned declareMatData(MatData*);
00120
00122 void* getMatData(unsigned index);
00123
00124 typedef std::list<AtomicElement*> Element_list;
00126 Element_list elementList;
00127
00129 static void printAll(std::ostream&);
00130
00132 void printOn(std::ostream&);
00133
00134
00136 static void deleteAll();
00137
00139 struct AtomicElement
00140 {
00141 AtomicElement(char*,float,float,float,float);
00142
00143 char name[3];
00144
00145
00146 float z,a,pz,rhoz;
00147
00148
00149 operator int()const{return static_cast<int>(z);}
00150 };
00151
00152
00153 protected:
00154
00155 static std::string* s_dataPath;
00156
00157
00158 std::string m_fileName;
00159
00160
00161 char materialName[16];
00162
00163
00164 float zeff;
00165
00166
00167 float aeff;
00168
00169
00170 float rho;
00171
00172
00173 float rlc;
00174
00175
00176 float lambda;
00177
00178
00179 typedef std::vector<MatData*> MatData_list;
00180
00181 MatData_list matDataList;
00182
00183
00184 public:
00185 Material * nextMaterial;
00186 static Material * firstMaterial;
00187
00188
00189 private:
00190 float energyLoss1,energyLoss2,energyLoss3,IP;
00191
00192
00193 float density_correction(float eta) const;
00194
00195
00196 };
00197 inline void*
00198 Material::getMatData(unsigned index)
00199 {
00200 return matDataList[index];
00201 }
00202 inline float
00203 Material::Z()const{ return zeff;}
00204
00205 inline float
00206 Material::A()const{ return aeff;}
00207
00208 inline float
00209 Material::density()const{ return rho;}
00210
00211 #endif
00212