Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 << 25 // >> 26 // >> 27 // $Id$ >> 28 // >> 29 // 26 ////////////////////////////////////////////// 30 //////////////////////////////////////////////////////////////////////// 27 // G4OpticalSurface Definition 31 // G4OpticalSurface Definition 28 ////////////////////////////////////////////// 32 //////////////////////////////////////////////////////////////////////// 29 // 33 // 30 // File: G4OpticalSurface.hh 34 // File: G4OpticalSurface.hh 31 // Description: A optical surface class for us 35 // Description: A optical surface class for use in G4OpBoundaryProcess 32 // Version: 2.0 36 // Version: 2.0 33 // Created: 1997-06-26 37 // Created: 1997-06-26 34 // Author: Peter Gumplinger 38 // Author: Peter Gumplinger 35 // Updated: 1999-10-29 add method and clas 39 // Updated: 1999-10-29 add method and class descriptors 36 // 2017-02-24 Mariele Stockhoff a << 40 // mail: gum@triumf.ca 37 // 41 // 38 // Class Description: << 39 // A optical surface class for use in the G4Op << 40 // Contains the enumerations: G4OpticalSurface << 41 // and G4OpticalSurfaceModel. << 42 ////////////////////////////////////////////// 42 //////////////////////////////////////////////////////////////////////// 43 43 44 #ifndef G4OpticalSurface_h 44 #ifndef G4OpticalSurface_h 45 #define G4OpticalSurface_h 1 45 #define G4OpticalSurface_h 1 46 46 47 #include "G4Physics2DVector.hh" << 47 ///////////// 48 #include "G4SurfaceProperty.hh" << 48 // Includes >> 49 ///////////// >> 50 49 #include "G4Types.hh" 51 #include "G4Types.hh" >> 52 #include "G4SurfaceProperty.hh" >> 53 >> 54 // Class Description: >> 55 // A optical surface class for use in the G4OpBoundaryProcess class. >> 56 // Contains the enumerations: G4OpticalSurfaceFinish, G4OpticalSurfaceType, >> 57 // and G4OpticalSurfaceModel. >> 58 // Class Description - End: 50 59 51 // clang-format off << 52 enum G4OpticalSurfaceFinish 60 enum G4OpticalSurfaceFinish 53 { 61 { 54 polished, // smooth perfectly p << 62 polished, // smooth perfectly polished surface 55 polishedfrontpainted, // smooth top-layer ( << 63 polishedfrontpainted, // smooth top-layer (front) paint 56 polishedbackpainted, // same is 'polished' << 64 polishedbackpainted, // same is 'polished' but with a back-paint 57 << 65 58 ground, // rough surface << 66 ground, // rough surface 59 groundfrontpainted, // rough top-layer (fro << 67 groundfrontpainted, // rough top-layer (front) paint 60 groundbackpainted, // same as 'ground' but << 68 groundbackpainted, // same as 'ground' but with a back-paint 61 << 69 62 // for LBNL LUT model << 70 polishedlumirrorair, // mechanically polished surface, with lumirror 63 polishedlumirrorair, // mechanically polis << 71 polishedlumirrorglue, // mechanically polished surface, with lumirror & meltmount 64 polishedlumirrorglue, // mechanically polis << 72 polishedair, // mechanically polished surface 65 // meltmount << 73 polishedteflonair, // mechanically polished surface, with teflon 66 polishedair, // mechanically polis << 74 polishedtioair, // mechanically polished surface, with tio paint 67 polishedteflonair, // mechanically polis << 75 polishedtyvekair, // mechanically polished surface, with tyvek 68 polishedtioair, // mechanically polis << 76 polishedvm2000air, // mechanically polished surface, with esr film 69 polishedtyvekair, // mechanically polis << 77 polishedvm2000glue, // mechanically polished surface, with esr film & meltmount 70 polishedvm2000air, // mechanically polis << 78 71 polishedvm2000glue, // mechanically polis << 79 etchedlumirrorair, // chemically etched surface, with lumirror 72 // meltmount << 80 etchedlumirrorglue, // chemically etched surface, with lumirror & meltmount 73 << 81 etchedair, // chemically etched surface 74 etchedlumirrorair, // chemically etched su << 82 etchedteflonair, // chemically etched surface, with teflon 75 etchedlumirrorglue, // chemically etched su << 83 etchedtioair, // chemically etched surface, with tio paint 76 etchedair, // chemically etched su << 84 etchedtyvekair, // chemically etched surface, with tyvek 77 etchedteflonair, // chemically etched su << 85 etchedvm2000air, // chemically etched surface, with esr film 78 etchedtioair, // chemically etched su << 86 etchedvm2000glue, // chemically etched surface, with esr film & meltmount 79 etchedtyvekair, // chemically etched su << 87 80 etchedvm2000air, // chemically etched su << 88 groundlumirrorair, // rough-cut surface, with lumirror 81 etchedvm2000glue, // chemically etched su << 89 groundlumirrorglue, // rough-cut surface, with lumirror & meltmount 82 << 90 groundair, // rough-cut surface 83 groundlumirrorair, // rough-cut surface, w << 91 groundteflonair, // rough-cut surface, with teflon 84 groundlumirrorglue, // rough-cut surface, w << 92 groundtioair, // rough-cut surface, with tio paint 85 groundair, // rough-cut surface << 93 groundtyvekair, // rough-cut surface, with tyvek 86 groundteflonair, // rough-cut surface, w << 94 groundvm2000air, // rough-cut surface, with esr film 87 groundtioair, // rough-cut surface, w << 95 groundvm2000glue // rough-cut surface, with esr film & meltmount 88 groundtyvekair, // rough-cut surface, w << 89 groundvm2000air, // rough-cut surface, w << 90 groundvm2000glue, // rough-cut surface, w << 91 << 92 // for DAVIS model << 93 Rough_LUT, // rough surface << 94 RoughTeflon_LUT, // rough surface wra << 95 RoughESR_LUT, // rough surface wra << 96 RoughESRGrease_LUT, // rough surface wra << 97 // and coupled with << 98 Polished_LUT, // polished surface << 99 PolishedTeflon_LUT, // polished surface << 100 PolishedESR_LUT, // polished surface << 101 PolishedESRGrease_LUT, // polished surface << 102 // and coupled with << 103 Detector_LUT // polished surface << 104 }; 96 }; 105 97 106 enum G4OpticalSurfaceModel 98 enum G4OpticalSurfaceModel 107 { 99 { 108 glisur, // original GEANT3 model << 100 glisur, // original GEANT3 model 109 unified, // UNIFIED model << 101 unified, // UNIFIED model 110 LUT, // Look-Up-Table model (LBNL model << 102 LUT // Look-Up-Table model 111 DAVIS, // DAVIS model << 112 dichroic // dichroic filter << 113 }; 103 }; 114 104 115 // clang-format on << 116 << 117 class G4MaterialPropertiesTable; 105 class G4MaterialPropertiesTable; 118 106 >> 107 ///////////////////// >> 108 // Class Definition >> 109 ///////////////////// >> 110 119 class G4OpticalSurface : public G4SurfacePrope 111 class G4OpticalSurface : public G4SurfaceProperty 120 { 112 { 121 public: << 122 // Constructor of an optical surface object. << 123 G4OpticalSurface(const G4String& name, G4Opt << 124 G4OpticalSurfaceFinish finish = polished, << 125 G4double value = 1.0); << 126 << 127 ~G4OpticalSurface() override; << 128 << 129 G4OpticalSurface(const G4OpticalSurface& rig << 130 G4OpticalSurface& operator=(const G4OpticalS << 131 << 132 G4bool operator==(const G4OpticalSurface& ri << 133 G4bool operator!=(const G4OpticalSurface& ri << 134 << 135 void SetType(const G4SurfaceType& type) over << 136 << 137 // Returns the optical surface finish. << 138 inline G4OpticalSurfaceFinish GetFinish() co << 139 << 140 // Sets the optical surface finish. << 141 void SetFinish(const G4OpticalSurfaceFinish) << 142 113 143 // Returns the optical surface model used. << 114 public: // Without description 144 inline G4OpticalSurfaceModel GetModel() cons << 115 >> 116 ////////////// >> 117 // Operators >> 118 ////////////// >> 119 >> 120 G4OpticalSurface(const G4OpticalSurface &right); >> 121 G4OpticalSurface & operator=(const G4OpticalSurface &right); >> 122 >> 123 G4int operator==(const G4OpticalSurface &right) const; >> 124 G4int operator!=(const G4OpticalSurface &right) const; 145 125 146 // Sets the optical surface model to be foll << 126 public: // With description 147 inline void SetModel(const G4OpticalSurfaceM << 148 127 149 // Returns an unified model surface paramete << 128 //////////////////////////////// 150 inline G4double GetSigmaAlpha() const { retu << 129 // Constructors and Destructor >> 130 //////////////////////////////// 151 131 152 // Sets an unified model surface parameter. << 132 G4OpticalSurface(const G4String& name, 153 inline void SetSigmaAlpha(const G4double s_a << 133 G4OpticalSurfaceModel model = glisur, >> 134 G4OpticalSurfaceFinish finish = polished, >> 135 G4SurfaceType type = dielectric_dielectric, >> 136 G4double value = 1.0); >> 137 // Constructor of an optical surface object. 154 138 155 // Returns the optical surface polish type. << 139 public: // Without description 156 G4double GetPolish() const { return polish; << 157 140 158 // Sets the optical surface polish type. << 141 virtual ~G4OpticalSurface(); 159 inline void SetPolish(const G4double plsh) { << 160 142 161 // Retrieves the pointer of the G4MaterialPr << 143 //////////// 162 // attached to optical surface. << 144 // Methods 163 inline G4MaterialPropertiesTable* GetMateria << 145 //////////// 164 { << 165 return theMaterialPropertiesTable; << 166 } << 167 146 168 // Attaches a G4MaterialPropertiesTable to t << 147 // public methods 169 inline void SetMaterialPropertiesTable(G4Mat << 170 { << 171 theMaterialPropertiesTable = anMPT; << 172 } << 173 148 174 // Prints information about the optical surf << 149 public: // With description 175 void DumpInfo() const; << 176 150 177 // call the correct ReadXXXFile << 151 void SetType(const G4SurfaceType& type); 178 void ReadDataFile(); << 179 152 180 // read a zlib-compressed file << 153 inline G4OpticalSurfaceFinish GetFinish() const { return theFinish; } 181 void ReadCompressedFile(const G4String&, std << 154 // Returns the optical surface finish. >> 155 void SetFinish(const G4OpticalSurfaceFinish ); >> 156 // Sets the optical surface finish. 182 157 183 // Method to read the Look-Up-Table into arr << 158 inline G4OpticalSurfaceModel GetModel() const { return theModel; } 184 void ReadLUTFile(); << 159 // Returns the optical surface model used. >> 160 inline void SetModel(const G4OpticalSurfaceModel model) >> 161 { theModel = model; } >> 162 // Sets the optical surface model to be followed. 185 163 186 // for DAVIS model << 164 inline G4double GetSigmaAlpha() const { return sigma_alpha; } 187 inline G4double GetAngularDistributionValue( << 165 // Returns an unified model surface parameter. >> 166 inline void SetSigmaAlpha(const G4double s_a) { sigma_alpha = s_a; } >> 167 // Sets an unified model surface parameter. 188 168 189 // Returns the AngularDistributionValue << 169 G4double GetPolish() const { return polish; } 190 inline G4double GetAngularDistributionValueL << 170 // Returns the optical surface polish type. >> 171 inline void SetPolish(const G4double plsh) { polish=plsh; } >> 172 // Sets the optical surface polish type. 191 173 192 // Method to read the Davis Look-Up-Table in << 174 inline G4MaterialPropertiesTable* GetMaterialPropertiesTable() const 193 void ReadLUTDAVISFile(); << 175 { return theMaterialPropertiesTable; } >> 176 // Retrieves the pointer of the G4MaterialPropertiesTable >> 177 // attached to optical surface. 194 178 195 // Method to read the Look-Up-Table for refl << 179 inline void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT) 196 void ReadReflectivityLUTFile(); << 180 { theMaterialPropertiesTable = anMPT; } >> 181 // Attaches a G4MaterialPropertiesTable to the optical surface. 197 182 198 // Returns the reflectivity value from the D << 183 void DumpInfo() const; 199 inline G4double GetReflectivityLUTValue(G4in << 184 // Prints information about the optical surface. 200 185 201 // Returns the number of lines in the Davis << 186 void ReadFile(void); 202 G4int GetInmax() const; << 187 // Method to read the Look-Up-Table into array AngularDistribution 203 188 204 // Returns the number of probability values << 189 inline G4double GetAngularDistributionValue(G4int, G4int, G4int); 205 G4int GetLUTbins() const; << 206 190 207 // Returns the number of reflectivity values << 191 inline G4int GetThetaIndexMax(void) const { return thetaIndexMax; } 208 G4int GetRefMax() const; << 192 inline G4int GetPhiIndexMax(void) const { return phiIndexMax; } 209 193 210 G4int GetThetaIndexMax() const; << 194 private: 211 G4int GetPhiIndexMax() const; << 212 195 213 // Method to read the dichroic surface data << 196 // ------------------ 214 void ReadDichroicFile(); << 197 // Basic data members ( To define an optical surface) >> 198 // ------------------ 215 199 216 inline G4Physics2DVector* GetDichroicVector( << 200 G4OpticalSurfaceModel theModel; // Surface model >> 201 G4OpticalSurfaceFinish theFinish; // Surface finish 217 202 218 private: << 203 G4double sigma_alpha; // The sigma of micro-facet polar angle 219 G4OpticalSurfaceModel theModel; // Surface << 204 G4double polish; // Polish parameter in glisur model 220 G4OpticalSurfaceFinish theFinish; // Surfac << 221 205 222 G4double sigma_alpha; // The sigma of micro << 206 G4MaterialPropertiesTable* theMaterialPropertiesTable; 223 G4double polish; // Polish parameter in gli << 224 207 225 G4MaterialPropertiesTable* theMaterialProper << 208 static const G4int incidentIndexMax = 91; >> 209 static const G4int thetaIndexMax = 45; >> 210 static const G4int phiIndexMax = 37; 226 211 227 static const G4int incidentIndexMax = 91; << 212 G4float* AngularDistribution; 228 static const G4int thetaIndexMax = 45; << 229 static const G4int phiIndexMax = 37; << 230 213 231 G4float* AngularDistribution; << 214 // Open LUT with Material and Integer Angle 232 G4Physics2DVector* DichroicVector; << 215 FILE* readFileHandle; 233 216 234 // for DAVIS model << 235 static const G4int indexmax = 7280001; // 3 << 236 static const G4int RefMax = 90; << 237 static const G4int LUTbins = 20000; << 238 G4float* AngularDistributionLUT; << 239 G4float* Reflectivity; << 240 }; 217 }; 241 218 242 //////////////////// 219 //////////////////// 243 // Inline methods 220 // Inline methods 244 //////////////////// 221 //////////////////// 245 222 246 inline G4double G4OpticalSurface::GetAngularDi << 223 inline 247 G4int angleIncident, G4int thetaIndex, G4int << 224 G4double G4OpticalSurface::GetAngularDistributionValue(G4int angleIncident, 248 { << 225 G4int thetaIndex, 249 G4int product = angleIncident * thetaIndex * << 226 G4int phiIndex) 250 if (product < 0 || product >= incidentIndexM << 227 { 251 G4ExceptionDescription ed; << 228 return AngularDistribution[angleIncident+ 252 ed << "Index angleIncident: " << angleInci << 229 thetaIndex*incidentIndexMax+ 253 << " phiIndex: " << phiIndex << " out o << 230 phiIndex*thetaIndexMax*incidentIndexMax]; 254 G4Exception("G4OpticalSurface::GetAngularD << 255 return 0.; << 256 } << 257 return (G4double)AngularDistribution[angleIn << 258 phiInde << 259 } << 260 << 261 inline G4double G4OpticalSurface::GetAngularDi << 262 { << 263 if (i < 0 || i >= indexmax) { << 264 G4ExceptionDescription ed; << 265 ed << "Index " << i << " out of range!"; << 266 G4Exception("G4OpticalSurface::GetAngularD << 267 return 0.; << 268 } << 269 return (G4double)AngularDistributionLUT[i]; << 270 } 231 } 271 << 272 inline G4double G4OpticalSurface::GetReflectiv << 273 { << 274 if (i < 0 || i >= RefMax) { << 275 G4ExceptionDescription ed; << 276 ed << "Index " << i << " out of range!"; << 277 G4Exception("G4OpticalSurface::GetReflecti << 278 return 0.; << 279 } << 280 return (G4double)Reflectivity[i]; << 281 } << 282 << 283 inline G4Physics2DVector* G4OpticalSurface::Ge << 284 232 285 #endif /* G4OpticalSurface_h */ 233 #endif /* G4OpticalSurface_h */ 286 234